开发者

manually set check box selected in as3

I have a CheckBox in as3 that i need to set as checked with code. Do 开发者_开发技巧I dispatch an event? If so, how do I create an event, and give it a target (target is read only). Or is there another way to do it? thanks.


my_checkbox.selected = true;

And of course:

my_checkbox.selected = false;

To handle the box being checked/unchecked:

my_checkbox.addEventListener(MouseEvent.CLICK, _selected);
function _selected(e:MouseEvent):void
{
    var bool:Boolean = e.target.selected;

    if(bool)
    {
        trace("was checked");
        // more code
    }
    else
    {
        trace("was unchecked");
        // more code
    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