0

I am new to Flash and cannot get an FLA animation to stop on the last frame. I have used the "stop()" command in Actionscript, but this command either (i) stops the animation and goes to a blank white frame (possibly the first frame of the animation) if I insert a Blank Keyframe, or (ii) loops anyway if I insert a regular Keyframe.

I am working with a rebuilt FLA file (i.e., decompiled SWF file) on the latest version of Flash. In addition to Actionscript, I have tried adjusting the Publish Settings (e.g., unchecking "Loop" and setting the Flash version to 7 or 8) and editing the embed parameters (as suggested in another answer on Stack), however neither of these efforts seems to make a difference.

Any help would be appreciated -- thanks!

user998186
  • 1
  • 1
  • 1
  • 1

3 Answers3

1

Please following code

<param name='loop' value='false' />
<object type='application/x-shockwave-flash' data='sourcefile' width='300' height='120' loop='false'>

This works perfectly

0

Are there any movieclips on the stage?

You should know that each movieclip has it's own timeline and thus to stop that particular movieclip from animating, stop(); should be placed within the appropriate keyframe in that movieclip's timeline..

user559142
  • 12,279
  • 49
  • 116
  • 179
  • Thanks for the reply. As I said above, I already placed the "stop();" command in the last keyframe, but while this prevents the animation from looping, it also leaves my animation displaying a blank white frame (presumably the first frame in my animation) instead of remaining on the last frame (an image). Any suggestions? – user998186 Oct 17 '11 at 05:08
  • If that's the case, there might be something else going on in the source code - an asynchronous callback that is running after the last frame that is restarting the MovieClip. Try adding code to the last frame and inserting a breakpoint, then running the content in the debugger (SHIFT + CTL + ENTER). Try adding a test shape to the first frame (just draw a rectangle) to be certain where the playhead is when the MovieClip ostensibly restarts. Also make sure there is no (even blank) content on the timeline in other layers. – Sensei James Oct 18 '11 at 07:02
  • ... that go past the "stop()" command. Decompilers can be tricky, especially if there are several source files. Look at any code on the timeline that might make calls to "addFrameScript" - this undocumented function allows you to (with code on the first frame) write a script that will run on the last frame. – Sensei James Oct 18 '11 at 07:12
0

There are a couple of ways to do it. The easiest way (like "user559142" suggested) is to just put a "stop()" command on the last frame of that MovieClip's timeline. Just add it to the last frame.

Unfortunately MovieClips don't dispatch a COMPLETE event when they have reached their last frame; a shortcoming of the platform, in my mind. A more heavyweight way to ensure that your MovieClip stops on the last frame is to listen for the ENTER_FRAME event, and to call stop() when the current frame is equal to the last frame, like so:

your_movie_clip.addEventListener(Event.ENTER_FRAME, function(e:Event):void 
{
   if (your_movie_clip.currentFrame == your_movie_clip.totalFrames)
   {
      your_movie_clip.stop(); 
   }
});

A note, however, is that if you uncheck "looping" you will only see the content not looping when the SWF is published (and viewed) in an HTML wrapper, and even then only if the content you're trying to stop from looping appears on the main timeline. If you're just previewing within the authoring environment, or your content has their own timelines where you're trying to prevent looping, you won't see that behavior.

Sensei James
  • 2,617
  • 30
  • 36