【发布时间】:2012-08-30 21:28:09
【问题描述】:
如何更改与类关联并已导入数组的子影片剪辑的动画?
现在我可以让它在玩家击中它时消失,用这条线:
this.parent.removeChild(this);
看看,有2个地雷是用external as导入的。文件并在 MineList 数组中。
http://teroute.com/stronghold/index.php?page=secret-project
我想让那些地雷在被触碰时爆炸。
这里,更多代码:
for (var i:int = 0; i < MineList.length; i++) // Here i count all mines, that are in MineList Array
{
if(player.hitTestObject(MineList[i])) // If player touches any mine
{
MineList[i].removeSelf(); // If player touches a mine,
// then this mine will dissapear
}
}
这里是 as 中的 removeSelf 函数。外部文件:
public function removeSelf():void
{
trace("Removed");
removeEventListener(Event.ENTER_FRAME, loop) // Sustabdyti loop
this.parent.removeChild(this); // panaikinimas
}
我觉得这行应该改一下:
this.parent.removeChild(this);
类似于:
this.parent.gotoAndPlay(2);
但我做错了,请帮忙。
【问题讨论】:
标签: arrays class actionscript movieclip