Jump to content
xisto Community
Sign in to follow this  
andrewsmithy

Actionscript Slow Motion Slow motion for Flash 5+

Recommended Posts

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.

 

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:

 

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.

Share this post


Link to post
Share on other sites

thats great, but why would somone want to few a flash movie in slow-mo. Could you tell men how to insert a1) mouseover2) links3) a loading bar, if not to hardthanks, nickmealey

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.