0

这是我的代码帮我取悦它真的很令人沮丧!我的库中有一个影片剪辑,并将它与 AS3 一起添加到舞台上。那部分很容易。但现在我想控制那个movieclip。如果 introScene "introClass" 到达第 120 帧,那么我想删除该影片剪辑并将其替换为另一个。问题是 if 语句不起作用。我也尝试过 getChildByName 但这也不起作用。

var introClass = new introScene;
addChild(introClass);
introClass.x = 640;
introClass.y = 387;

/ * ** * ***介绍场景* ** * *** /

introClass.addEventListener(Event, introLoaded);

function introLoaded(event):void{

    if(introClass == 120 ){
        trace("Frame Reached")
    }
}

我试过这个,这也不起作用:(

introClass.addEventListener(Event, introLoaded);

function introLoaded (e:Event):void{

    if(MovieClip(introClass).currentFrame == 120){
        trace("120 complete")
    }
}
4

1 回答 1

0

这是错误的说法:

introClass.addEventListener(Event, introLoaded);

You need to pass a string to addEventListener. Event type name is converted to a string at runtime which adds a event listener to "flash.events.Event" or something. And your object obviously doesn't have this event. You need to use Event.ENTER_FRAME for example.

于 2012-10-23T11:07:53.820 回答