Added LoaderUtil, which has unload.

Hmm, I'm not able to use unloadAndStop() yet.
Perhaps I need to grab an even newer version of the flex SDK,
so it's commented out for now.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@669 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Ray Greenwell
2008-10-16 00:49:34 +00:00
parent a19690f205
commit 1df26e8813
2 changed files with 36 additions and 10 deletions
+35
View File
@@ -0,0 +1,35 @@
//
// $Id$
package com.threerings.flash {
import flash.display.Loader;
/**
* Contains a utility method for safely unloading a Loader.
*/
public class LoaderUtil
{
/**
* Safely unload the specified loader.
*/
public static function unload (loader :Loader) :void
{
try {
loader.close();
} catch (e1 :Error) {
// ignore
}
// try {
// loader.unloadAndStop();
// } catch (e2 :Error) {
// hmm, maybe they are using FP9 still
try {
loader.unload();
} catch (e3 :Error) {
// ignore
}
// }
}
}
}
+1 -10
View File
@@ -328,16 +328,7 @@ public class MediaContainer extends Sprite
removeListeners(loader.contentLoaderInfo);
// dispose of media
try {
loader.close();
} catch (ioe :IOError) {
// ignore
}
try {
loader.unload();
} catch (e :Error) {
// ignore
}
LoaderUtil.unload(loader);
dispatchEvent(new Event(Event.UNLOAD));
removeChild(loader);