Flash AS3 onEnterFrame event changed

Actionscript 3.0 onEnterFrame has changed a bit from the old classic AS2 onEnterFrame event function. I’ll illustrart the old and new way of preforming animations using the Enter Frame event. The classic way of attaching an onEnterFrame event to a stage or movie clip was done this way:

myMovieClip.onEnterFrame = function(){
trace("do something repetitive");

In AS3, you’ll have to use an event listener method to preform a frame event like so:

function enterFrameFunction(event:Event) {
trace("do something repetitive");

Like most functions in AS3, it’s a little more involved than AS2, however when your done, your flash should load and run faster.

You may also like...

2 Responses

  1. Rashida says:

    thanx a bunch. It is simple but good for people who know as2 and just learning as3 🙂

  2. If you want to use onEnterFrame on the main timeline rather then an individual movie clip see AS2 to AS3 – onEnterFrame

Leave a Reply