Event.currentTarget.name

Hi,

I’m pretty new to coding, and just started an xml gallery, and here i’m stuck trying to access an attribute through a As object/sprite, basically i’m trying to retrieve the .name of the xml child when the sprite is clicked… here is the code and the files linked:

import fl.containers.UILoader;
import caurina.transitions.*;

//---------loading the external xml file-------
var urlRequest:URLRequest = new URLRequest(“pictures.xml”);
var urlLoader:URLLoader = new URLLoader();
var myXML:XML = new XML();
var xmlList:XMLList;
//myXML.ignoreWhitespace = true;
urlLoader.addEventListener(Event.COMPLETE,fileLoaded);
urlLoader.load(urlRequest);

//--------holds the paths to the thumbnails-------
var arrayURL:Array = new Array();
//--------holds the paths to the big photos-------
var arrayName:Array = new Array();
//--------holds the thumbnail objects-------
var holderArray:Array = new Array();
var arraytext1:Array = new Array();

//-------represents the container of our gallery
var sprite:Sprite = new Sprite();
addChild(sprite);
var thumb:Thumbnail;
//-------- the thumbnails container-------
var thumbsHolder:Sprite = new Sprite();
sprite.addChild(thumbsHolder);
//-------- the photoLoader container-------
var loaderHolder:Sprite = new Sprite();
//loaderHolder.graphics.beginFill(0xffffff,1);
//loaderHolder.graphics.drawRect(0,0,550,330);
//loaderHolder.graphics.endFill();
loaderHolder.x = 10;
loaderHolder.y = 10;
sprite.addChild(loaderHolder);
//-------- loads the big photo-------
var photoLoader:UILoader = new UILoader();
photoLoader.width = 600;
photoLoader.height = 400;
photoLoader.y = 5;
photoLoader.x = 5;
//photoLoader.buttonMode = true;
photoLoader.addEventListener(MouseEvent.CLICK,onClickBack);
loaderHolder.addChild(photoLoader);

var cartel:TextField = new TextField;
cartel.x = 5;
cartel.y = 5;
cartel.width = 110;
cartel.autoSize = TextFieldAutoSize.LEFT;
cartel.selectable = false;
addChild(cartel);
//cartel.text = picTitle;

/* we loop through the xml file
populate the arrayURL, arrayName and position the thumbnalis*/
function fileLoaded(event:Event):void {
myXML = XML(event.target.data);
xmlList = myXML.children();

for (var i:int=0; i<xmlList.length(); i++) {
	var picURL:String = xmlList*.url;
	var picTitle :String= String(xmlList*.attribute("name"));
	var picName:String = xmlList*.big_url;
	arrayURL.push(picURL);
	arrayName.push(picName);
	arraytext1.push(picTitle);
	holderArray* = new Thumbnail(arrayURL*,i,arrayName*);
	holderArray*.addEventListener(MouseEvent.CLICK,onClick);
	holderArray*.name = arrayName*;
	//holderArray*.titre = arraytext1*;//holderArray*.title = picTitle*;
	
	trace(picTitle);
		holderArray*.y = 65;
		holderArray*.x = i*110+65;
	thumbsHolder.addChild(holderArray*);
	if (i>7) {
		thumbsHolder.addEventListener(MouseEvent.MOUSE_OVER, slide);
		}
}

}

//----handles the Click event added to the thumbnails–
function onClick(event:MouseEvent):void {
photoLoader.source = event.currentTarget.name;

Tweener.addTween(loaderHolder, {alpha:1, time:1, transition:"linear"});

}
//----handles the Click event added to the photoLoader----
function onClickBack(event:MouseEvent):void {

Tweener.addTween(loaderHolder, {alpha:0, time:2, transition:"linear"});

//thumbsHolder.removeChild;
}

function slide(event:MouseEvent){
//if (mouseX > 660){Tweener.addTween(thumbsHolder, {x:0, time:1, transition:“easeIn”});}
}

//the .as file
//____________________________________________

package {
import flash.display.Sprite;
import fl.containers.UILoader;
import caurina.transitions.*;
import flash.events.MouseEvent;

public class Thumbnail extends Sprite {
	private var nume:String;
	private var url:String;
	public var id:int;
	private var loader:UILoader;
	public var  nom:String;
	public var itemNr:int;
	
	function Thumbnail(source:String,itemNr:int,numeThumb:String):void {
		url = source;
		id = itemNr;
		name = nom;//nom = picTitle[itemNr];
		this.nume = numeThumb;
		drawLoader();
		addEventListener(MouseEvent.MOUSE_OVER,onOver);
		addEventListener(MouseEvent.MOUSE_OUT,onOut);
		scaleThumb();
	}
	
	private function drawLoader():void {
		loader = new UILoader();
		loader.source = url;
		loader.mouseEnabled = false;
		loader.x = 0;
		loader.y = 0;
		addChild(loader);

	}
	private function onOver(event:MouseEvent):void {
		Tweener.addTween(this, {scaleX:1,scaleY:1, time:1, transition:"easeout"});
		Tweener.addTween(this, {alpha:1, time:1, transition:"easeout"});
	}
	private function onOut(event:MouseEvent):void {
		Tweener.addTween(this, {scaleX:.9,scaleY:.9, time:1, transition:"easeout"});
		Tweener.addTween(this, {alpha:.5, time:1, transition:"easeout"});
	}
	private function scaleThumb():void {
		this.scaleX = .9;
		this.scaleY = .9;
		this.alpha = .5;
	}
}

}