i have my sweet gallery…
It loads up several thumbnails, each one of them has an image (duh) and a caption. Being buttons, you click on them and details window comes up.
So far so good, everything works.
By the way, the whole thing works via xml, thumbnails are duplicated according to XML with attachMovie().
So, the xml looks similar to this:
<pic url="acd.jpg" caption="bcd" details="blah" imageurl="js.jpg"/>
before posting the AS2 code, the problem is that in the details window, it’ll only show the last node in the xml.
Say that the xml looked like this:
<pic url="acd.jpg" caption="bcd" details="detail 1" imageurl="1.jpg"/>
<pic url="acd.jpg" caption="bcd" details="detail 2" imageurl="2.jpg"/>
Flash will only display detail 2 and 2.jpg, no matter what thumbnail I’m clicking on…
So I guess I need to have flash know which button i’m pressing and have it show the right thing, but… how…
here’s the code:
stop();
//details_mc._visible = false;
_global.temp_root = this;
var xml_OBJ:XML = new XML();
temp_root.xml_OBJ.ignoreWhite = true;
var urls:Array = new Array();
var captions:Array = new Array();
var details:Array = new Array();
var detailsImage:Array = new Array();
//var who_is_on:Number;
temp_root.xml_OBJ.onLoad = function() {
var photos:Array = this.firstChild.childNodes;
var x_check:Number = 0;
var y_check:Number = 0;
for (var i:Number=0; i<photos.length; i++) {
temp_root.urls.push(photos*.attributes.url);
temp_root.captions.push(photos*.attributes.caption);
temp_root.details.push(photos*.attributes.details);
temp_root.detailsImage.push(photos*.attributes.url2)
temp_root.createEmptyMovieClip("container_MC", temp_root.getNextHighestDepth());
temp_root.container_MC.attachMovie("pic_MC", "pic_"+i, temp_root.container_MC.getNextHighestDepth());
temp_root.createEmptyMovieClip("details_container_MC", temp_root.getNextHighestDepth());
temp_root.details_container_MC.attachMovie("details_MC", "details_"+i, temp_root.getNextHighestDepth());
temp_root.details_container_MC._alpha = 0;
temp_root.container_MC["pic_"+i]._x = x_check*160;
temp_root.container_MC["pic_"+i]._y = y_check;
if(x_check>=2){
x_check = 0;
y_check+=120;
} else {
x_check++;
}
temp_root.container_MC["pic_"+i].thumbnail.loadMovie(temp_root.urls*);
temp_root.container_MC["pic_"+i].caption_TX.text = temp_root.captions*;
temp_root.details_container_MC["details_"+i].details_TX.text = temp_root.details*;
temp_root.details_container_MC["details_"+i].detailPic.loadMovie(temp_root.detailsImage*);
pic_MC.onPress = function () {
trace(detailsImage*);
}
//trace(photos*);
}
};
temp_root.xml_OBJ.load("XML/photo.xml");
posted the whole thing, might help…
anyone has any idea how to solve this? 