bookmark

Actionscript Slow Motion - Slow motion for Flash 5+

 
 Discussion by andrewsmithy with 4 Replies.
 Last Update: May 10, 2008, 3:27 am
 
bookmark  
 
Slow Motion Movies in Flash 5+

Hey, I just figured out how to create slow motion in ActionScript. Here's the scenario. You have a animation (frame by frame or tweened) that you want to let users be able to view in slow motion. The simplest way to do this would be to add some ActionScript. First, open your Flash movie that you want to create in slow-motion. Then select to Insert > New Symbol.... For the name type something like "slowMotion" (this doesn't really matter much), select the behavior "Movie Clip", and click "OK". Return to the scene without editing the Movie Clip. Now, drag an instance of the Movie Clip onto the stage, off to the side. Right-click on it, and select "Actions". This will bring up the ActionScript editor, in which you can edit your script. Make sure that you are in "Expert Mode". To set this, click the arrow in the upper-right corner of the Actionscript editing window and select "Expert Mode". This allows you to edit freely in the window. Copy this script and place it in the editor.

CODE


onClipEvent (load) {
isTrue = false;
speed = 7;
i = 1;
}
onClipEvent (enterFrame) {
if (isTrue == true) {
 if (i == speed) {
  _root.play();
  i=1;
 } else {
  _root.stop();
  i++;
 }
} else {
 _root.play();
}
}


Now that you have copied this script out, I want to explain a few parts of this. In the onClipEvent (load) we are defining some variables that we will use later. The onClipEvent (enterFrame) is a little bit more tricky. If the isTrue is set to true then the slow-motion "module" is activated, otherwise, the movie plays normally. The speed controls the delay of the playback in frames. If, for example, speed is set to "8", the slow-motion module will wait until eight frames' time has passed before it plays the movie for one frame. This creates the slow motion.

We're not done yet. To link this to the page, you will have to do two things. First, you will have to select the slow-motion Movie Clip, go to the instance tab. (If you don't see it, check your panel layout.) Then, in the "Name" textbox, type an identifier like "slowMotionModule". That names the instance of the Movie Clip, and we can now reference it. Secondly, create button, and drag it onto the stage. Right-click on it and select "Actions". In the ActionScript editor enter this:

CODE


on (release) {
if (_root.slowMotionModule.isTrue == true) {
 _root.slowMotionModule.isTrue = false;
} else {
 _root.slowMotionModule.isTrue = true;
}
}


Where "slowMotionModule" is the name of the identifier you choose for the movie clip earlier. This script simply sets the isTrue variable for the Movie Clip instance. That wraps up the slow-motion. Test your movie, and you should see that when you click the slow motion button that your movie "slows down".

One note that you should be aware of, is that this does not slow-down other movie clips on the stage. To slow them down, you would have to put the "slow-motion" movie clip in the other movie clip that you want to slow-down, and modify the button to point to the Movie Clip instead of _root, like this movie_clip_to_be_slowed_down.slowMotionModule.isTrue = true. I'm confident that you will be able to figure this one out.

If you have any questions or comments, please reply to this message. If you are helped by this article, please rate me.

Fri Mar 25 22:00:33 PST 2005 - Reply -   

thats great, but why would somone want to few a flash movie in slow-mo. Could you tell men how to insert a

1) mouseover
2) links
3) a loading bar, if not to hard


thanks, nickmealey

Fri Mar 25 22:06:47 PST 2005 - Reply -   

Navigation design
Actionscript Slow Motion

I'm new to flash (like most that write these questions) but do you know how to creatd a script that will allow your mouse to drag a design as it floats along the page. Here's a good example of a site that has done this...Is there a non complex way of doing this using flash?

Leica-camera.Com/experience.Php

-question by vekneal

Wed Apr 2 5:40:14 PDT 2008 - Reply -   

Mouseover
Actionscript Slow Motion

Replying to nickmealey
Mouseover:
On(rollOver)
{gotoAndStop(2)
}
On(rollOut)
{gotoAndStop(1)
}


-reply by 3lionz

Sat May 10 3:27:43 PDT 2008 - Reply -   

Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Slow Motion Movies in Flash 5+

Hey, I just figured out how to create slow motion in ActionScript. Here's the scenario. You have a animation (frame by frame or tweened) that you want to let users be able to view in slow motion. The simplest way to do this would be to add some ActionScript. First, open your Flash movie that you want to create in slow-motion. Then select to Insert > New Symbol.... For th ...more

Fri Mar 25 22:00:33 PST 2005 - Reply -   

   How To Make Rain Using Photoshop and ImageReady (2) (7) Adobe Photoshop   


  

 

Honesty ROCKS! truth rules.