stopping on the last frame (flash)

前端 未结 4 1911
粉色の甜心
粉色の甜心 2020-12-18 04:57

I want my movieclip to play once and stop on the last frame. I use the following code in the loop of my movieclip class. (this is as3)

if(currentFrame == 120         


        
4条回答
  •  借酒劲吻你
    2020-12-18 05:48

    This seems more along the lines of what you're looking for:

    addEventListener(Event.ENTER_FRAME, function(e:Event){
        if(currentFrame == totalFrames){
          stop();
          removeEventListener(event.type, arguments.callee);
        }
    });
    

    I added an event listener (for Actionscript 3) so on every frame this function will fire and check what frame it is on. If it's the last frame it will stop. Based on your example I'm presuming you have a class that's extending MovieClip.

提交回复
热议问题