User Guide
Table Of Contents
- Contents
- Working with Flash MX 2004
- Creating Basic Components in Flash MX 2004
- Creating Advanced Components in Flash MX 2004
- Contents
- About Creating components
- Writing the component’s ActionScript code
- Simple example of a class file
- General process for writing a class file
- Selecting a parent class
- Identifying the class, symbol, and owner names
- About the component instantiation life cycle
- Writing the constructor
- Specifying clip parameters
- Implementing the constructObject2() method
- Implementing the init() method
- Implementing the createChildren() method
- Implementing the commitProperties() method
- Implementing the measure() method
- Implementing the layoutChildren() method
- Implementing the draw() method
- Defining getters and setters
- Component metadata
- Defining component parameters
- Handling events
- Using the Event metadata
- About invalidation
- Skinning custom controls
- Adding styles
- Making components accessible
- Improving component usability
- Best practices when designing a component
- Using the ModalText example
- Troubleshooting
- Index

Writing the component’s ActionScript code 65
The InspectableList metadata keyword has the following syntax:
[InspectableList("attribute1"[,...])]
The InspectableList keyword must immediately precede the class definition because it applies
to the entire class and not individual members of the class.
The following example allows the
flavorStr and colorStr properties to be displayed in the
Property inspector, but excludes other inspectable properties (such as
flavorAge) from the
DotParent class:
[InspectableList("flavorStr","colorStr")]
class BlackDot extends DotParent {
[Inspectable(defaultValue="strawberry")]
public var flavorStr:String;
[Inspectable(defaultValue="blue")]
public var colorStr:String;
[Inspectable(defaultValue="10")]
public var flavorAge:String;
...
}
NonCommittingChangeEvent
The NonCommittingChangeEvent metadata keyword identifies an event as an interim trigger.
You use this keyword for properties that might change often, but for which you do not want
validation to occur on every change.
An example of this is if you tied a validator function 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 keyword lets you trigger validation when the user is done editing
the text field.
The
NonCommittingChangeEvent metadata keyword has the following syntax:
[NonCommittingChangeEvent("event_name")]
In the following example, the component is aware that the property has changed if the change is
triggered; however, that change is not final. There is another
ChangeEvent keyword that probably
triggers when the change is final.
[Event("change")]
...
[ChangeEvent("valueCommitted")]
[NonCommittingChangeEvent("change")]
function get text():String {
return getText();
}
function set text(t):Void {
setText(t);
}