User Guide

Table Of Contents
66 Chapter 3: Creating Advanced Components in Flash MX 2004
Style
The Style metadata keyword describes a style property allowed for the component. The Style
metadata keyword has the following syntax:
[Style(name=style_name[,option=value,...])]
The following table describes the options for the Style metadata keyword:
The following example shows the
textSelectedColor property:
[Style(name="textSelectedColor",type="Number",format="Color",inherit="yes")]
Defining component parameters
When building a component, you can add parameters that define its appearance and behavior.
The most commonly used properties appear as authoring parameters in the Component
inspector. You define these properties by using the
Inspectable keyword (see “Inspectable
on page 63). You can also set all inspectable parameters with ActionScript. Setting a parameter
with ActionScript in your MXML application overrides any value set during component
authoring.
The following examples set several component parameters and expose them with the
Inspectable metadata keyword in the Component inspector:
// 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;
Option Type Description
name
String (Required) The name of the style.
type
String The type of data.
format
String Units of the property.
inherit
String Whether the property is inheriting. Valid values are yes and no.