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.
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...
This will never work reliably. Skins get their state from the getCurrentSkinState():String method, so anything you set will be overridden as soon as the skin state is invalidated.
What you can do is extend Button and override the getCurrentSkinState to add in your own hooks for what the current skin state should be.
Thanks, I'll try!
I use now the "disabled" state of a button, but it's not the best solution.