00:00
00:00

AS3: Changing Framerate

7,986 Views | 27 Replies
New Topic Respond to this Topic

AS3: Changing Framerate 2007-05-04 18:44:48


AS3: Main

Okay, so I made this before, but I screwed up, so here is the revised version:
___________
Lets say that you are making a few games, and you want to pack them all into one game. BUT WAIT! They all run on different framerates! This is whee this code comes in:

stage.frameRate = 12;

Now, in the code, you can change the 12 to whatever frame rate you want it to be, from 0.01 to 1000. Of course, no human eye can see a difference in anything than 70 fps or higher.

I will be making other tutorials as well as I get more into it.

Enjoy!

Response to AS3: Changing Framerate 2007-05-04 18:51:47


couldn't you alter the apperence of framerate in as2?

oh, the human eye can see the different in framerate if it's highly trained.. it depends peson to person, i once read it was only 60fps.

Response to AS3: Changing Framerate 2007-05-04 18:54:05


stage.frameRate = 12;

wow very nice! Please do more!


Fate. Strength. Intelligence.

Response to AS3: Changing Framerate 2007-05-04 18:56:07


Awesome feature in AS3! I have to start learning it.

Nice tutorial.

Response to AS3: Changing Framerate 2007-05-04 18:59:34


I understand that as someone who's not touched AS3 yet that this is a bit presumptious of me...
But since when did explaining what a single property of a class does constitute as a tutorial?


...

BBS Signature

Response to AS3: Changing Framerate 2007-05-04 19:01:16


At 5/4/07 06:59 PM, KaynSlamdyke wrote: But since when did explaining what a single property of a class does constitute as a tutorial?

I don't agree because it's such a huge FEATURE that a wide range of people have been looking form. But yeah, just individual properties would be a little too much, but this property is very important and more of a feature anyway.

Response to AS3: Changing Framerate 2007-05-04 19:04:59


I don't understand why you can't make the framerate zero, it would be absolutely perfect for pausing games.


Asus P5Q PRO, Intel E8400 @ 3.60 GHz, 4GB DDR2-1000, ATI HD4850

BBS Signature

Response to AS3: Changing Framerate 2007-05-04 19:07:41


it just makes things go really really slow. If your not making a crazy fast game with tons of movement that will cause a player to die if he doesnt react within a couple of frame, it will work fine.

Response to AS3: Changing Framerate 2007-05-04 19:11:41


At 5/4/07 07:07 PM, LesPaulPlayer wrote: it just makes things go really really slow. If your not making a crazy fast game with tons of movement that will cause a player to die if he doesnt react within a couple of frame, it will work fine.

I'm not sure what you're talking about...

Do you mean dynamically changing the FPS slows everything down?

Response to AS3: Changing Framerate 2007-05-04 19:15:37


At 5/4/07 07:11 PM, DFox wrote: Do you mean dynamically changing the FPS slows everything down?

I think he's referring to my post, saying that making the FPS really slow would be sufficient for pausing.


Asus P5Q PRO, Intel E8400 @ 3.60 GHz, 4GB DDR2-1000, ATI HD4850

BBS Signature

Response to AS3: Changing Framerate 2007-05-04 19:19:48


At 5/4/07 07:15 PM, DarkMana wrote:
At 5/4/07 07:11 PM, DFox wrote: Do you mean dynamically changing the FPS slows everything down?
I think he's referring to my post, saying that making the FPS really slow would be sufficient for pausing.

well not exactly. A better way would be to remove event listeners, or just say:

if (!pause) {
}|

Response to AS3: Changing Framerate 2007-05-12 13:11:44


At 5/4/07 07:04 PM, DarkMana wrote: I don't understand why you can't make the framerate zero, it would be absolutely perfect for pausing games.

no it wouldn't. It would stop every code meaning you wouldn't be able to turn the games on again.

Response to AS3: Changing Framerate 2007-05-12 13:32:23


At 5/12/07 01:11 PM, B-Mantis wrote: no it wouldn't. It would stop every code meaning you wouldn't be able to turn the games on again.

You mean this wouldnt work:

Frame 1:

Guy dies. Pause game!
stage.frameRate = 0;

Button to go to next frame.

Frame 2:
stage.frameRate = 12;

Why can't the above scenario work?

Response to AS3: Changing Framerate 2007-05-12 13:32:59


