Skip to main content
Participant
August 20, 2007
解決済み

Associate code to the end of a movieclip playtime

  • August 20, 2007
  • 返信数 1.
  • 356 ビュー
Here is my question:

I'm trying to have a few elements made visible once another movieclip instance has finished playing. I have tried reading my manuals but there doesn't seem to be an event handler that does this. There's onUnload, but I don't want to make the movieclip disappear, I just want for something to happen once it finishes playing.

Of course, I could add code to the end of the movieclip's timeline, but I believe it is preferable to write all the script in the main timeline? Anyway, is there a way to do this? There must be, it seems such a common issue.
このトピックへの返信は締め切られました。
解決に役立った回答 Juankpro
There is no onFinishedAnimation like event in ActionScript, but the usual way to do this is:

mc.onEnterFrame = function(){
if(this._currentframe == this._totalframes){
// Place your code here
delete this.onEnterFrame;
}
};

Where mc is the instance name of your animating movie clip.

返信数 1

Juankpro解決!
Inspiring
August 20, 2007
There is no onFinishedAnimation like event in ActionScript, but the usual way to do this is:

mc.onEnterFrame = function(){
if(this._currentframe == this._totalframes){
// Place your code here
delete this.onEnterFrame;
}
};

Where mc is the instance name of your animating movie clip.
Kiruno作成者
Participant
August 20, 2007
That makes a lot of sense. I was planning on using _currentframe and _totalframes as well, combined with setInterval, but your method seems better. Thanks.

Juan