Hi,
Do you have to destroy the Bitmap you create in the largeLoaded
function???
Glen
Sander Schuurman wrote:
Hi cool list,
I'm struggling with my Image class. It's supposed to load and unload different
sized images dynamicly; but I can't seem to get it to work properly. The
loading works fine, but the unloading not for the full 100%. It visually
unloads the image, but it remains in the memory. I have tried several different
things; I'm a bit stuck now.
Here is a stripped class:
public class Image extends MovieClip
{
...
private var _largeLoader:Loader;
private var _large:Sprite;
...
public function Image( thumbUrl :String,
normalUrl :String,
largeUrl :String )
{
_tu = thumbUrl;
_nu = normalUrl;
_lu = largeUrl;
}
...
public function loadLarge() :void
{
_largeLoader = new Loader();
_largeLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, largeLoaded,
false, 0, true);
_largeLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,
errorOccured, false, 0, true);
_largeLoader.load(new URLRequest(_lu));
}
private function largeLoaded( e :Event ) :void
{
var b:Bitmap = Bitmap(largeLoader.content);
_largeLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, largeLoaded);
_largeLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,
errorOccured);
_largeLoader = null;
_large = new Sprite();
_large.addChild(b);
addChild(_large);
dispatchEvent(new Event(Image.IMG_LOADED));
}
...
public function clear( full :Boolean = false ) :void
{
// clear normal img and large img
... ?
// tried things like:
//_normal.removeChildAt(0);
//_normal = null;
//removeChild(_normal);
//_large.removeChildAt(0);
//_large = null;
//removeChild(_large);
//delete(_normal.removeChildAt(0));
//delete(_large.removeChildAt(0));
// removes the images visually, but they won't get GC'ed
if (full)
{
// clear thumb and itself
}
}
}
Thanks in advance!
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders