• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Using the Data Holder

The DataHolder component holds various types of data and lets you generate events based on how the data changes. The main function of the DataHolder component is to hold data and act as a conduit between other components utilizing data binding. You can assign any type of data to a DataHolder property, either by creating a binding between the data and another property, or by using your own ActionScript code. Whenever the value of that data changes, the DataHolder component generates an event with a name equal to the property name. Any bindings associated with that property are executed. You could have a DataHolder that keeps the current system time, and have several display fields bound to that information. One of the fields is simply a display of the time in hours, minutes, and seconds, and another field might be a calculated field that displays good morning, afternoon, or evening, depending on the data sent from the DataHolder field. When you create a DataHolder it comes with one bindable property named data; you can add more properties to create a group of data information fields, which can transmit their data to other components.

Use the DataHolder Component

1.
Open the Components panel.

2.
Click the Data Components Expand triangle.

3.
Drag the DataHolder component onto the Stage, and then select the component.

4.
Give the DataHolder component a unique name in the Property Inspector.

5.
Click the UI Components Expand triangle.

6.
Drag a DataGrid component onto the Stage, and then select the component.

7.
Give the DataGrid component a unique name in the Property Inspector.

8.
Select the DataHolder component.

9.
Open the Component Inspector panel, and then click the Schema tab.

10.
Click the Add Component Property (+) button located at the top of the Schema tab.

11.
Enter a unique name in the Field Name field.

12.
Select Array from the Data Type popup menu.

13.
Click the Bindings tab in the Component Inspector panel, and then add a binding between the property of the DataHolder component and the data provider property of the DataGrid component.

14.
15.
Select Frame 1 on the Timeline, and then enter the script as shown in the illustration.

16.
Click the Control menu, and then click Test Movie.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint