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
property of a DataGrid component by using the Bindings tab in the Component
dataProvider
inspector.
To use the DataHolder component in a simple application:
In Flash MX Professional 2004, create a new file.
1.
Open the Components panel, drag a DataHolder component to the Stage, and name it
2.
dataHolder.
Drag a DataGrid component to the Stage and name it namesGrid.
3.
Select the DataHolder component and open the Component inspector.
4.
Click the Schema tab in the Component inspector.
5.
Click the Add Component Property (+) button located in the top pane of the Schema tab.
6.
In the bottom pane of the Schema tab, type namesArray in the Field Name field, and select
7.
Array from the Data Type pop-up menu.
Click the Bindings tab in the Component inspector, and add a binding between the
8.
property of the DataHolder component and the
namesArray
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.
In the Timeline, select the first frame on Layer 1 and open the Actions panel.
9.
Enter the following code in the Actions panel:
10.
dataHolder.namesArray= [{name:"Tim"},{name:"Paul"},{name:"Jason"}];
This code populates the
executes, the binding that you established previously between the DataHolder component and
the DataGrid component executes.
Test the file by selecting Control > Test Movie.
11.
array with several objects. When this variable assignment
namesArray
DataHolder component (Flash Professional only)
property of the
dataProvider
287
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?
Questions and answers