stopping on the last frame (flash)

前端 未结 4 1902
粉色の甜心
粉色の甜心 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条回答
  •  -上瘾入骨i
    2020-12-18 05:36

    If you want to do it with actionscript and not add a stop() to the last frame on the timeline manually, then you can use the undocumented addFrameScript() method.

    mc.addFrameScript(mc.totalFrames - 1, function():void 
    {
        mc.stop();
    });
    

    Can't remember the scope of the function, but you can either use mc.stop(), or just stop().

    *EDIT - Added -1 to the first parameter of addFrameScript, because it is zero based (so to put a frameScript on frame 10 you would put 9).

提交回复
热议问题