Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 133

Creating and extending flex 2 components
Hide thumbs Also See for FLEX 2 - CREATING AND EXTENDING COMPONENTS:
Table of Contents

Advertisement

For example, in the section
created a class with the public property
as the destination of a binding expression, as the following example shows:
<?xml version="1.0"?>
<!-- as/MainTextAreaFontControlBindingDest.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*" >
<MyComp:TextAreaFontControl id="myTA"
maxFontSize="{Number(myTI.text)}"/>
<mx:Label text="Enter max font size."/>
<mx:TextInput id="myTI" text="25"/>
</mx:Application>
In this example, any value that the user enters into the
copied to the
maxFontSize
Using properties as the source of a data binding expression
When a property is the source of a data binding expression, Flex automatically copies the
value of the source property to any destination property when the source property changes.
However, in order to signal to Flex to perform the copy, you must register the property with
Flex and the source property must dispatch an event.
To register a property as a source for data bindings, you use the
You can use this tag in three places:
Before a class definition to make all public properties defined as variables or by using setter
and getter methods usable as the source of a binding expression
Before a property that a variable defines to make that specific property support binding
Before a getter method for a property implemented by using setter and getter methods
When you use the
applies to public properties; it does not apply to private or protected properties, or to
properties defined in any other namespace. You must insert the
tag before a nonpublic property to make it usable as the source for a data binding
expression.
For more information on the
in Custom Components," on page
"Defining public properties in ActionScript" on page
maxFontSize
property.
metadata tag before a public class definition, it only
[Bindable]
metadata tag, see
[Bindable]
45.
. You can use the
TextInput
control is automatically
[Bindable]
Chapter 5, "Using Metadata Tags
Adding properties and methods to a component
125, you
property
maxFontSize
metadata tag.
metadata
[Bindable]
133

Advertisement

Table of Contents
loading

Table of Contents