
Data binding (Flash Professional only)
395
In the Flash interface, you bind data by using the Bindings and Schema tabs of the
Component inspector. Although you need to understand how bindings and schemas work in
Flash, your connector component is usually the first component you need to set up, because it
brings in the schema for your data source; see
“Data connectivity (Flash Professional only)”
on page 412
.
Data binding is supported only between components that exist in Frame 1 of the main
Timeline, Frame 1 of a movie clip, or Frame 1 of a screen.
You can also create runtime bindings by writing ActionScript code. For more information, see
“Data binding classes (Flash Professional only)” in the
Components Language Reference
.
A simple binding example
The following procedure provides a simple illustration of how data binding connects one UI
component to another. In the example, the value properties of component instances
stepper1_nm
and
stepper2_nm
are bound to each other, and the value properties of
stepper3_nm
and
myInput_txt
are bound to each other. In a real-world application, you
would most likely import a schema, define additional bindable component properties, and
create multiple bindings between data components and UI components.
To connect UI components to create data binding:
1.
Add a NumericStepper component to the Stage, and name it
stepper1_nm
.
2.
Add another NumericStepper component, and name it
stepper2_nm
.
3.
With
stepper1_nm
selected, open the Component inspector, and click the Bindings tab.
4.
Click the Add Binding (+) button to add a binding.
5.
In the Add Binding dialog box, select Value, and click OK.
6.
In the Name/Value section at the bottom of the Bindings tab, click the Bound To
item under Name, and click the magnifying glass icon across from the Bound To item
under Value.
7.
In the Bound To dialog box, select component
stepper2_nm
under Component Path, and
click OK.
8.
Select Control > Test Movie. Click the Up and Down buttons on component
stepper1_nm
.
Each time you click the buttons on
stepper1_nm
, the
value
property of
stepper1_nm
is
copied to the
value
property of
stepper2_nm
. Each time you click the buttons on
stepper2_nm
, the
value
property of
stepper2_nm
is copied to the
value
property of
stepper1_nm
.
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 ...