热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

手动设置在as3中选中的复选框-manuallysetcheckboxselectedinas3

IhaveaCheckBoxinas3thatineedtosetascheckedwithcode.DoIdispatchanevent?Ifso,how

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.

我在as3中有一个CheckBox,我需要设置为使用代码检查。我发一个活动吗?如果是这样,我如何创建一个事件,并给它一个目标(目标是只读的)。或者还有另一种方法吗?谢谢。

1 个解决方案

#1


1  

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
    }
}

推荐阅读
author-avatar
Reaki是睿睿
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有