Hi all
I’m doing an XML gallery kind of thing that I need to assign a title to each image.
I created a Dictionary object “titleImageMap” to store the titles. Then placed them into each MC using the variable name colName.
function loadImages(collectionList:XML):void {
var imageList:XMLList=collectionList.collection.img;
var titleList:XMLList=collectionList.collection.coltitle;
createContainer();
thumbTotal=imageList.length();
for (var i:Number=0; i<imageList.length(); i++) {
var img_url=imageList*;
var img_loader=new Loader ;
titleImageMap[img_loader]=titleList*;
img_loader.load(new URLRequest(img_url));
img_loader.contentLoaderInfo.addEventListener(Event.COMPLETE,imageLoaded);
img_loader.name=i;
}
}
function imageLoaded(e:Event):void {
var my_thumb:Loader=Loader(e.target.loader);
thumbContainer = new MovieClip();
thumbContainer.addChild(my_thumb);
thumbContainer.colName=titleImageMap[my_thumb];
my_thumb.x = 0-(my_thumb.width/2);
my_thumb.y = 0-(my_thumb.height/2);
var xPosid=my_thumb.name;
container_mc.addChild(thumbContainer);
thumbContainer.name="thumb"+my_thumb.name;
trace(thumbContainer.colName); //tracing worked
thumbContainer.x=350*xPosid;
thumbContainer.alpha=0;
TweenLite.to(thumbContainer,0.5,{alpha:1,ease:Quint.easeInOut});
}
Tracing worked, so the colName variable is attached to each thumbContainer inside the container_mc.
Now I try to retrieve the colName from a button, but stuck on how to access it…it keeps chucking a 1119 error
1119: Access of possibly undefined property colName through a reference with static type flash.display:DisplayObject.