426
Data Integration (Flash Professional Only)
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},
{id:1, firstName:"Susan", lastName:"Meth", age:55,
usCitizen:true},
{id:2, firstName:"Pablo", lastName:"Picasso", age:108,
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
dataProvider:Array
.
9.
Click Bound To, select the DataSet component, and select its
dataProvider:Array
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.
Summary of Contents for FLASH 8-FLASH
Page 1: ...Using Flash ...
Page 12: ...12 Contents ...
Page 110: ...110 Using Symbols Instances and Library Assets ...
Page 128: ...128 Working with Color Strokes and Fills ...
Page 156: ...156 Drawing ...
Page 190: ...190 Working with Text ...
Page 224: ...224 Working with Graphic Objects ...
Page 270: ...270 Creating Motion ...
Page 310: ...310 Working with Video ...
Page 362: ...362 Working with Screens Flash Professional Only ...
Page 386: ...386 Creating Multilanguage Text ...
Page 454: ...454 Data Integration Flash Professional Only ...
Page 500: ...500 Publishing ...
Page 534: ...534 Creating Accessible Content ...