Solved

What exactly happens during "Event.ENTER_FRAME"

Posted on 2011-09-21
5
347 Views
Last Modified: 2013-11-11
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

0
Comment
Question by:Mr_Fulano
  • 2
  • 2
5 Comments
 
LVL 39

Accepted Solution

by:
blue-genie earned 500 total points
ID: 36578689
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
 
LVL 29

Expert Comment

by:dgofman
ID: 36578736
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
 
LVL 39

Expert Comment

by:blue-genie
ID: 36579919
@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
 

Author Comment

by:Mr_Fulano
ID: 36581136
Yes, I'm using AS3.
0
 

Author Closing Comment

by:Mr_Fulano
ID: 36802418
Thank you very much!!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

939 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now