Is there a Loader detection?

Theoretically, if I have 2 loaders, with the same complete event, will the complete event be able to detect which loader is accessing it??

var a:Loader = new Loader();
var b:Loader = new Loader();

a.contentLoaderInfo.addEventListener(Event.COMPLETE, Com);
b.contentLoaderInfo.addEventListener(Event.COMPLETE, Com);

And then they work all nice and all, then comes

function Com(e:Event):void

If you want to know where event is coming from - check event’s .target property.

I tried that, but it only works with URLLoader, not with Loader, Loader says that event.target is a LoaderInfo, however I’m trying to access the original Loader itself.

a.contentLoaderInfo.addEventListener
You are adding listener to contentLoaderInfo which is an instance of LoaderInfo, that’s correct.

That is correct, however using loader.addEvent… doesn’t work, i have to attach it to the contentLoaderInfo, :frowning:

Hm… do you need to check if a.contentLoaderInfo == b.contentLoaderInfo? I can’t understand where the problem is… =/
btw. LoaderInfo.loader references the instance of Loader this loaderInfo belongs to… if this is the question.
i.e. in your case the Loader which loaded something, can be accessed through it’s contentLoaderInfo.loader property.

Aha, i’ll try that, the reason is I am creating an extended Loader system which intakes an array of url’s instead of just one, that way it will go through each url that fails, in an attempt to find one that works, (a game I am making will load sprite sheets from various servers if a server fails)

It works wonderfully thanks :smiley: