views:

19

answers:

1

I can't found any property in sparks's ToggleButton that allow me to press it from code. I tested setCurrentState("down") method, but this way button not dispatching click event i think.

+1  A: 

You'll have to manually create a click event and dispatch it to simulate a "click in code". Conceptually something like this:

var clickEvent : MouseEvent = new MouseEvent(MouseEvent.CLICK)
this.myButton.dispatchEvent(clickEvent);

If this doesn't switch the toggle state, you may have to do so manually, and your original answer has that code.

www.Flextras.com
Looks like suitable solution, thank you.
Vadim Smakhtin