开发者

Click Flex 4 spark ToggleButton component in code

开发者 https://www.devze.com 2023-01-13 15:49 出处:网络
I can\'t found any property in sparks\'s ToggleButton that allow me to press it from code. I testedsetCurrentState(\"down\") method, but this way button not开发者_运维技巧 dispatching click event i th

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消