Hi guys,
Here is the problem. I have decided to build my own XML gallery. The flash loops through, checks how many images there are and duplicates a movie clip
to match the amount of photos on that page. The duplicated mc’s are given the names “hello”+z, but when trying to load the images they dont want to load(please note, I have taken the code that loads the dynamic images out).
When i trace “hello”+z, it gives me an undefined, and I believe this is where the problem is. Can anyone tell me y?
Here is the code:
//builds an array for the amount of XML nodes
function loadXML(loaded) {
var arPhoto =[]
if (loaded) {
xmlNode = this.firstChild;
caption = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
caption* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
arPhoto* = caption*;
}
//declaring the variables for the x and y coordinates
var movie_clip = i;
var myX = -176.5;
var myY = -122.2;
for(z=0; z<i; z++){
//modulus(%), this checks that there are only three empty movie clips in a row. Sets the position of the blocks,
//so they are nicely spaced.
if(z%3 == 0){
myX = 33.4;
myY = myY + 144;
}else{
myX = myX + 209.9;
}
duplicateMovieClip("white_strokes","hello"+z,z);
setProperty("hello"+z,_x,myX);
setProperty("hello"+z,_y,myY);
}
} else {
content = "file not loaded!";
}
trace(this["hello"+ String(z)].toString);
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("pictures.xml");