User Guide

286 Chapter 6: Components Dictionary
DataHolder component (Flash Professional only)
The DataHolder component is a repository for data and a means of generating events when that
data has changed. Its main purpose is to hold data and act as a connector between other
components that use data binding.
Initially, the DataHolder component has a single bindable property named
data. You can add
more properties by using the Schema tab in the Component inspector. For more information on
using the Schema tab, see “Working with schemas in the Schema tab (Flash Professional only)” in
Using Flash.
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 emits an event whose name is the same as the
property, and any bindings associated with that property are executed.
In most cases, you will not use this component to build an application. It is needed only when
you cannot bind external data directly to another component and you do not want to use a
DataSet component. The DataHolder component is useful when you cant directly bind
components (such as connectors, user interface components, or DataSet components) together.
Below are some scenarios in which you might use a DataHolder component:
If a data value is generated by ActionScript, you might want to bind it to some other
components. In this case, you could have a DataHolder component that contains properties
that are bound as desired. Whenever new values are assigned to those properties (by means of
ActionScript, for example) those values will be distributed to the data-bound object.
You might have a data value that results from a complex indexed data binding, as shown in the
following diagram.
In this case it is convenient to bind the data value to a DataHolder component (called
DataModel in this illustration) and then use that for bindings to the user interface.
Web Service Method
getMovies
DataModel
myDataModel
UI ListBox
movieList
Results
data.movieTitle
data.movieRating
data.movieTimes
UI TextField
title
UI TextField
rating
UI ListBox
times
Results[movieList.selectedIndex]
CHAPTER 6
Components Dictionary