User Guide
92 Customizing Components
Using global, custom, and class styles in the
same document
If you define a style in only one place in a document, Flash uses that definition when it needs
to know a property’s value. However, one Flash document can have a variety of style
settings—style properties set directly on component instances, custom style declarations,
default class style declarations, inheriting styles, and a global style declaration. In such a
situation, Flash determines the value of a property by looking for its definition in all these
places in a specific order.
Flash looks for styles in the following order until a value is found:
1. Flash looks for a style property on the component instance.
2. Flash looks at the styleName property of the instance to see if a custom style declaration is
assigned to it.
3. Flash looks for the property on a default class style declaration.
4. If the style is one of the inheriting styles, Flash looks through the parent hierarchy for an
inherited value.
5. Flash looks for the style in the global style declaration.
6. If the property is still not defined, the property has the value undefined.
About color style properties
Color style properties behave differently than noncolor properties. All color properties have a
name that ends in “Color”—for example,
backgroundColor, disabledColor, and color.
When color style properties are changed, the color is immediately changed on the instance
and in all of the appropriate child instances. All other style property changes simply mark the
object as needing to be redrawn, and changes don’t occur until the next frame.
The value of a color style property can be a number, a string, or an object. If it is a number, it
represents the RGB value of the color as a hexadecimal number (0xRRGGBB). If the value is
a string, it must be a color name.