PDA

View Full Version : Programatically setting the state for a custom skin


jfrumar
04-07-2008, 12:11 AM
Here's the situation:

- I have created a skin in Flash CS3 Professional which is exported as class mx.flash.UIMovieClip using the Flex Component Kit. As a result, it has 4 frames with labels (i.e. up,down,over,disabled).
- I am exporting to an SWC, and compiling that into my flex SWF.
- I set the skin in the <Style> section as the single "skin: ..." statement. Flex handles the events using those named frames in the Flash Component.

Now here's what I'm trying to achieve:

- When I hover over the button, the skin switches to the "up" frame from the Flash component. This is what I want to be able to trigger programatically.
- So I think I need to get a handle on that skin class, so I can set skinClass.currentState = 'over' or something to that effect.

Could anyone please shed some light on this situation?

drkstr
04-07-2008, 01:15 AM
I'm not 100% sure I understood what you were asking, but if you are just trying to apply skin states, it's usually done by setting the individual styles like this:

upSkin: Embed(source="../assets/blueskin/blueskin.swf", symbol="pageButtonUp");
downSkin: Embed(source="../assets/blueskin/blueskin.swf", symbol="pageButtonDown");
overSkin: Embed(source="../assets/blueskin/blueskin.swf", symbol="pageButtonHover");
disabledSkin: Embed(source="../assets/blueskin/blueskin.swf", symbol="pageButtonDisabled");

There are many different ways to actually apply styles, but essentially you want to tell the mxml which symbol it should use for which state.

Hope this helps,
~Aaron