Flash CS3 Documentation |
|||
| Using ActionScript 2.0 Components > Creating Components > Creating the ActionScript class file > Adding component metadata | |||
You can add component metadata tags in your external ActionScript class files to tell the compiler about component parameters, data binding properties, and events. Metadata tags are used in the Flash authoring environment for a variety of purposes.
The metadata tags can only be used in external ActionScript class files. You cannot use metadata tags in FLA files.
Metadata is associated with a class declaration or an individual data field. If the value of an attribute is a string, you must enclose that attribute in quotation marks.
Metadata statements are bound to the next line of the ActionScript file. When defining a component property, add the metadata tag on the line before the property declaration. The only exception is the Event metadata tag. When defining component events, add the metadata tag outside the class definition so that the event is bound to the entire class.
In the following example, the Inspectable tags define the flavorStr, colorStr, and shapeStr parameters:
[Inspectable(defaultValue="strawberry")] public var flavorStr:String; [Inspectable(defaultValue="blue")] public var colorStr:String; [Inspectable(defaultValue="circular")] public var shapeStr:String;
In the Property inspector and the Parameters tab of the Component inspector, Flash displays all of these parameters as type String.
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/00002496.html
Comments
mark_horsell said on Jun 14, 2007 at 3:09 AM : Ninja Squirrel416 said on Jul 25, 2007 at 8:37 AM :