Flash CS5 AS3 Code works no matter where it sits?

Posted on 2012-09-02
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=================================
function fx_enterFrame2(event:Event) {
      trace("Just Entered Frame " + currentFrame);
Question by:tlengnick
    LVL 39

    Accepted Solution

    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.

    Author Comment

    Got it - good to know! How do I explicitly stop it?
    LVL 39

    Expert Comment


    Author Comment

    Great - thank you!

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
    I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
    The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
    The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

    728 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

    17 Experts available now in Live!

    Get 1:1 Help Now