Hi João,
Thanks for your reply.
The thing is that I don´t know where should I indicate the 24 FPS. If you see my code, the only part where "24" is written is on the name of the button:
import flash.events.MouseEvent;
function changeFPS(e:MouseEvent):void
{
var fps:uint = uint(e.currentTarget.name.replace("fps", ""));
stage.frameRate = fps;
}
fps24.addEventListener(MouseEvent.CLICK, changeFPS);
I don´t know on which specific part of the code I have to indicate the change to 24 FPS. That´s why nothing seems to happen when I click on the button.
Best,
Paul
Hi, Paul.
The code gets de fps value from the button name itself.
It gets the string "24fps", removes the "fps" part and turn the remaining part into a unsigned integer. But this is only a suggestion.
If you prefer, you can create a function for each framerate value. Like this:
import flash.events.MouseEvent;
function changeTo12FPS(e:MouseEvent):void
{
stage.frameRate = 12;
}
function changeTo24FPS(e:MouseEvent):void
{
stage.frameRate = 24;
}
function changeTo30FPS(e:MouseEvent):void
{
stage.frameRate = 30;
}
function changeTo60FPS(e:MouseEvent):void
{
stage.frameRate = 60;
}
fps12.addEventListener(MouseEvent.CLICK, changeTo12FPS);
fps24.addEventListener(MouseEvent.CLICK, changeTo24FPS);
fps30.addEventListener(MouseEvent.CLICK, changeTo30FPS);
fps60.addEventListener(MouseEvent.CLICK, changeTo60FPS);
You can download a sample from my GitHub repo:
adobe/animate cc/as3/change_fps at master · joao-cesar/adobe · GitHub
Regards,
JC