I have a perfectly working code which removes an xml loaded image thumb scroller. It is set up to remove the loaded jpg’s on a mouse click with the listener assigned to a navigation object.
My problem is that on that page I have 75+ navigation objects and would like to avoid to assign the scroller remove function to all of them.
Is there a way to tweek this code so it works on something like EXIT_FRAME. So it is not assigned to any navigation object, but rather to the fact that user has navigated out of the page with the scroller. My site is segmented into labeled sections, maybe this somehow can be factored in?
[COLOR=darkgreen]//removing the scroller///////////////////////////////////////////////////////[/COLOR] [COLOR=darkgreen]//first.setting up the function which will remove the scroller and stop it from consuming resources//[/COLOR] function removeScrollerF():[COLOR=navy]**void**[/COLOR][COLOR=navy]{[/COLOR] [COLOR=navy]**if**[/COLOR](scroller)[COLOR=navy]{[/COLOR] scroller.removeEventListener(Event.ENTER_FRAME, moveScrollerThumbs); removeChild(scroller); scroller=[COLOR=navy]**null**[/COLOR]; [COLOR=navy]}[/COLOR] [COLOR=navy]}[/COLOR] [COLOR=darkgreen]///second. add listeners for naviagation objects[/COLOR] testDelete_mc.addEventListener(MouseEvent.CLICK, navF); [COLOR=darkgreen]//third. create the listener functions for navigation objects[/COLOR] function navF(e:MouseEvent):[COLOR=navy]**void**[/COLOR][COLOR=navy]{[/COLOR] [COLOR=darkgreen]// in each listener function call the function that removes the scroller[/COLOR] removeScrollerF(); [COLOR=darkgreen]// add the navigation code[/COLOR] gotoAndPlay([COLOR=red]"howto"[/COLOR]); [COLOR=navy]}[/COLOR] [COLOR=darkgreen]////////////////////////////////////////////////////////////////////// ///////////////[/COLOR]