Specify a schema for the XML data source
When you connect to an external XML data source with the XMLConnector component, you
need to specify a schema—a schematic representation which identifies the structure of the XML
document. The schema tells the XMLConnector component how to read the XML data source.
The easiest way to specify a schema is to import a copy of the XML file that you're going to
connect to, and use that copy as a schema.
Launch your web browser and go to
1.
location you set for the XMLConnector URL parameter).
Select File > Save As.
2.
Save products.xml to the same location as the FLA file that you're working on.
3.
Select Frame 1 in the main Timeline.
4.
On the Stage, select the products_xmlcon (XMLConnector) instance.
5.
In the Component inspector, click the Schema tab. Click the Import button (on the right side
6.
of the Schema tab, above the scroll pane). In the Open dialog box, locate the products.xml file
that you imported in step 3, and click Open. The schema for the products.xml file appears in
the scroll pane of the Schema tab.
Bind the XMLConnector, DataSet, and DataGrid components
You'll use the Binding tab in the Component inspector to bind the XMLConnector, DataSet, and
DataGrid component instances to one another.
For information on working with data binding, see "Data binding (Flash Professional only)" in
Using Flash.
With the products_xmlcon (XMLConnector) instance selected on the Stage, click the Bindings
1.
tab in the Component inspector.
Click the Add Binding button.
2.
In the Add Binding dialog box, select the
3.
OK.
In the Bindings tab, click the Bound To item in the Binding Attributes pane (the bottom pane,
4.
showing attribute name-value pairs).
In the Value column for the Bound To item, click the magnifying glass icon to open the Bound
5.
To dialog box.
In the Bound To dialog box, select the products_ds (DataSet) instance in the Component Path
6.
pane. Select
dataProvider:array
In the Bindings tab, click the Direction item in the Binding Attributes pane. From the pop-up
7.
menu in the Value column, select Out.
This option means that the data will pass from the products_xmlcon instance to the
products_ds instance (rather than passing in both directions, or passing from the DataSet
instance to the XMLConnector instance).
32
Chapter 2: Creating an Application with Components (Flash Professional Only)
www.flash-mx.com/mm/firstapp/problems.xml
results.products.product array
in the Schema Location pane. Click OK.
(the
item and click
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?
Questions and answers