views:

27

answers:

1

Currently, I have all my variable initialization and function definitions in the timeline's first frame, my logic in the second frame, and a command to 'go to the second frame' in the third frame.

This seems very sloppy to me, and I assume Flash developers have a better way of creating a run loop.

Thanks! -S

+1  A: 

First of all, you shouldn't be writing all your game code on the timeline in the first place. Storing your code in an opaque binary file along with all your art assets is no fun.

Use classes and stick your code in external .as files.

Anyway to answer your question, typically, you'd use the onEnterFrame event (Event.ENTER_FRAME) in order to run your game loop.

Anon.
and you can use a delta value based on the time it takes to loop to help keep the movements somewhat consistent due to frame rate inconsistencies.
Allan