tags:

views:

302

answers:

1

I have a CSS file containing the following definition :

.Tab{
    up-skin:Embed(skinClass='XUpSkin');
    over-skin:Embed(skinClass='XOverSkin');
    disabled-skin:Embed(skinClass='XDisabledSkin');
}

And a Flex file :

<mx:Button id="b1" style="Tab"/>

Now, I want to use the disabled-skin defined in the CSS, as the upSkin of b1.
So something like

b1.setStyle("upSkin","Tab.disabled-skin");

But I am struggling with the exact syntax of the second argument for setStyle.
What should I use for the second argument for setStyle method?

A: 

b1.setStyle("upSkin", b1.getStyle("disabled-skin") );

Gregor Kiddie
Shouldn't that 2nd arg be `b1.getStyle("disabled-skin")`?
Robusto
doh... yes it should! Edited to reflect that. Good catch!
Gregor Kiddie
So if I say b1.setStyle("upSkin", b1.getStyle("disabled-skin") );,then upSkin and disabledSkin for b1 become same. So, at a later point of time I want to access the original upSkin, how do I?
dta
keep hold of it until you need it again. If you are wanting to play with the skins a lot, create a class that extends Button, override createChildren and store the three skins in internal variables. Then you can do things like.b1.setStyle( "upSkin", b1.myDisabledSkin );b1.setStyle( "upSkin", b1.myUpSkin );
Gregor Kiddie