Wednesday, November 07, 2007

Framerate in AS3

When a MovieClip is playing, it progresses along its timeline at a speed dictated by the frame rate of the SWF file. Alternatively, you can override this setting by setting the Stage.frameRate

property in ActionScript.
frameRate property
frameRate:Number [read-only]
Language version: ActionScript 3.0
Player version: Flash Player 9

The nominal frame rate, in frames per second, of the loaded SWF file. This number is often an integer, but need not be.

This value may differ from the actual frame rate in use. Flash Player only uses a single frame rate for all loaded SWF files at any one time, and this frame rate is determined by the nominal frame rate of the main SWF file. Also, Flash Player might not be able to achieve the main frame rate, depending on hardware, sound synchronization, and other factors.

The parent movie will load any Flash SWF into it regardless of FPS, but will run the loaded movie at the FPS of the parent movie.

Example: Your main movie is 12 FPS. You load a SWF into it that is 24 FPS. The main movie will run the loaded movie at 12 FPS anyways.

If the loaded SWF FPS can't be changed, consider upping the FPS of the parent movie. This way performance will be equal.

I would also highly recommend that you build all movies at 20 FPS or higher. The default is simply too slow. The three best FPS rates to be using are 21, 31, and 59. These three FPS are the only rates that perform equally on both a MAC based Flash plug-in and a PC-based one. Most other framerates when run on a MAC will run anywhere between 2-5 FPS slower than it would if run on a PC.


You can break free from the parent movie if you install streaming sound. Then the loaded movie will run at whatever fps setting you want.

To do this without incrementing file size too much compress the hell out of a sound. Bring it in to Flash set it to Mp3 and stream and worst quality. Double click on the frame where the sound is located and then select sound tab.

You will see a graph. Lower the volume all the way down so you can not hear it.

Now your sound will stream, and keep frame rate as specified in your movie settings regardless of Parent movie.

Of course if you have a sound track, your problem is solved just set it to stream but dont loop streaming sound it doesnt save you file size live event sound

0 Comments:

Post a Comment

<< Home