使用Flex4的PopUpManager的addPopUp() 方法弹出 removeChild异常的解决办法
Posted on 2013-07-16 17:50 辉逊 阅读(1173) 评论(0) 编辑 收藏 举报Flex4中,弹出窗口有两种:
Alert.show("balabalabala…");
PopUpManager.addPopUp([要弹出的控件],[父控件],[是否模态]);
第二种是我们最常使用的,却很容易出现问题(如题)。
出现的原因是因为使用了spark组件,因为spark组件没有removeChilde的方法,
所以就产生了异常。这是adobe的BUG,目前还没解决。
规避的办法就是将需要弹出的控件放置在mx组件内部即可。
附原始英文解释:
There is a problem in Flex 4 when you using the PopUpManager's addPopUp() method to
create a pop up that has a Spark container parent. This problem was reported in a JIRA bug:
SDK-25082. If you call addPopUp(), you will get the runtime error:
Error: removeChild() is not available in this class. Instead, use removeElement() or modify
the skin, if you have one.
at spark.components::Group/removeChild()
Unfortunately, we didn't have time to fix this bug in the Flex 4 time frame. So, the bug was
deferred. However, there is a pretty simple workaround for the bug. In your code, you just
need to parent the component that you want to pop up with an MX component.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步