Skip to main content
Known Participant
February 1, 2011
Answered

How remove ENTER_FRAME, setInterval

  • February 1, 2011
  • 1 reply
  • 482 views

I was load a page1.swf file into main.swf.

page1.swf inside code

var _root

if(this.parent!=null){   
if (this.parent.parent!=null) {   
    _root=this.parent.parent.parent

}
}

in page1.swf file have this.addEventListener(Event.ENTER_FRAME,updateTranscript)

function updateTranscript(e:Event){

/// i was controlling main.swf  some object

}

///end of page1.swf code

when i click the main.swf inside nextBtn i was unload page1.swf & load page2.swf but still page1.swf contring main.swf objects

how to remove unloaded swf file all event like Eneterframe, setInterval.

This topic has been closed for replies.
Correct answer

Inside of all your pages you could have some common unload function that removes listeners and stops any timers, etc. Call that on each page object when you want to remove it. And be sure to use weak references when attaching listeners. There is also the Event.REMOVED_FROM_STAGE event you can employ to do similar, which is fired when the object is removed from the display list.

1 reply

Correct answer
February 1, 2011

Inside of all your pages you could have some common unload function that removes listeners and stops any timers, etc. Call that on each page object when you want to remove it. And be sure to use weak references when attaching listeners. There is also the Event.REMOVED_FROM_STAGE event you can employ to do similar, which is fired when the object is removed from the display list.

kiranemc2Author
Known Participant
February 2, 2011

Thank you