NAVIGATION:

 

SUPPORTERS:

FlashComponents
  Flash Templates
  Flash Gallery
  Flash Slideshow
  Flash Menu
  Flash Design
  Flash Video
  User Interface

 

FOLLOW:

RSS it down! Twitter it up! Facebook it like a fiend!

 

 

Frame Rates - Page 2
       by kirupa  |  3 November 2009

In the previous page, you learned about frame rates and how they work to make your animations look smooth or...not smooth. There is a hands-on side to all of this, and in this page, you will learn how this all works in Flash and also how to change the frame rate in Flash.

Flash and Frames and Rates
Flash, like many digital animation programs, abstracts away a lot of the details related to frames and frame rates. In fact, all you really ever have to worry about is your frame rate and how long your animation will be running for. Generating intermediate frames are taken care of by the tweening engine. The only times you have to worry about the intermediate frames is if you are actually drawing each frame by hand.

Let's look at how what you learned in the previous page applies in practice. For a 1 second animation, your timeline will look as follows:

The key things to notice are the values at the bottom right. The duration of the animation is 1 second, the frames per second is 24, and the playhead is currently on Frame 24. If I change the frame rate to 12, as you can guess, it now takes twice as long for the animation to finish:

The duration of my animation jumped from 1 second to 1.9 seconds. Despite all of this changing, notice that I never had to define additional frames. This should seem very casual because the equation for determining the frame rate is number of frames divided by the duration. You can mathematically manipulate these variables to solve for the missing value.

A 24 frame animation with a frame rate of 12 frames per second will take around 2 seconds to finish.

Using the UI to Change the Frame Rate
The most common way to change your frame rate is to use the Properties panel and change it globally for your entire application:

The default rate is 24 in more recent versions of Flash, and like I mentioned in the previous page, that is a good value to keep your frame rate at.

Programmatically Changing the Frame Rate
When you are working with more interactive types of animations, you may want to change your frame rate while your application is running. Fortunately, in ActionScript 3, you have easy access to the frame rate property.

The way you access the frame rate is through:

stage.frameRate

Because stage is global, you can call the frameRate property from pretty much anywhere in your application. You can easily set the frame rate value as well since this is a property that you can both read and write:

stage.frameRate = 25;

That's all there is to programmatically being able to set the frame rate. I never said it was complicated.

Conclusion
Well, this wraps up or overview of frames, rates, and everything in between in the world of Flash. The one thing I did not go into great detail is how my example on the first page was created, so I have provided the source for this below:

Download Source

I hope the information helped. If you have any questions or comments, please don't hesitate to post them on the kirupa.com Forums. Just post your question and I, or our friendly forum helpers, will help answer it.

The following is a list of related tutorial and help resources that you may find useful:

How to use the Forums
New, Upcoming, and In-Progress Tutorials
How to Help out kirupa.com
Writing Tutorials
 

Cheers!

Kirupa Chinnathambi
facebook | twitter


1 | 2

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components Flash effects. Art without coding.
Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Citrus Engine: Flash platformer and sidescrolling game engine
Learn how to advertise on kirupa.com

cdn
content delivery network (cdn)