Saturday, July 19, 2008

Things You Must Do Before Unloading a SWF File

Wow this is really important. It reads "Danger Will Robinson. Danger!" The following I found from a friend who referenced Colin Moock in which deactivation of a swf requires the following tasks to be disabled.
  • Tell any loaded .swf child assets to disable themselves.
  • Stop any sounds from playing.
  • Stop the main timeline, if it is currently playing.
  • Stop any movie clips that are currently playing.
  • Close any connected network objects, such as instances of Loader, URLLoader, Socket, XMLSocket, LocalConnection, NetConnections, and NetStream.
  • Release all references to cameras and microphones.
  • Unregister all event listeners in the .swf (particularly Event.ENTER_FRAME, and mouse and keyboard listeners)
  • Stop any currently running intervals (via clearInterval()).
  • Stop any Timer objects (via the Timer class’s instance method stop()).
Not doing so apparently allows the swf to consume resources and not get destroyed. Go here to read more:

http://www.moock.org/blog/archives/000279.html

No comments: