MACROMEDIA FLASH 8-USING FLASH Use Manual page 426

Using flash
Table of Contents

Advertisement

To access data at design time:
1.
Drag a DataSet component onto the Stage. Name it myDataSet.
2.
Select a layer in the Timeline, and press F9 to open the Actions panel. Type the
following code:
var recData = [{id:0, firstName:"Frank", lastName:"Jones", age:27,
usCitizen:true},
usCitizen:true},
usCitizen:false}];
myDataSet.items = recData;
3.
With the DataSet component selected, click the Schema tab of the Component inspector,
and click the Add a Component Property (+) button.
4.
Set the value for Field Name to firstName and leave the Data Type as String.
5.
Create three more component properties for the other name/value pairs in the code: field
name = lastName, data type = String; field name = usCitizen, data type = Boolean; and field
name = age, data type = Integer.
6.
Drag a DataGrid component onto the Stage, and name it myGrid.
7.
Select the DataGrid component, and click the Bindings tab of the Component inspector.
8.
Click the Add Binding (+) button to add a new binding. Select
9.
Click Bound To, select the DataSet component, and select its
property.
10.
Click Direction and select In.
11.
Save and test the application.
The data contained within the data set appears in the data grid.
The ability to make use of dynamic component properties that are added to the Schema tab
at design time is a special feature of the DataSet component. The DataSet component uses the
field name of these properties to map them to the properties of the object or array of objects.
The settings that are applied to these properties at design time are then used by the data set
at runtime.
426
Data Integration (Flash Professional Only)
{id:1, firstName:"Susan", lastName:"Meth", age:55,
{id:2, firstName:"Pablo", lastName:"Picasso", age:108,
dataProvider:Array
dataProvider:Array
.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents