Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 867351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:57:39+00:00 2026-05-15T09:57:39+00:00

In my Flash project I have a movieclip that has 2 keyframes. Both frames

  • 0

In my Flash project I have a movieclip that has 2 keyframes. Both frames contain 1 movieclip each.

frame 1 – Landing
frame 2 – Game

The flow of the application is simple:

  1. User arrives on landing page (frame 1)
  2. User clicks “start game” button
  3. User is brought to the game page (frame 2)
  4. When the game is over, the user can press a “play again” button which brings them back to step 1

Both Landing and Game movieclips are linked to separate classes that define event listeners. The problem is that when I end up back at step 1 after playing the game, the Game event listeners fire twice for their respective event. And if I go through the process a third time, the event listeners fire three times for every event. This keeps happening, so if I loop through the application flow 7 times, the event listeners fire seven times. I don’t understand why this is happening because on frame 1, the Game movieclip (and I would assume its related class instance) does not exist – but I’m clearly missing something here.

I’ve run into this problem in other projects too, and tried fixing it by first checking if the event listeners existed and only defining them if they didn’t, but I ended up with unexpected results that didn’t really solve the problem.

I need to ensure that the event listeners only fire once. Any advice & insight would be greatly appreciated, thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:57:40+00:00Added an answer on May 15, 2026 at 9:57 am

    If you have two frames with different clips on the same layer, each time that frame “enters”, that clip is created. When it “leaves” the clip is removed, but it still will be kept around and not be garbage collected. So the next time the frame enters a different clip is “created” and it gets its own listener. Your best bet is to remove the listeners when you change frames. I usually get around this kind of stuff by having a listener for Event.REMOVED_FROM_STAGE in each class. If it’s removed, then you clean up the remaining listeners.

    You may also want to experiment with “weak listeners”:

    addEventListener(GameEvent.GAME_START, gameStartedHandler, false, 0, true);
    

    The “true” makes the link “weak” so if an object is removed, the garbage collector can pick it up. I wouldn’t rely on this completely though. Better to manually remove references so you can be sure.

    This answer assumes a lot of course. It’d be helpful if you posted code/screenshots/flas to better diagnose.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.