【问题标题】:Manage class MovieClip管理类 MovieClip
【发布时间】: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


    【解决方案1】:
    this.parent.gotoAndPlay(2);
    

    表示您正在告诉闪光灯转到并从 mine 父级的第二帧开始播放。如果你想从第二帧开始播放地雷,那么你应该写如下内容

    this.gotoAndPlay(2);
    

    始终检查范围或您正在访问的内容,以确保事情正确完成

    【讨论】:

      猜你喜欢
      • 2013-09-16
      • 2017-10-17
      • 1970-01-01
      • 1970-01-01
      • 2011-09-14
      • 2010-12-12
      • 1970-01-01
      • 1970-01-01
      • 2015-03-12
      相关资源
      最近更新 更多