1 Reply Latest reply on Feb 9, 2010 7:06 AM by Max Derkachev

    StyleManager: getStyleDeclaration after loadStyleDeclarations (Flex 3.5)

    Max Derkachev

      An AIR app has default theme compiled in & themes that may be loaded from the external swfs (css-based), that override the default.

      Called StyleManager.loadStyleDeclarations with update=true, and then called getStyleDeclaration in the StyleEvent.COMPLETE handler for the dispatcher returned by the loadStyleDeclarations. Expected it to return a declaration from the new loaded theme, got one from the default theme instead.

      The question is at what point it is safe to call getStyleDeclaration after loadStyleDeclarations to get the declarations from the loaded theme? Are there any other events to listen for that (haven't found this in documentation yet)?

        • 1. Re: StyleManager: getStyleDeclaration after loadStyleDeclarations (Flex 3.5)
          Max Derkachev Level 1

          Solved. The problem was not with getStyleDeclaration itself, it returned the  right CSSStyleDeclaration instance, but with the fact that styles loaded  in css-based swf don't have a factory function used to get all syles  for a selector, just protected overrides object that may be queried  using getStyle.  I used CSSStyleDeclaration.factory to construct StyleSheet objects at  runtime. It works fine on compiled-in styles. With loaded styles, I'll  ought to use getStyle on CSSStyleDeclaration objects to get the  overriden styles by name.