Flash, AS3, event listener changes the object to listen by it's own will, whatta?

Ok.
Here’s the interesting thing. When you make a MovieClip (say “MainMovieClip”), and add an Event Listener (lets name it “MainListener”) to it, all works as intended. But after you Load an image into it, or even into a special container inside of our MC, the MainListener no longer listens to the MainMovieClip, it refers to [object Loader] instead. Does it suppose to be this way?

Here’s a reproduction code (click the rectangle before the image loads and after):


var Container:MovieClip = new MovieClip();
	Container.x = Container.y = 50;
	Container.addEventListener("click",function(e:MouseEvent){trace("Container: "+e.target);});
addChild(Container);
var Background:Shape = new Shape();
	Background.graphics.beginFill(0xCCCCCC);
	Background.graphics.drawRect(0,0,200,100);
	Background.graphics.endFill();

Container.addChild(Background);


var Image:MovieClip = new MovieClip()
var iLoader:Loader = new Loader();
	iLoader.load(new URLRequest("http://concierge.typepad.com/photos/uncategorized/2007/03/26/mercedes_rental_car_greve_in_chiant.jpg"));

Image.addChild(iLoader);
Container.addChild(Image);

P/S code goes to 1st frame in flash IDE, do no use classes with this code, it wont work.

Any ideas, guys?!

[FONT=“Courier New”]target[/FONT] is the object that fired the event (you clicked on the image loader, a child of the container - [FONT=“Courier New”]currentTarget[/FONT] is the object that you applied the listener to. (The container.)

use currentTarget

Thanks guys! Thanks a lot.

Btw, Zeigeist Movie is very nice thing.