Flash framerate reliability

Posted by Tim Cooper on Game Development See other posts from Game Development or by Tim Cooper
Published on 2011-03-10T22:07:26Z Indexed on 2011/03/11 0:19 UTC
Read the original article Hit count: 411

I am working in Flash and a few things have been brought to my attention. Below is some code I have some questions on:

addEventListener(Event.ENTER_FRAME, function(e:Event):void
{
    if (KEY_RIGHT)
    {
        // Move character right
    }
    // Etc.
});

stage.addEventListener(KeyboardEvent.KEY_DOWN, function(e:KeyboardEvent):void
{
    // Report key which is down
});

stage.addEventListener(KeyboardEvent.KEY_UP, function(e:KeyboardEvent):void
{
    // Report key which is up
});

I have the project configured so that it has a framerate of 60 FPS. The two questions I have on this are:

  1. What happens when it is unable to call that function every 1/60 of a second?
  2. Is this a way of processing events that need to be limited by time (ex: a ball which needs to travel to the right of the screen from the left in X seconds)? Or should it be done a different way?

© Game Development or respective owner

Related posts about flash

Related posts about actionscript-3