views:

173

answers:

1

Hi there,

I would like to change the state of a flex button component with actionscript (on the fly) to present it as mouse-down/mouse-over/mouse-up, in order to use the css skining with out the existence of the mouse cursor. I tried to do this with button.currentState but this doesn't work.

thanks in advance

A: 

Try using styles to set the skins, not states.

If you want to display those states on the fly, you could dispatch the events form the buttons when you need to.

e.g.

//do roll over
yourButton.dispatchEvent(new MouseEvent(MouseEvent.ROLL_OVER));
//do roll out
yourButton.dispatchEvent(new MouseEvent(MouseEvent.ROLL_OUT));
//do press
yourButton.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_DOWN));
//do release
yourButton.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_UP));
George Profenza
thanks for the answer!I was actually using styles but I would like now to find a way to emulate button click from an other event. To do this I have to trigger is some way the style of the button to be, lets say downSkin style.And I can't figure out how to do this. thanks again
tsemer
try dispatching events from you button instance
George Profenza
thanks!!! this is exactly what I need!
tsemer