2 Replies Latest reply on Dec 19, 2011 9:38 AM by johanwalem

    Setting a skinState of a button in AS3 (at runtime)

    johanwalem Level 1


      I want to set (manually) the skinState (for example 'disabled') of a button (that I skinned) in ActionScript.


      For example: I have a button skin with hostComponent: components.backend.btnMenuBakComp The button skin has the default button states (up, over, down, ...), but I want to set one of this skinStates in ActionScript.


      For example:

        subMenu.btnDashboard.currentState = "disabled";


      This doesn't work because the state "disabled" is not known in the component (it is only known in the skinState of btnDashboard).


      How can I fix this? Is there another solution then load a new skinClass with this state (subMenu.btnDashboard.setStyle("skinClass", Class(btnMenuBakSelectedSkin)); ?

      Because the last solution, when I call this ('subMenu.btnDashboard.setStyle("skinClass", Class(btnMenuBakSelectedSkin));'), the button disapear a little time, until the button with the new selected skin is loaded...