Macromedia flex 2 Manual

Página de 254
60
Using Metadata Tags in Custom Components
The following example defines the 
myProp
 parameter as inspectable:
[Inspectable(defaultValue=true, verbose=1, category="Other")]
public var myProp:Boolean;
InstanceType metadata tag
The 
[InstanceType]
 metadata tag specifies the allowed data type of a property of type 
IDeferredInstance, as the following example shows:
// Define a deferred property for the top component.
[InstanceType("mx.controls.Label")]
public var topRow:IDeferredInstance;
The Flex compiler validates that users only assign values of the specified type to the property. 
In this example, if the component user sets the topRow property to a value of a type other 
than mx.controls.Label, the compiler issues an error message.
You use the 
[InstanceType]
 metadata tag when creating template components. For more 
information, see 
The 
[InstanceType]
 metadata tag has the following syntax:
[InstanceType("package.className")]
You must specify a fully qualified package and class name.
NonCommittingChangeEvent metadata tag
The 
[NonCommittingChangeEvent]
 metadata tag identifies an event as an interim trigger, 
which means that the event should not invoke Flex data validators on the property. You use 
this tag for properties that might change often, but which you do not want to validate on 
every change. 
An example of this is if you tied a validator to the 
text
 property of a TextInput control. The 
text
 property changes on every keystroke, but you do not want to validate the property until 
the user presses the Enter key or changes focus away from the field. The 
NonCommittingChangeEvent
 tag lets you dispatch a change event, but that does not trigger 
validation. 
variable
String
Specifies the variable to which this parameter is bound. 
verbose
Number
Indicates that this inspectable property should be displayed in the 
Flex Builder user interface only when the user indicates that 
verbose
 
properties should be included. If this property is not specified, Flex 
Builder assumes that the property should be displayed. 
Property
Type
Description