Skip to main content
Participant
November 29, 2013
Question

Detecting swf unload

  • November 29, 2013
  • 0 replies
  • 388 views

Hello,

I'm trying to figure out the proper way to detect the unloading of a loaded swf.

My app is an AIR/iOS book project that behaves differently on the device vs testing locally in Flash Builder.

When viewing the console in debug I see this in Flash Builder:

1) [SWF] assets/swfs/common.Page1.swf - 808,976 bytes after decompression

2) [Unload SWF] assets/swfs/common.Page1.swf

3) [SWF] assets/swfs/common.Page2.swf - 969,002 bytes after decompression

However, looking at the debug console when testing on an iPad, I don't always see 2) after 1). It only appears after going to Page3. So sometimes a swf seems stuck in memory. This causes a significant performance hit and eventually can lead to a crash.

The ViewController function for adding pages is basically:

1) destroy, remove and nullify a "_currentPage" page it if already exists

2) garbage collect (System.gc() twice)

3) check to see if flash.events.Event.UNLOAD event has fired. If not, call same function again after slight delay

My question is if there is some other event that should be listened for to detect when the swf is truly unloaded? i.e. whatever actually happens in the Flash Player that displays this in the console: [Unload SWF] assets/swfs/common.PageNameHere.swf

I want to pause the app until the previously loaded asset swf is removed before going to the next page.

Hopefully this issue makes sense.

Thanks in advance for any help.

Best,
Mark

This topic has been closed for replies.