Log in

View Full Version : XML wrong image



nate51
01-15-2010, 02:36 PM
I have XML working great, the button gets labelled properly and the description is proper but for some reason my main image skips to the next image in the XML.

This is my AS 2.0

myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
if(success) {
//process data
allGalleryData = this.firstChild.childNodes;
for (i=0; i<allGalleryData.length; i++) {
newPiece = sliderHolder_mc.slider_mc.attachMovie('template', 'piece'+i, i);
newPiece._x = i*newPiece._width;
newPiece.heading_txt.text = allGalleryData[i].firstChild.firstChild;
newPiece.desc_txt.text = allGalleryData[i].firstChild.nextSibling.firstChild;

newBut.imageName = allGalleryData[i].firstChild.nextSibling.nextSibling.firstChild;
newBut = _root.attachMovie('numTemplate', 'num'+i, i);
newBut._x = sliderHolder_mc._x+sliderHolder_mc._height;
newBut._y = (i*newBut._height)+sliderHolder_mc._y;
newBut._x = 300;
newBut.myNum = i;
newBut.num_txt.text = allGalleryData[i].firstChild.firstChild;
newBut.onRelease = function() {
loadNewImage('images/'+this.imageName);
targX = 0-(this.myNum*200);
};
}
targX = 0;
sliderHolder_mc.slider_mc.onEnterFrame = function() {
this._x -= (this._x-targX)/5;
};
} else {
trace('file is missing');
}
};
myXML.load('xml/images.xml');


preloader_mc._alpha = 0;
function loadNewImage(imageName) {

nextImage = imageName;
bigImage_mc.onEnterFrame = function() {

if (this._alpha>0) {
this._alpha -= 10;
} else {

this.loadMovie(nextImage);
setTimeout(preload,500)
this.onEnterFrame = null;

}
};
}

function preload(){
preloader_mc.onEnterFrame = function() {
l = bigImage_mc.getBytesLoaded();
t = bigImage_mc.getBytesTotal();
p = Math.round((l/t)*100);
if (p<100) {
if (this._alpha<100) {
this._alpha += 20;

}
this.gotoAndStop(p);
} else {
this.gotoAndStop(100)
if (this._alpha>0) {
this._alpha -= 20;


} else {

fadeIn();
this.onEnterFrame = null;

}
}

};
}


function fadeIn() {

bigImage_mc.onEnterFrame = function() {

if (this._alpha<100) {
this._alpha += 10;
} else {

this.onEnterFrame = null;
}
};
}

Does anyone see what I am doing wrong here?