我想创建一个对话框或警告框,其中一个DisplayObject会占用并强制聚焦,直到一个好的按钮或某个东西释放锁。感谢。
答案 0 :(得分:4)
这样做的简单方法是让你的“对话框”与舞台一样大,在对话框周围有一个非常透明的区域。
透明区域可以监听任何鼠标点击,只是吞下它们(这将阻止它们被显示列表中的其他东西拾取)。
要显示警报,只需将其粘贴在其他所有内容上,当用户关闭它时,再将其取出。
答案 1 :(得分:1)
为此,您需要禁用对“alert”DisplayObject下所有对象的访问权限。有多种方法可以做到这一点,这里我可以想一想:
这种“模态”行为已经存在,因此根据您当前的设置,可能不需要重新发明轮子。
如果您正在使用Flex框架,那么您已经拥有了Flash功能,您可以使用Alert Manager from the Yahoo! Flash Astra Components:
alert manager thumb http://developer.yahoo.com/flash/astra-flash/alertmanager/images/emailForm.gif
古德勒克,
答案 2 :(得分:1)
如果您使用的是flex和actionscript,只需使用SkinnablePopUpContainer
即可var alt:CustomPopUp = new CustomPopUp();
alt.open(this,true) //the second variable is for modal, which will disable view
this.enabled = false; //this will grey out the parent view and provide visual focus to your popup.