OK, I have another problem with my XML driven gallery (non-Kirupa).
I have an AttachMovie line that then attaches a line of code to open up a window with the picture taken from the XML file.
Here’s my code:
// initialize variables and arrays
_root.imagesFilename = new Array();
_root.currentImage = 0;
// define functions
function pushArray() {
_root.totalImages = objXML.firstChild.childNodes.length;
for (var count = 0; count < _root.totalImages; count++) {
nodeObj = objXML.firstChild.childNodes[count];
_root.imagesFilename[count] = nodeObj.attributes.imageFilename;
_root.imagesWidth[count] = nodeObj.attributes.imageWidth;
_root.imagesHeight[count] = nodeObj.attributes.imageHeight;
}
}
function loadXML(success) {
if (success) {
pushArray();
showNextPics();
_root.prevButton._visible = false;
} else {
}
}
function showNextPics() {
_root.prevButton._visible = true;
for (i=0; i < 999; i++) {
_root["image"+i].removeMovieClip();
}
xpos = 0;
ypos = 0;
for (i=_root.currentImage; i < _root.currentImage+6; i++) {
if (i < _root.totalImages) {
_root.attachMovie("pictureClip","image"+i,i);
_root["image"+i].pictureFrame.loadMovie(_root.imagesFilename*);
_root["image"+i].pictureFrame.picNumber.text = i;
trace(i);
_root["image"+i].onRelease = function() {
getURL ("JavaScript:openWin('"+_root.imagesFilename*+"','800','300')");
}
_root["image"+i]._x = xpos;
_root["image"+i]._y = ypos;
xpos += 160;
if (xpos > 160) {
xpos = 0;
ypos += 110;
}
} else {
_root.nextButton._visible = false;
}
}
_root.currentImage += 6;
if (i >= _root.totalImages) {
_root.nextButton._visible = false;
}
}
function showPrevPics() {
_root.nextButton._visible = true;
for (i=0; i < 999; i++) {
_root["image"+i].removeMovieClip();
}
xpos = 0;
ypos = 0;
for (i=_root.currentImage-12; i < _root.currentImage-6; i++) {
_root.attachMovie("pictureClip","image"+i,i);
_root["image"+i].pictureFrame.loadMovie(_root.imagesFilename*);
_root["image"+i].pictureFrame.picNumber.text = i;
_root["image"+i].onRelease = function() {
getURL ("JavaScript:openWin('"+_root.imagesFilename*+"','800','300')");
}
_root["image"+i]._x = xpos;
_root["image"+i]._y = ypos;
xpos += 160;
if (xpos > 160) {
xpos = 0;
ypos += 110;
}
if (i == 0) {
_root.prevButton._visible = false;
}
}
_root.currentImage -= 6;
if (i < -1) {
_root.prevButton._visible = false;
}
}
// load XML doc
objXML = new XML();
objXML.onLoad = loadXML;
objXML.ignoreWhite = true;
objXML.load("imageList.xml");
The problem is, I can click on any of the pictures from the first page of six pictures and the window comes up fine with the picture but when I go to the next page (using showNextPics()), the next set of pictures come up but when I click on them, I get the old “undefined” error like it can’t find the picturename.
Has anyone got any ideas on this?
Many thanks in advance,
Dave