What exactly happens during "Event.ENTER_FRAME"

Hi, I've been learning a lot during the past few weeks and am trying to really understand what is actually happening in my FLAs, rather than just learning to parrot a bunch of code to make something work.

My question is regarding the "Event.ENTER_FRAME" event. -- What exactly is happening when this event fires?

What is entering which frame? I assume my object, but what frame is it entering?

Does this event fire on each frame, continuously over and over again throughout the life of the MovieClip, or does it stop at some point?

As you can see, I'm a bit hazy on what is actually happening with "Event.ENTER_FRAME", so your help explaining it will certainly be welcome.

(I've added the code I'm referring to below)

Thanks,
Fulano
stage.addEventListener(Event.ENTER_FRAME, onEnter);

private function onEnter(event:Event):void
    {
	do something...
    }

Open in new window

Mr_FulanoAsked:
Who is Participating?
 
blue-genieConnect With a Mentor Commented:
Hi, if you place the code in a keyframe on the timeline it will trigger then and keep triggering on every frame.

if you instantiate it in code, ass soon as you use the addEventListener it will trigger and continue triggering until you explicitly remove the event listener  using the removeEventListener.

0
 
dgofmanCommented:
blue-genie:

That behavior in AS3 in AS2 and AS1 you will get onEnterFrame by default until you will not call stop() in your AcrtionScript
0
 
blue-genieCommented:
@dgofman - not sure what you're saying - "that what i  said is specific to AS3?"  Yeah i'm assuming the asker is referring to AS3 based on the code snippet format.
0
 
Mr_FulanoAuthor Commented:
Yes, I'm using AS3.
0
 
Mr_FulanoAuthor Commented:
Thank you very much!!!
0
All Courses

From novice to tech pro — start learning today.