2 Replies Latest reply on Mar 18, 2011 5:13 AM by Joao Fernandes

    runtime backgroundColor not propagated to Skin.

    Joao Fernandes

      Hi, I'm trying to define runtime styles using styleManager but having some issues with those properties being propagated to the corresponding spark skin.


      In this case I was defining a new backgroundColor using


      styleManager.getStyleDeclaration("spark.components.Application").setStyle("backgroundColor ", someColor);


      but in the default skin the udpateDisplayList reports the getStyle("backgroundColor") is still the old value but if I use a custom skin and use

      styleManager.getStyleDeclaration("spark.components.Application").getStyle('backgroundColor '); instead, it works perfectly.


      My question is, is there a reason why a style changed isn't propagated to corresponding skin?



        • 1. Re: runtime backgroundColor not propagated to Skin.
          kevinklin Adobe Employee

          Is updateDisplayList getting called after you call setStyle?

          • 2. Re: runtime backgroundColor not propagated to Skin.
            Joao Fernandes Level 1



            The problem is the fact I have an Inline backgroundColor style defined


            <?xml version="1.0" encoding="utf-8"?>

            <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"








            protected function button1_clickHandler(event:MouseEvent):void


            styleManager.getStyleDeclaration("spark.components.Application").setStyle("backgroundColor ", 0xCCCCCC);







            <!-- Place non-visual elements (e.g., services, value objects) here -->



            <s:Button click="button1_clickHandler(event)" />


            If I remove the backgroundColor="#FFFFFF" I can switch the color without a problem at runtime but if the "default" value is set, the getStyle("backgroundColor") in the default spark Skin will always evaluate to the inline definition instead which makes total sense because how CSS processes style declarations.