MACROMEDIA FLASH MX 2004-USING FLASH Use Manual page 284

Hide thumbs Also See for FLASH MX 2004-USING FLASH:
Table of Contents

Advertisement

Array of objects returned from an XMLConnector component
shows an example of using the Component inspector to bind an array of XML nodes, represented
with the XMLConnector component. It assumes that you have imported a schema for an XML
file that contains an array of XML nodes. The illustration on the left shows the schema of the
XML document, the array of XML nodes represented as an ActionScript array. The illustration
on the right shows how the
property of the
myDataset
Accessing the data
After the data is loaded into the DataSet component and the schema for the DataSet component
has been defined, the data can be accessed. You can access data at runtime or at design time.
Runtime example.
data is exposed through properties that can be referenced in code. The DataSet component has a
method (
DataSet.first
object.
The following code shows an example of accessing data at runtime. It loads an existing DataSet
component instance
name in the trace window. Notice that the data types for the customer information—the array of
objects—are added so the data displays properly:
//Drag DataSet component to Stage and name it myDataSet (easiest way to create
instance and import necessary libraries)
//Creates recData which contains customer information in an array of objects
var recData = [{id:0, firstName:"Frank", lastName:"Jones", age:27,
usCitizen:true},
usCitizen:true},
usCitizen:false}];
284
Chapter 14: Data Integration (Flash Professional Only)
results.datapacket.row
instance of the DataSet component.
Accessing the data at runtime is simple. Because the data is loaded as objects,
) that lets you make the first item in the array the currently selected
with customer information and then displays each customer's
myDataSet
{id:1, firstName:"Susan", lastName:"Meth", age:55,
{id:2, firstName:"Pablo", lastName:"Picasso", age:108,
The following illustration
array is bound to the
dataProvider

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash mx 2004 - actionscript

Table of Contents