User Guide

82 Customizing Components
Using styles to customize component
color and text
Flash provides style properties that you can edit for every UI component. Within the
documentation for each specific component, you’ll see a table that lists the modifiable styles
for that component (for example, you can see a table of styles for the Accordion component in
“Using styles with the Accordion component” in the Components Language Reference).
Additionally, UI components inherit the
setStyle() and getStyle() methods from the
UIObject class (see
UIObject.setStyle() and UIObject.getStyle()). For a component
instance, you can use the
setStyle() and getStyle() methods to set and get style property
values, as shown later in “Setting styles on a component instance” on page 84.
Using style declarations and themes
In a broader scope, styles are organized within style declarations where you can control style
property values across multiple component instances. A style declaration is an object created
by the CSSStyleDeclaration class, and its properties are the style settings you can assign to
components. Style declarations in ActionScript are modeled after the way “cascading style
sheets” (CSS) affect HTML pages. For HTML pages, you can create a style sheet file that
defines style properties for the content in a group of HTML pages. With components, you
can create a style declaration object and add style properties to that style declaration object to
control the appearance of components in a Flash document.
Furthermore, style declarations are organized within themes. Flash provides two visual themes
for components: Halo (HaloTheme.fla) and Sample (SampleTheme.fla). A theme is a set of
styles and graphics that controls the appearance of components in a document. Each theme
provides styles to the components. The styles used by each component depend in part on
what theme the document uses. Some styles, such as
defaultIcon, are used by the associated
components regardless of the theme applied to the document. Other styles, such as
themeColor and symbolBackgroundColor, are used only by components if the
corresponding theme is in use. For example,
themeColor is used only if the Halo theme is in
use, and
symbolBackgroundColor is used only if the Sample theme is in use. To determine
what style properties you can set for a component, you must know which theme is assigned to
that component. The style tables for each component in Components Language Reference
indicate whether each style property applies to one or both of the supplied themes. (For more
information, see About themes” on page 108.)
NOTE
You cannot set styles for the media components.