0 Replies Latest reply on Apr 16, 2010 7:06 AM by Daniel Freeman

    Further questions about getStyleDeclaration() in FB4

    Daniel Freeman Level 1

      I previously asked about how to describe the following line SDK3.5 syntax in SDK4.0.  For example...

       

      something = StyleManager.getStyleDeclaration('.navigationBackground');  //SDK3.5

       

      becomes:-

       

      StyleManager.getStyleManager(moduleFactory).getStyleDeclaration('.navigationBackground');  //SDK4.0

       

      This solution works fine inside any subclass of UIInterface, which has the public property moduleFactory.

       

       

      But, now I've come across some classes where I can't get at an instance of moduleFactory, and I'm not sure how to rewrite this syntax for SDK4.0.

       

       

      1. For example, inside a static function.  Someone on my team has written something like this...

       

      public static function myStaticFn():void

      {

           ...

           something = StyleManager.getStyleDeclaration("ButtonScrollingCanvas");

           ...

       

      Inside a static class, I can't get hold of an instance of moduleFactory.  But then again, "ButtonScrollingCanvas" is global - so can I make an instance of moduleFactory... eg....

       

      var moduleFactory:IFlexModuleFactory = new ....erm, what? ... what's the class?

      something= StyleManager.getStyleManager(moduleFactory).getStyleDeclaration("ButtonScrollingCanvas");

       

      ... is this the syntax?  ... what's the class to make an instance of moduleFactory? .. will it work inside a static function?

       

       

      2. The second problem is getStyleDeclaration() inside a ProgrammaticSkin.  In SDK3.5, we could write...

       

      public class MySkin extends ProgrammaticSkin

      {

       

           public function MySkin() {

                ...

                something = StyleManager.getStyleDeclaration('.navigationBackground');

                ...

           }

       

      }

       

      ... here, there is no moduleFactory.  But We're trying to pick up something defined globally in a css file again - so can I create an instance of moduleFactory again?