Setting global styles

By default, all components adhere to a global style declaration until another style declaration is attached to the component (as in Setting custom styles for groups of components). The global style declaration is assigned to all Flash components built with version 2 of the Macromedia Component Architecture. The _global object has a style property (_global.style) that is an instance of CSSStyleDeclaration, and acts as the global style declaration. If you change a style property's value on the global style declaration, the change is applied to all components in your Flash document.

CAUTION

 

Some styles are set on a component class's CSSStyleDeclaration instance (for example, the backgroundColor style of the TextArea and TextInput components). Because the class style declaration takes precedence over the global style declaration when style values are determined, setting backgroundColor on the global style declaration would have no effect on the TextArea and TextInput components. For more information about style precedence, see Using global, custom, and class styles in the same document. For more information about editing a component class's CSSStyleDeclaration, see Setting styles for a component class.

To change one or more properties in the global style declaration:

  1. Make sure the document contains at least one component instance.

    For more information, see Adding components to Flash documents.

  2. Select a frame in the Timeline on which (or before which) the components appear.
  3. In the Actions panel, use code like the following to change properties on the global style declaration. You need to list only the properties whose values you want to change, as shown here:
    _global.style.setStyle("color", 0xCC6699);
    _global.style.setStyle("themeColor", "haloBlue")
    _global.style.setStyle("fontSize",16);
    _global.style.setStyle("fontFamily" , "_serif");
    
  4. Select Control > Test Movie to see the changes.

Version 8

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00002995.html