Setting global styles

The _global style declaration is assigned to all Flash components built with version 2 of the Macromedia Component Architecture (v2 components). The _global object has a property called style (_global.style) that is an instance of CSSStyleDeclaration. This style property acts as the _global style declaration. If you change a property's value on the _global style declaration, the change is applied to all components in your Flash document.

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

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. Create a new layer in the Timeline and give it a name.
  3. Select a frame in the new layer on which (or before) the component appears.
  4. Open the Actions panel.
  5. Use the following syntax to change any properties on the _global style declaration. You only need to list the properties whose values you want to change, as in the following:
    _global.style.setStyle("color", 0xCC6699);
    _global.style.setStyle("themeColor", "haloBlue")
    _global.style.setStyle("fontSize",16);
    _global.style.setStyle("fontFamily" , "_serif");
    

    For a list of styles, see Supported styles.

  6. Select Control > Test Movie to see the changes.