3 Replies Latest reply: Feb 9, 2010 11:28 AM by kglad RSS

    Should you remove MouseEvent listeners if you navigate away from the frame they're on?

    Webshark2000 Community Member

      I've got a project I'm working on that has two frames in the main timeline and on the second frame there is a movieclip (pages_mc) with 7 frames to it, each containing content (more movieclips, text, graphics, etc).  I set it up this way because I have a title bar and navigation buttons on the main timeline I want to always stay on top of everything.

       

      If I have actionscript on an individual frame of pages_mc, that controls buttons on that frame, do I need to remove the MouseEvent listeners if the user navigates to a different frame?  I've read that if you don't remove them it will eat up memory and cause poor performance.

       

      I already ran into a problem with the ENTER_FRAME event listener, in which I was forced to remove it because it would just keep going even when the user navigated to a different frame of the pages_mc movieclip.

       

      Just didn't know how much of a problem this would be.  I'm thinking that if I don't remove them, every time the user goes back to that frame it's just adding another MouseEvent listener to the buttons.  Is that correct?

       

      Thanks.