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:
@@ -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
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -328,16 +328,7 @@ public class MediaContainer extends Sprite
|
|||||||
removeListeners(loader.contentLoaderInfo);
|
removeListeners(loader.contentLoaderInfo);
|
||||||
|
|
||||||
// dispose of media
|
// dispose of media
|
||||||
try {
|
LoaderUtil.unload(loader);
|
||||||
loader.close();
|
|
||||||
} catch (ioe :IOError) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
loader.unload();
|
|
||||||
} catch (e :Error) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
dispatchEvent(new Event(Event.UNLOAD));
|
dispatchEvent(new Event(Event.UNLOAD));
|
||||||
|
|
||||||
removeChild(loader);
|
removeChild(loader);
|
||||||
|
|||||||
Reference in New Issue
Block a user