Macromedia flex 2 Manual

Página de 254
Adding custom properties and methods to a component
101
If you omit the event name specification from the 
[Bindable]
 metadata tag, Flex 
automatically generates and dispatches an event named 
propertyChange
. If the property 
value remains the same on a write, Flex does not dispatch the event or update the 
property.
Alternatively, you can place the 
[Bindable]
 metadata before a public class definition. 
This makes all public properties that you defined as variables, and all public properties 
that you defined by using both a setter and a getter method, usable as the source of a 
binding expression.
3.
Add a call to the 
dispatchEvent()
 method to dispatch the event when you define the 
event name in the 
[Bindable]
 metadata tag.
For more information on using the 
[Bindable]
Passing references to properties of MXML 
components
One of the ways that you can make a component reusable is to design it so that users can pass 
values to the component by using public properties of the component. 
 describes how to define properties for MXML 
components by using MXML and ActionScript, and shows how to pass values to those 
properties. 
Rather than passing a value to a component, you can pass a reference to it. The reference 
could be to the calling component, to another component, or to a property of a component. 
This section describes several different ways of passing references to your components.
Accessing the Application object
The 
Application
 object is the top-level object in a Flex application. Often, you must reference 
properties or objects of the Application object from your custom component. Use the 
mx.core.Application.application
 static property to reference the application object.
NO
TE
When you use the 
[Bindable]
 metadata tag before a public class definition, it only 
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 
[Bindable]
 metadata 
tag before a nonpublic property to make it usable as the source for a data binding 
expression.