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:
myMovieClip.addEventListener(Event.ENTER_FRAME,enterFrameFunction);
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.
0 Ads:
Post a Comment