?
Solved

Flash CS5 AS3 Code works no matter where it sits?

Posted on 2012-09-02
4
Medium Priority
?
422 Views
Last Modified: 2012-09-03
This is a general question about AS3.

I can't seem to "isolate" code.

I have a layer called AS3-Aud, where I handle the AS3 that control my project's audio files.

The first "section" of AS3 is on frames 1-29, the 2nd section is on frames 30-59.

If I write the following code (see below) and put it in the 30-59 frames section (see attached image if this isn't clear), why does it trace "Just Entered Frame 1", "Just Entered Frame 2", etc. when the playhead enters those frames? Shouldn't the code only run in the frames that has AS3 layer?

AS3 CODE=================================
addEventListener(Event.ENTER_FRAME,fx_enterFrame2);
function fx_enterFrame2(event:Event) {
      trace("Just Entered Frame " + currentFrame);
}
=========================================
screenshot
0
Comment
Question by:tlengnick
  • 2
  • 2
4 Comments
 
LVL 39

Accepted Solution

by:
blue-genie earned 2000 total points
ID: 38360467
when you file loads, does it play through to frame 30 or is there a stop there?
if you let your file play through to frame 30 where it creates the event listener, it will keep listening for the onEnterFrame event until you explicitly stop it.
0
 

Author Comment

by:tlengnick
ID: 38360772
Got it - good to know! How do I explicitly stop it?
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 38361056
removeEventListener(Event.ENTER_FRAME,fx_enterFrame2);
0
 

Author Comment

by:tlengnick
ID: 38361214
Great - thank you!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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,…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
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): …
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

862 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