2 Replies Latest reply on Jul 5, 2006 9:47 AM by Flex harUI

    Dynamic Stylesheet

    D3grade
      Hi,

      Does anyone know of a way to switch the global stylesheet dynamically? or of some alternative way to do it?

      Matt
        • 1. Re: Dynamic Stylesheet
          JFAM
          I think the external styles sheet are managed at compile-time. MXML compiler creates a CSSStyleDeclaration instance for each selector in the stylesheet, and registers it to the StyleManager. So i think you can't simply switch the stylesheet at runtime.
          The programmatic way is to use the StyleManager .getStyleDeclaration('.yourClassSelector') to retrieve CSSStyleDeclaration instances you want to modify at runtime.
          I hope this helps.
          • 2. Re: Dynamic Stylesheet
            Flex harUI Adobe Employee
            That is correct. Stylesheets are converted at compile-time into CSSStyleDeclarations. If you use class styleDeclarations (stylename="foo") you can preload all the styles you'll need at runtime and switch the stylename at runtime.

            We've seen some prototypes of runtime CSS loading using flash.text.styleSheet and URLLoader but you can 't change skins that way, only colors and font properties