I'm wondering if I can use a for loop to create local Loader objects, assign
listeners to their LoaderInfo objects without overwriting any of them and
still be able to clean up after.

Say I have the following inside a function body

var img:Loader = new Loader();
img.contentLoaderInfo.addEventListener(Event.COMPLETE, onThumb, false, 0,
true);
img.load(new URLRequest("someImage.jpg"));

and the following handler

private function onThumb(e:Event):void
{
    var loader:Loader = Loader( LoaderInfo(e.target).loader );
    loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onThumb);
    var thumbNail:Bitmap = new Bitmap(Bitmap(loader.content).bitmapData);
    thumbNail.x = (itemWidth - thumbNail.width) / 2;
    addChild(thumbNail);
}

Will the handler work its way back to the Loader that was created
temporarily and remove a listener from it?
Is there a better way to using throw away loaders?


-- 
--Joel Stransky
stranskydesign.com
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to