0 Replies Latest reply on Apr 30, 2012 5:14 AM by astor.g

    Using pseudo selector programmatically

    astor.g

      Hi !

       

      Can somebody please explain how I can use the pseudo selector programmatically.

       

      I need to set/reset the color of text prompt, but seems I cannot create this style from scratch.

       

      The following code doesn't work:

       

       

       

      var color:uint = 0x777777;

       

      var cssTextInputStyleDeclaration:CSSStyleDeclaration = new CSSStyleDeclaration("spark.components.TextInput:normalWithPrompt");

      cssTextInputStyleDeclaration.setStyle("color",color);

      styleManager.setStyleDeclaration("spark.components.TextInput:normalWithPrompt",cssTextInputStyleDeclaration,true );

       

      The style  simply is not changed.

       

      And the following code does work, when I set previously the value in the style section (or css file):

       

       

       

       

       

       

       

       

      var color:uint = 0x777777;

      var cssTextInputStyleDeclaration:CSSStyleDeclaration = styleManager.getStyleDeclaration("spark.components.TextInput:normalWithPrompt");

       

      if (cssTextInputStyleDeclaration!=null)

           cssTextInputStyleDeclaration.setStyle("color",color);

       

      Thanks in advance.

       

      Regards,

       

      Gena