2 Replies Latest reply on Dec 7, 2010 2:53 PM by Sible99

    How to apply mxml skin programmatically

    Sible99 Level 1

      I have defined two mxml skins for a button and I'd like to change skin during runtime, but I don't know how. This code doesn't work:

      var skin:Class = PlayButtonSkin; //it's a PlayButtonSkin.mxml file

      button.setStyle("upSkin", skin);

      Nothing happens. No error, no skin change. The PlayButtonSkin.mxml file is defined as follows (plus headers):

         <s:states>
              <s:State name="up" />
              <s:State name="over" />
              <s:State name="down" />
              <s:State name="disabled" />
          </s:states>
          <fxg1:soundStop/>

      where soundStop is a valid fxg file

      Please help.