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

Creating Bindings

Data binding is a simple way of connecting Flash components to each other. Components can be viewed as containers that transfer information (images, text, numbers, video, graphics) from one to the other. In the Component Inspector panel, the Bindings tab controls the two containers, so that when property X of component Y changes, it will copy the new value to property Y of component B. You can do data binding within the Component Inspector panel using the Bindings tab. The Bindings tab lets you add, view, and remove bindings for the selected component. Although data binding works with any component, its main purpose is to connect Component panel UI components to external data sources such as Web Services and XML documents. These external data sources are available as components with properties, which you can bind to other component properties. The Component Inspector panel is the main tool that is used within Flash for data binding. It contains a Schema tab for defining the schema for a component and a Bindings tab for creating bindings between component properties. The following example demonstrates how to create basic data binding by connecting one UI component to another.

Create Bindings

Open the Components panel.

Click the UI Components Expand triangle.

Drag the NumericStepper component onto the Stage, and then select the component.

Give the NumericStepper a unique instance name in the Property Inspector.

Drag a second NumericStepper onto the Stage, and then give it a unique instance name.

Select the first NumericStepper component.

See Also

See Chapter 19 on “Adding and Modifying Data Components” on page 413 for more information on XML and Web Services.

Open the Component Inspector panel, and then click the Bindings tab.

Click the Add Binding (+) button to add a binding.

In the Add Binding dialog box, select Value.

Click OK.

Move to the Name/Value section, located at the bottom of the Bindings tab.

Click the Bound To item under Name, and then click the Magnifying Glass icon.

In the Bound To dialog box, select component B.

Click OK.

Click the Control menu, and then click Test Movie.

When you click the up and down buttons on the first NumericStepper, the value changes automatically in the second NumericStepper.

IMPORTANT You can use the Bindings tab to link two or more components together. If you want to add another component, just click the Add Binding (+) button to bind a second, or third component. There is no limit to the number of components that can be bound together.



Not a subscriber?

Start A Free Trial

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