8 Replies Latest reply on Feb 4, 2011 3:40 PM by Darrell Loverin

    Description Resource Path Location Type .... Warning Msg ....

    aktell2007 Level 1

      Hi there,

       

      I'm using some code from way back and I'm trying to use it within a newer project.

      The original code is as follows:

       

           import mx.styles.CSSStyleDeclaration;
           import mx.styles.StyleManager;
      
      protected static function classConstruct ():Boolean {
          if (!StyleManager.getStyleDeclaration("Page")){
              var defaultStyles:CSSStyleDeclaration = new CSSStyleDeclaration();
              for (var i:String in DEFAULT_STYLES){
           defaultStyles.setStyle(i, DEFAULT_STYLES[i]);
      }
           StyleManager.setStyleDeclaration("Page", defaultStyles, true);
      }
           return true;
      }
      

       

      This gives me a couple of Warning !

       

      Description Resource Path Location Type
      3608: 'getStyleDeclaration' has been deprecated since 4.0.
      Please use 'IStyleManager2.getStyleDeclaration on a style manager instance'.
      Page.as line 146 Flex Problem
      
      

       

      I have been trying to change it, but I get Error Msg's now !

       

           import mx.styles.CSSStyleDeclaration;
           import mx.styles.IStyleManager2;
      
      protected static function classConstruct ():Boolean {
          if (!IStyleManager2.getStyleDeclaration("Page")){
              var defaultStyles:CSSStyleDeclaration = new CSSStyleDeclaration();
              for (var i:String in DEFAULT_STYLES){
           defaultStyles.setStyle(i, DEFAULT_STYLES[i]);
      }
           IStyleManager2.setStyleDeclaration("Page", defaultStyles, true);
      }
           return true;
      }
      
      

       

      Any help would be very much appriciated. regards aktell2007