I know this code works, since I used it in another movie. But this time it keeps returning ‘undefined’ everytime you press the buttons, thus not displaying the images as required.
stop();
//
displayImage = function () {
trace(this._parent.target);
_parent.loader.loadMovie('resources/gallery/'+this._parent.target+'.jpg');
};
//
galleryXML = new XML();
galleryXML.ignoreWhite = true;
galleryXML.onLoad = function(OK) {
if (OK) {
//
xmlData = galleryXML.firstChild.childNodes;
for (i=0; i<xmlData.length; i++) {
xmlTemplate = loader.attachMovie('template', 'id'+i, i);
xmlTemplate._x = i*xmlTemplate._width;
//
xmlTemplate.imageHolder.loader.loadMovie('resources/gallery/'+xmlData*.firstChild.nextSibling.nextSibling.nextSibling.firstChild+'_thumb.jpg');
xmlTemplate._global.maxPos = i;
//
xmlTemplate.target = xmlData*.firstChild.nextSibling.nextSibling.nextSibling.firstChild;
xmlTemplate.imageHolder.button.onRelease = displayImage;
}
} else {
trace('ERROR');
}
};
galleryXML.load('content/gallery.xml');
I tried everything, took me hours of tweaking, changing names, _parents, tracing but I still don’t see a problem, what could be wrong? :wasted: