Dear all,
I place several empty movieclips dynamically on the main stage and load a picture in there with a adress derived from a xml file and some text also from the xml file. Then I add a event listner to the movieclip. On stage the image + text is correctly shown, but when I click the image it traces the name of image and not the name of the movieclip in which it is placed, I need the name of the movieclip because i want to tween the movieclip after it is clicked.
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
var lijst:XMLList = xmlData.snipper;
aantal = lijst.length();
for(var i:Number = 0; i<aantal;i++){
container = new Container();
container.name = "snipper"+ i;
container.addEventListener(MouseEvent.CLICK, onClick);
container.buttonMode = true;
container.Tekst.text = lijst*.@snippertekst;
var l:Loader = new Loader();
l.load(new URLRequest(lijst*.@image));
l.x=0;
l.y=-40;
container.addChild(l);
addChild(container);
}
}
function onClick(e:MouseEvent):void{
trace(e.target.name);
}
Thaxs a bunch