EasyManua.ls Logo

MACROMEDIA FLASH 8-USING FLASH - Page 392

MACROMEDIA FLASH 8-USING FLASH
678 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
392 Data Integration (Flash Professional Only)
6. Load a sample of the data source’s schema: with the XMLConnector instance still selected,
in the Component inspector click the Schema tab and follow these steps:
a. Select results : XML from the Schema tab top pane.
b. Click the Import a Schema from a sample XML file button.
c. Select the dinner_menu.xml file from the dialog box that appears.
The XML files schema structure appears in the Schema tab.
7. Expose the XMLConnector’s array property for data binding and bind it to the
DataSet’s
dataProvider property. With the XMLConnector component selected, follow
these steps:
a. On the Bindings tab of the Component inspector, click the plus (+) sign and in the
dialog box, select
food:array.
b. On the Bindings tab again, click Bound To, click the magnifying glass icon, select
DataSet, and select
dataProvider:Array.
Each time you create a binding, you perform at least these two basic steps.
8. Populate the data grid with the XML data by binding the XML data—through the DataSet
component—to the data grid. Select the DataSet component and click the Bindings tab.
You see the binding to the
xmlConn instance that you just added. Now, add two new
bindings:
a. Bind the DataSet’s dataProvider property to the DataGrid’s dataProvider
property: click the plus (+) sign, select the
dataProvider:Array property, click
Bound To, click the magnifying glass icon, select DataGrid, then select the
dataProvider:Array property. Select out for the direction.
b. Bind the DataSets selectedIndex property to the DataGrid’s selectedIndex
property: click the plus (+) sign, select the
selectedIndex:Number property, click
Bound To, click the magnifying glass icon, select DataGrid, then select the
selectedIndex:Number property.
9. Set up the button to load data into the data grid. Click layer 1 in frame 1 of the Timeline
and open the Actions panel. Add the following code to the first frame:
form = new Object();
form.click = function(eventObj){
xmlConn.trigger();
}
loadData.addEventListener("click", form);
10.
Save and test the application. Click Load Data. The data from the XML file is loaded into
the DataGrid.
You've just created your first data integration application, with data dynamically loaded
from an XML file. To add more functionality to this application, see “Creating an indexed
binding” on page 407.

Table of Contents

Related product manuals