Flash CS3 Documentation |
|||
| Using ActionScript 2.0 Components > Creating Components > Creating the ActionScript class file > Defining component parameters | |||
When building a component, you can add parameters that define its appearance and behavior. The most commonly used parameters appear as authoring parameters in the Component inspector and Property inspector. You can also set all inspectable and collection parameters with ActionScript. You define these properties in the component class file by using the Inspectable tag (see About the Inspectable tag).
The following example sets several component parameters in the JellyBean class file, and exposes them with the Inspectable tag in the Component inspector:
class JellyBean{
// a string parameter
[Inspectable(defaultValue="strawberry")]
public var flavorStr:String;
// a string list parameter
[Inspectable(enumeration="sour,sweet,juicy,rotten",defaultValue="sweet")]
public var flavorType:String;
// an array parameter
[Inspectable(name="Flavors", defaultValue="strawberry,grape,orange", verbose=1, category="Fruits")]
var flavorList:Array;
// an object parameter
[Inspectable(defaultValue="belly:flop,jelly:drop")]
public var jellyObject:Object;
// a color parameter
[Inspectable(defaultValue="#ffffff")]
public var jellyColor:Color;
// a setter
[Inspectable(defaultValue="default text")]
function set text(t:String) {
}
}
You can use any of the following types for parameters:
|
NOTE |
|
The JellyBean class is a theoretical example. To see an actual example, look at the Button.as class file that installs with Flash in the language/First Run/Classes/mx/controls directory. |
Flash CS3
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00002506.html
Comments
petkusj said on Jan 14, 2008 at 9:50 AM : petkusj said on Jan 17, 2008 at 12:43 PM :