This is a *very* cool new feature in ActionScript 3. We now have the ability to dynamically change the SWF frame rate at runtime using ActionScript. In the example below I have a somewhat creepy clown who is animating from side-to-side on the screen. You can use the slider to change the frame rate from 0 to 800 and something. There are a lot of applications for this such as lowering the frame rate for slower machines dynamically. The AS 3 code from the example is posted below:
-
this.stage.frameRate = 0;
-
rate.text = “0 fps”;
-
-
thumb.addEventListener(MouseEvent.MOUSE_DOWN, starter);
-
thumb.addEventListener(MouseEvent.MOUSE_UP, stopper);
-
thumb.addEventListener(MouseEvent.MOUSE_OUT, stopper);
-
thumb.addEventListener(MouseEvent.MOUSE_MOVE, mover);
-
function starter(args:Event)
-
{
-
thumb.startDrag(false, new Rectangle(track.x, thumb.y, track.width, 0));
-
}
-
function stopper(args:Event)
-
{
-
thumb.stopDrag();
-
}
-
function mover(args:Event)
-
{
-
var dist:Number = (thumb.x – track.x) / (track.width + track.x);
-
this.stage.frameRate = Math.round(dist*1000);
-
rate.text = Math.round(dist*1000).toString() + ” fps”;
-
}
Click on the image below to launch the example. Flash Player 9 required:
Lee









Very cool. Is there any way to change the fps without it effecting the speed but rather the smoothness of the animation? Example… If I’m using the Fuse Kit to animate the item from point A to point B within 2 seconds, Fuse will always take the same amount of time no matter what the fps is set to. It would just make the motion smoother.
Hey Lee, I really need you to tell me the name of the song you posted a long time ago in the part where you made the little linkin park balls move with the audio data from after effects.
Thanks in advance
-Otto
Hi Lee!
Inspired by your ActionScript QuickTip I made an example (kind of simple slow-motion or fast-forward) using the Dynamic Frame Rate for an embedded video:
http://www.video-flash.de/wp-content/uploads/2006/12/slowmotion-fastforward-demo.html
I haven’t done too much flash in a while (certainly no AS3 specific things) and this is a really sweet ass feature! Good to know. This alone might motivate me to put the ColdFusion on the slow track and bone up on AS3. Thanks!
sweetness…..its like a dream come true.
This is really cool, but it gets kind of disorienting moving back and forth without any motion blur going on. How would we add that in AS3? Does it work similarly to AS2 and bitmapdata objects with filters applied?
Yes all of that functionality is in AS3. This example wasn’t meant to be visually smooth or anything. Just an example of how to change the FPS.
It’s a nice new feature. What would be even more nice is to control to framerate on a per-movieclip base. But I guess the Timer will do that too while we don’t have that.
my pc keeps telling me to install flash players but they dont work right also when trying to watch a video on my pc i have pictures but no sound
For the record, Fuse isn’t going to support Actionscript 3. Adobe brought in Robert Penner to work with them on creating a more intuitive tweening method for DisplayObjects than the old mx classes did. So I would expect to see some really cool things to come out of the final release of Flash 9!
Very cool indeed! This will be great for dealing with slower machines.
gr8 idea.. thanx mate
why is fuse better than zeh’s tweener?
damn! this as3 thing seems pretty cool… I know that I must get into it sooner or later. Does someone know what percent of the users have the proper flash player?
i made a little something something to show that
updateAfterEvent() renders ~10x fps at max
and your fps will always cap at ~60 fps in browsers
- read more inside
http://www.thonbo.com/updateAfterEvent/updateAfterEvent.html
Is there any way this could be use with audio? Would it be possible to slow down a swf with an embedded audio file without altering the pitch?
can some one post the like of fla file for frame rate?
thanks
This is exactly the functionality I need.
Is there a possibility to do this with a video WITH audio?