Home RSS

Flash Player 10 – Loader.unloadAndStop()

Adobe released beta 2 of Flash Player 10 this afternoon, and I was very excited to see in the release notes that they have added in a new method of the Loader class, unloadAndStop(). From said release notes:

unloadAndStop — This new ActionScript 3.0 API adds unload functionality similar to the unload behavior in ActionScript 2.0. After calling unloadAndStop on loaded content it will be immediately removed stopping all audio, removing eventListeners, and becoming inaccessible through ActionScript.

In short, this should make it much simpler to free a loaded SWF for garbage collection, as opposed to having to resort to hacks like SoundMixer.stopAll() and then praying that the content isn't just floating around somewhere waiting to be picked up.

Grant Skinner had written a post about Flash Player 9's inability to completely free loaded content from memory and force garbage collection. It became a very active post with almost 60 comments, including some from the Flash Player development team.

In the comments of Grant's post I read about an additional item that has found its way into FP10 beta 2: calling System.gc() will now work in all Flash Players, not just the debug versions as stated in the AS3 documentation:

System.gc()
Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0.115.0

Forces the garbage collection process.

For the Flash Player debugger version and AIR applications only. In an AIR application, the System.gc() method is only enabled in content running in the AIR Debug Launcher (ADL) or, in an installed applcation, in content in the application security sandbox.

Once again, great job Adobe at listening to the requests of your developers!

Recent Links Tagged With "flashplayer10" - JabberTags said,

December 25, 2008 @ 7:19 am

[…] on Thu 11-12-2008 FlashPlayer10 beta ????? Saved by aquraishi on Thu 11-12-2008 Flash Player 10 – Loader.unloadAndStop() Saved by uolter on Wed 10-12-2008 Flash Player 10 – Aka Astro Saved by tiliu on Sat 06-12-2008 […]

RSS feed for comments on this post

 
Powered by WordPress.