User Guide
DataHolder component (Flash Professional only) 287
Note: The DataHolder component is not meant to implement the same control over your data as the
DataSet component. It does not manage or track data, nor does it have the ability to update data. It is
a repository for holding data and generating events when that data has changed.
Creating an application with the DataHolder component
(Flash Professional only)
In this example, you add an array property to a DataHolder component’s schema (an array) whose
value is determined by ActionScript code that you write. You then bind that array property to the
dataProvider property of a DataGrid component by using the Bindings tab in the Component
inspector.
To use the DataHolder component in a simple application:
1.
In Flash MX Professional 2004, create a new file.
2.
Open the Components panel, drag a DataHolder component to the Stage, and name it
dataHolder.
3.
Drag a DataGrid component to the Stage and name it namesGrid.
4.
Select the DataHolder component and open the Component inspector.
5.
Click the Schema tab in the Component inspector.
6.
Click the Add Component Property (+) button located in the top pane of the Schema tab.
7.
In the bottom pane of the Schema tab, type namesArray in the Field Name field, and select
Array from the Data Type pop-up menu.
8.
Click the Bindings tab in the Component inspector, and add a binding between the
namesArray property of the DataHolder component and the dataProvider property of the
DataGrid component.
For more information on creating bindings with the Bindings tab, see “Working with bindings
in the Bindings tab (Flash Professional only)” in Using Flash.
9.
In the Timeline, select the first frame on Layer 1 and open the Actions panel.
10.
Enter the following code in the Actions panel:
dataHolder.namesArray= [{name:"Tim"},{name:"Paul"},{name:"Jason"}];
This code populates the namesArray array with several objects. When this variable assignment
executes, the binding that you established previously between the DataHolder component and
the DataGrid component executes.
11.
Test the file by selecting Control > Test Movie.