At 5/12/07 01:11 PM, B-Mantis wrote:
At 5/4/07 07:04 PM, DarkMana wrote: I don't understand why you can't make the framerate zero, it would be absolutely perfect for pausing games.
no it wouldn't. It would stop every code meaning you wouldn't be able to turn the games on again.

FALSE 100%. the whole point of events is that its not everyframe, on ENTER_FRAME events. A keyDown event is registered every time the key is down, regardless of frame rate.

Response to AS3: Changing Framerate 2007-05-12 13:59:02


I don't understand how this works or I'm doing it wrong. Do you just put stage.frameRate = n; in a key frame and from that point on the framerate changes to whatever you put? Cause that's what I did and it aint working (and im outputing to flashplayer 9 w/as3.0).

Response to AS3: Changing Framerate 2007-05-16 13:38:21


I tested this pausing with the frame-rate, and there're 2 reasons why:

~Setting the FPS to 0 would make it look pretty crappy, since you can't have some kind of 'PAUSE' transition when you press the P key (0 fps = no movement).

~You wouldn't be able to un-pause (you would, because the lowest fps is actually 0.01, but it would take like 2 seconds to respond).

Response to AS3: Changing Framerate 2007-05-17 15:55:30


At 5/12/07 01:32 PM, UnknownFear wrote:
At 5/12/07 01:11 PM, B-Mantis wrote:
Frame 1:

Guy dies. Pause game!
stage.frameRate = 0;

Button to go to next frame.

Frame 2:
stage.frameRate = 12;

Why can't the above scenario work?

framerate means: how many frames per second. A framerate of 0 would mean NO frames per second, so NO frames at all. It would just totally stop the code. That's why the framerate can't be lower than .1
When you press a button, you probably put code on that button right? Well a event that listens to mouse clicks is actually a onenterframe event. It checks whether the mouse is pressed EVERY frame. so again: buttons won't work with a framerate of 0.

Response to AS3: Changing Framerate 2007-05-22 22:19:36


I can see many people using some sort of slow motion feature in games.

It would probably slow down audio too, either that or make it choppy.

Response to AS3: Changing Framerate 2007-05-23 00:04:30


At 5/22/07 10:19 PM, pt9-9 wrote: I can see many people using some sort of slow motion feature in games.

It would probably slow down audio too, either that or make it choppy.

well not really, because just slowing the framerate would just make it seem choppy because your motions (such as movieClips) still only occupy a certain ammount of frames so all it would do is stop on each frame for longer without actually stretching any tweens you may have. You could possibly get away with it by using all AS to move everything on your screen. Oh man i wish i still had my slo mo game that i was making.


BBS Signature

Response to AS3: Changing Framerate 2007-08-31 19:59:11


I have an addition to this, I just tested it and im pretty sure 3 = 30, people might want to tknow that.

so if you want 30 fps you would use 3
12 fps would be 1.2, thats what im seeing as far as testing goes.

stage.frameRate= 1.2 //thats 12 FPS

correct me if im wrong, just going by observation.

Response to AS3: Changing Framerate 2008-03-23 19:21:11


It appears I can only change the stage's framerate, anyone else have this problem?


BBS Signature

Response to AS3: Changing Framerate 2008-03-23 20:44:41


*Well-timed bump*


BBS Signature

Response to AS3: Changing Framerate 2008-03-23 20:50:40


Can framerate be negative?

Response to AS3: Changing Framerate 2008-03-23 20:53:02


At 3/23/08 08:50 PM, CaptinChu wrote: Can framerate be negative?

nope.


BBS Signature

Response to AS3: Changing Framerate 2008-03-24 18:48:18


Last bump for mc framerate changing situation...


BBS Signature

Response to AS3: Changing Framerate 2008-03-25 01:20:50


You can't change the framerate of individual MCs.

Response to AS3: Changing Framerate 2008-03-25 11:35:45


At 5/4/07 06:44 PM, Siggles wrote: AS3: Main

stage.frameRate = 12;

Now, in the code, you can change the 12 to whatever frame rate you want it to be, from 0.01 to 1000. Of course, no human eye can see a difference in anything than 70 fps or higher.

Actually, human eye can perceive difference up to about 200Hz; 60-80Hz is when flickering disappears.

Also, there is something wrong with that property. I tried messing around with it (in early AS3 alpha release, though) and after a while it broke... the graphics were messed up, and script events didn't respond.

Response to AS3: Changing Framerate 2010-02-06 13:29:27


At 3/25/08 11:35 AM, 4as wrote:
(in early AS3 alpha release, though)

Thats probably why.