User Guide
284 Chapter 14: Data Integration (Flash Professional Only)
Array of objects returned from an XMLConnector component The following illustration
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
results.datapacket.row array is bound to the dataProvider
property of the
myDataset instance of the DataSet component.
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. Accessing the data at runtime is simple. Because the data is loaded as objects,
data is exposed through properties that can be referenced in code. The DataSet component has a
method (
DataSet.first) that lets you make the first item in the array the currently selected
object.
The following code shows an example of accessing data at runtime. It loads an existing DataSet
component instance
myDataSet with customer information and then displays each customer’s
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},
{id:1, firstName:"Susan", lastName:"Meth", age:55,
usCitizen:true},
{id:2, firstName:"Pablo", lastName:"Picasso", age:108,
usCitizen:false}];