• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Using the XML Connector

The XMLConnector component is designed to read or write XML documents using standard HTTP protocol, get operations or post operations. It acts as the connector between other Flash components and external XML data sources. For example, you could use a DataGrid component to format and display information received from a remote site containing an XML document. Since XML (Extensible Markup Language) is a hardware independent language, it's easy to work with, and can be modified to fit a specific purpose. The XMLConnector communicates with components in a Flash application using data binding features, or ActionScript code. It has properties, methods, and events but no runtime visual appearance. In fact, all of Flash's connector components have no visual presence; they are simply the gateway for passing information from one source to another. The XMLConnector component implements a set of methods, properties, and events that define a simple way to send parameters to, and receive results from an external data source.

Use the XMLConnector Component

Open the Components panel.

Click the Data Components Expand triangle.

Drag the XMLConnector component onto the Stage, and then select the component.

Give the XMLConnector component a unique name in the Property Inspector.

Open the Component Inspector panel, and then click the Parameters tab.

Enter the full path name to the external XML file.

Click the Schema tab, and then specify a schema for the XML document.

The schema tab lets you create fields to format the XML data.

Click the Bindings tab to bind the data elements from the XML document to properties of the visual components in your application.

For example, you can connect to an XML document that provides weather data, and bind the Location and Temperature data elements to Label components in your application, so that the name and temperature of a specified city appears in the application at runtime.

Click OK.

Add a trigger to initiate the data binding operation by attaching the trigger behavior to a button, and then add your own ActionScript.

You can also create a binding between an XML parameter and setting a UI component's Kind property to AutoTrigger.

Click the Control menu, and then click Test Movie.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint