You can reuse Loaders, like:
var loader:Loader = new Loader();
loader.load(new URLRequest("http://someMedia.jpg"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
function onComplete(event:Event):void
{
addChild(event.target.content);
loader.load(new URLRequest("http://someOtherMedia.jpg"));
}
this will load both images but is not very good for keeping everything clean
So I would suggest this way
var loader1:Loader = new Loader();
loader1.load(new URLRequest("http://someMedia.jpg"));
loader1.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoader1Complete);
var loader2:Loader = new Loader();
loader2.load(new URLRequest("http://someOtherMedia.jpg"));
loader2.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoader2Complete);
function onLoader1Complete(event:Event):void
{
event.target.removeEventListener(Event.COMPLETE, onLoader1Complete);
addChild(event.target.content);
loader1.unload();
}
function onLoader2Complete(event:Event):void
{
event.target.removeEventListener(Event.COMPLETE, onLoader2Complete);
addChild(event.target.content);
loader2.unload();
}
This is great if you have two, three things you want to load, but if you have several, looping the function is preferred
var loader:Loader;
function loopLoader():void
{
for (var i:int = 0; i < 10; i++)
{
loader = new Loader();
loader.load(new URLRequest("http://someMedia.jpg"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
}
}
function onLoaderComplete(event:Event):void
{
event.target.removeEventListener(Event.COMPLETE, onLoaderComplete);
addChild(event.target.content);
loader.unload();
}
loopLoader();