MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 580

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

You can use ActionScript instead of the Bindings tab to create bindings between components.
Adding code is often faster and more efficient than relying on the authoring environment.
Using ActionScript to create bindings is necessary when you use code to add components to
an application. You can choose to use the
onto the Stage dynamically; however, you couldn't use the Bindings tab to create a binding
because the components don't exist until runtime. Using ActionScript to add data binding is
often called runtime data binding.
For more information, see the following topics:
Creating bindings between UI components using ActionScript
"Using components, bindings, and custom formatters" on page 584
"Adding and binding components on the Stage" on page 587
Creating bindings between UI components using
ActionScript
It isn't difficult to bind data between two components at runtime. You can do so in Flash
Basic 8 or Flash Professional 8. You must remember to include the DataBindingClasses
component in your document for it to work, because that component contains the classes that
you need to work with.
To create a binding between two TextInput components using ActionScript:
1.
Create a new Flash document called panel_as.fla.
2.
Drag two copies of the TextInput component onto the Stage.
3.
Give the components the following instance names: in_ti and out_ti.
4.
Select Window > Common Libraries > Classes and open the new common library called
Classes.fla.
5.
Drag a copy of the DataBindingClasses component into the Library panel, or drag the
component onto the Stage and then delete it.
You can close the common library after you finish. After you delete the
DataBindingClasses component from the Stage, Flash leaves a copy in the library.
If you forget to delete the DataBindingClasses component from the Stage, the
component's icon is visible at runtime.
When you created a binding using the Component inspector in the previous
example, Flash added the DataBindingClasses component automatically to the FLA
file. When you use ActionScript to create data bindings, you must copy that class
into your library yourself, as shown in the following step.
580
Creating Interaction with ActionScript
createClassObject()
method to add components

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents