Binding From A Property - Adobe FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manual

Migrating applications to flex 2
Table of Contents

Advertisement

The <mx:Binding> tag must be a top-level
tag
In Flex 1.5, you could place the
tag must be a top-level tag in the MXML file. For example:
<mx:Binding>
Flex 1.x:
<mx:HBox>
<mx:Label id="myLabel"/>
<mx:Label id="my2ndLabel" text="hello"/>
<mx:Binding source="my2ndLabel.text" destination="myLabel.text"/>
</mx:HBox>
Flex 2:
<mx:Binding source="my2ndLabel.text" destination="myLabel.text"/>
<mx:HBox>
<mx:Label id="myLabel"/>
<mx:Label id="my2ndLabel" text="hello"/>
</mx:HBox>

Binding from a property

To make properties usable as the source for a data binding expression in Flex 2, you use the
metadata tag. Properties of custom components often have getter/setter pairs
[Bindable]
that were tagged with a
and update the setter to dispatch an Event object.
[Bindable]
This section describes these processes.
Binding from all public properties in a class
To make all public properties in a class usable as the source for a data binding expression,
properties defined as properties and properties defined by using both a setter and a getter
method, add the
[Bindable]
[Bindable]
public class MyClass { ... }
Although the easiest way to migrate an application that uses binding is to make all public
properties in a class support data binding, it is not necessarily the best practice to use the
metadata tag on an entire class. Doing this causes the compiler to generate more
[Bindable]
code, which in turn can affect performance and increase your application's file size.
106
Binding
<mx:Binding>
metadata tag. For Flex 2, you convert that tag to
[ChangeEvent]
metadata tag before the class statement:
tag in a Flex container. In Flex 2.0, the

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex 2

Table of Contents