MANDAR

Flash: Dynamically Change Frame Rate

Posted in Flash Designer by Mandar on May 28, 2009

New to ActionScript 3.0 is the ability to dynamically change the frame rate at which your file plays at runtime. The default frame rate of a Flash movie is 12 frames per second, and we can change dynamically increase or decrease frame rate run time. following example shows how to change frame rate runtime.

Create two buttons on stage and give name “faseter” and “slower”.

faster.addEventListener(MouseEvent.CLICK, onFasterClick, false, 0, true);
slower.addEventListener(MouseEvent.CLICK, onSlowerClick, false, 0, true);

function onFasterClick(evt:MouseEvent):void {
stage.frameRate += 5;
trace(stage.frameRate);
}
function onSlowerClick(evt:MouseEvent):void {
if (stage.frameRate > 5) {
stage.frameRate -= 5;
}
trace(stage.frameRate);
}


Leave a Reply

You must be logged in to post a comment.