我生成了随机气泡,我使用了在网上找到的代码。现在我想要一个可以隐藏随机气泡的点击事件。
这正是我使用的代码,
http://good-tutorials-4u.blogspot.com/2009/04/flash-bubbles-with-actionscript-3.html
我的气泡运行良好...
我已经尝试过了,但到目前为止还没有成功..
addEventListener(MouseEvent.CLICK, eventListener);
function eventListener(eventObject:MouseEvent) {
bubbles[i].splice(i,1,bubbles[i]);
}
我尝试使用数组,但它返回给我这个输出 类型错误:错误#2007:参数子项必须为非空。 在 flash.display::DisplayObjectContainer/removeChild() 在函数/()
类型错误:错误#2007:参数子项必须为非空。 在 flash.display::DisplayObjectContainer/removeChild() 在函数/()
最佳答案
如果数组中有气泡,这应该可以工作。
var randomIndex:int = int(Math.random() * bubbles.length);
parent.removeChild(bubbles[randomIndex]);
bubbles.splice(randomIndex, 1);
请注意,您还必须从显示列表中删除气泡。
关于actionscript-3 - AS3 删除 ENTER_FRAME 中的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17366620/