# Is there a Loader detection?

**URL:** <https://forum.kirupa.com/t/is-there-a-loader-detection/269161>\
**Category:** Uncategorized\
**Created:** [August 23, 2008, 5:22pm UTC](https://forum.kirupa.com/t/is-there-a-loader-detection/269161 "2008-08-23T17:22:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Z11](https://avatars.discourse-cdn.com/v4/letter/z/97f17d/32.png) [@Z11](https://forum.kirupa.com/u/Z11)\
**Post date:** [August 23, 2008, 5:22pm UTC](https://forum.kirupa.com/t/is-there-a-loader-detection/269161/1 "2008-08-23T17:22:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wvxvw](https://avatars.discourse-cdn.com/v4/letter/w/a9a28c/32.png) [@wvxvw](https://forum.kirupa.com/u/wvxvw)\
**Post date:** [August 23, 2008, 5:54pm UTC](https://forum.kirupa.com/t/is-there-a-loader-detection/269161/2 "2008-08-23T17:54:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Z11](https://avatars.discourse-cdn.com/v4/letter/z/97f17d/32.png) [@Z11](https://forum.kirupa.com/u/Z11)\
**Post date:** [August 23, 2008, 6:30pm UTC](https://forum.kirupa.com/t/is-there-a-loader-detection/269161/3 "2008-08-23T18:30:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wvxvw](https://avatars.discourse-cdn.com/v4/letter/w/a9a28c/32.png) [@wvxvw](https://forum.kirupa.com/u/wvxvw)\
**Post date:** [August 23, 2008, 6:48pm UTC](https://forum.kirupa.com/t/is-there-a-loader-detection/269161/4 "2008-08-23T18:48:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Z11](https://avatars.discourse-cdn.com/v4/letter/z/97f17d/32.png) [@Z11](https://forum.kirupa.com/u/Z11)\
**Post date:** [August 23, 2008, 6:52pm UTC](https://forum.kirupa.com/t/is-there-a-loader-detection/269161/5 "2008-08-23T18:52:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wvxvw](https://avatars.discourse-cdn.com/v4/letter/w/a9a28c/32.png) [@wvxvw](https://forum.kirupa.com/u/wvxvw)\
**Post date:** [August 23, 2008, 6:56pm UTC](https://forum.kirupa.com/t/is-there-a-loader-detection/269161/6 "2008-08-23T18:56:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Z11](https://avatars.discourse-cdn.com/v4/letter/z/97f17d/32.png) [@Z11](https://forum.kirupa.com/u/Z11)\
**Post date:** [August 23, 2008, 7:07pm UTC](https://forum.kirupa.com/t/is-there-a-loader-detection/269161/7 "2008-08-23T19:07:58Z")

</div>

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 😃
