00:00
00:00
Newgrounds Background Image Theme

The-entirecircus just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Need Help Frame rate Flash

1,212 Views | 2 Replies
New Topic Respond to this Topic

Need Help Frame rate Flash 2005-10-23 18:57:33


Very sorry for starting a new thread but I didnt know if anyone was checking my other one, but this one is a different request anyway.

I have tried and tried to make a movie where you can press space bar and the frame rate changes, I can't do it.

Many people say you can, many people have sent code. I still can't get it to work :(

Could someone make a simple flash EG: Circle moving up and down, and then make the ability to change the frame rate with spacebar?

and then e-mail to me at batmanblob@yahoo.com

PS: I need the whole movie to change not just a movie clip. Plz help, I really want to start this game but wont if i can't do this!

Response to Need Help Frame rate Flash 2005-10-23 21:09:24


well i know what the code looks like, but i could not retype it right now.

i know that code uses setInterval AS method. click the As: Main link in my sign then look for As: Intervals.


website :: hugostonge.com

my job :: we+are

Response to Need Help Frame rate Flash 2005-10-30 17:40:35


Press CTRL+J, and set your FLA's framerate to 30 FPS (or higher). If it's set to 12, the animation will look as jerky as hell when you run the 30 FPS code.

Post this on the first frame, main timeline:


//Function to set the FPS speed
function setfps(fspd){
clearInterval(ping);
ping = setInterval(function (){
if(_root._currentframe == _root._totalframes){
_root.gotoAndStop(1);
}else{
_root.nextFrame();
}
}, (1000/fspd));
}

//Only run once, on first run, not when the movie loops
if(!ini){
ini=1;
framerate=12; //Set the FPS to 12 to begin with
_root.setfps(framerate);
}

//Monitor for keyPresses
kl = new Object();
kl.onKeyDown = function () {
if (Key.getCode() == 32){
if(!gumboot){
if(framerate==12){
framerate=30;
}else{
framerate=12;
}
_root.setfps(framerate); //Run the FPS function
gumboot=1;
}
}
kl.onKeyUp = function () {
if (Key.getCode() == 32){
gumboot=0;
}
}
Key.addListener(kl);

If you want to put your code on buttons, use

on(press){_root.setfps(12);} and on(press){_root.setfps(30);}

WORKING EXAMPLE - click the movie and use either SPACEBAR or the buttons to set the FPS


- - Flash - Music - Images - -

BBS Signature