Multiple onEnterFrame Events

game

One problem with using onEnterFrame is that every movieclip only has one of them so you can only assign a single function to be used for a movieclip's onEnterFrame event at any given time. This (albeit odd) example shows how you can get around this using an addEnterFrameEvent function which runs multiple enterFrame event functions stored in an array for any single onEnterFrame event of a single movieclip. Some additional features are added to provide more control which can be seen in interacting with the street sign in this example. Simply click the sign to initiate 3 different function calls for one onEnterFrame event, each with their own set of parameters assigned when the sign is clicked.

In addition, a helpful SimpleTweener function is used to scale and position the sign movieclip. This simple yet versitile function makes it easy to make simple tweens for many different properties using the same function.

Developer: Trevor McCauley
Language: en