Thanks. I tried what you added, but I'm still having some problems. The bottom thumbnails are still disappearing and the each column properly removes an image when another image in the column is clicked, but crossing to the other column causes the images to stack up on the stage. I really appreciate your looking at this.
Here's what I tried:
Code:
var imageLoader:Loader;
var xml:XML;
var xmlList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("images.xml"))
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(event:Event):void
{
xml = XML(event.target.data);
xmlList = xml.children();
for(var i:int = 0; i < xmlList.length(); i++)
{
imageLoader = new Loader();
imageLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
imageLoader.x = 5;
imageLoader.y = i * 70 + 5;
imageLoader.name = xmlList[i].attribute("source")
addChild(imageLoader);
imageLoader.addEventListener(MouseEvent.CLICK, showPicture);
}
}
function showPicture(event:MouseEvent):void
{
if(imageLoader2!=null)
removeChild(imageLoader2)
if(imageLoader!=null)
removeChild(imageLoader)
imageLoader = new Loader();
imageLoader.load(new URLRequest(event.target.name));
imageLoader.x = 200;
addChild(imageLoader);
addChild(imageLoader2);
}
var imageLoader2:Loader;
var xml2:XML;
var xmlList2:XMLList;
var xmlLoader2:URLLoader = new URLLoader();
xmlLoader2.load(new URLRequest("images2.xml"))
xmlLoader2.addEventListener(Event.COMPLETE, xmlLoaded2);
function xmlLoaded2(event:Event):void
{
xml2 = XML(event.target.data);
xmlList2 = xml2.children();
for(var j:int = 0; j < xmlList2.length(); j++)
{
imageLoader2 = new Loader();
imageLoader2.load(new URLRequest(xmlList2[j].attribute("thumb")));
imageLoader2.x = 70;
imageLoader2.y = j * 70 + 5;
imageLoader2.name = xmlList2[j].attribute("source")
addChild(imageLoader2);
imageLoader2.addEventListener(MouseEvent.CLICK, showPicture2);
}
}
function showPicture2(event:MouseEvent):void
{
if(imageLoader!=null)
removeChild(imageLoader)
if(imageLoader2!=null)
removeChild(imageLoader2)
imageLoader2 = new Loader();
imageLoader2.load(new URLRequest(event.target.name));
imageLoader2.x = 200;
addChild(imageLoader2);
addChild(imageLoader);
}
If I didn't add the second addChild to each function, it returned an error for it being undefined.