So I'm trying to fix the site at http://intljewelry.com/index1.html - what's happening is that when you first visit the site, several of the areas with information that is loaded from an XML file are not showing up. However if you reload the page, they show up just fine. I'm guessing this is something in the order of functions in my AS, but as somebody else wrote the original code I can't figure it out.
Here is the current code:
Code:
var mainXMLObj:XML = new XML();
var collXMLObj:XML = new XML();
mainXMLObj.ignoreWhite = true;
collXMLObj.ignoreWhite = true;
_global.mainDataArr = new Array();
_global.collDataArr = new Array();
mainHolder.loadMovie("book.swf");
display_mc.loadMovie("display.swf");
this.backgroundFrame.innerFrame.chickHolder.loadMovie("chicks.swf");
parseMainXML = function(bSuccess:Boolean) {
if (bSuccess = true) {
var lngth = mainXMLObj.firstChild.childNodes.length;
for (i = 0; i < lngth; i++) {
var dataHold = new Object;
dataHold.attributes = mainXMLObj.firstChild.firstChild.attributes
dataHold.name = mainXMLObj.firstChild.firstChild.firstChild.childNodes[0].nodeValue;
dataHold.path = mainXMLObj.firstChild.firstChild.childNodes[1].firstChild.nodeValue;
dataHold.description = mainXMLObj.firstChild.firstChild.childNodes[2].firstChild.nodeValue;
mainDataArr[i] = dataHold;
mainXMLObj.firstChild.firstChild.removeNode();
dataHold = null;
}
delete mainXMLObj;
mcholder._alpha = 0;
mcholder.loadMovie(mainDataArr[0].attributes.URL + "/" + "scroller.swf");
_global.clrInt = setInterval(fadeIn, 10);
butt_hold.loadMovie("buttonSet.swf");
}
else {
}
}
parseCollXML = function(bSuccess:Boolean) {
if (bSuccess = true) {
var lngth = collXMLObj.firstChild.childNodes.length;
for (i = 0; i < lngth; i++) {
var dataHold = new Object;
dataHold.collName = collXMLObj.firstChild.childNodes[i].attributes.collName;
dataHold.collMain = collXMLObj.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue;
dataHold.collThumbs = collXMLObj.firstChild.childNodes[i].childNodes[1].firstChild.nodeValue;
dataHold.collPrice = collXMLObj.firstChild.childNodes[i].childNodes[2].firstChild.nodeValue;
dataHold.collSalePrice = collXMLObj.firstChild.childNodes[i].childNodes[3].firstChild.nodeValue;
dataHold.collDescription = collXMLObj.firstChild.childNodes[i].childNodes[4].firstChild.nodeValue;
dataHold.collInventory = collXMLObj.firstChild.childNodes[i].childNodes[5].firstChild.nodeValue;
collDataArr[i] = dataHold;
mainXMLObj.firstChild.firstChild.removeNode();
dataHold = null;
}
delete mainXMLObj;
}
else {
}
}
mainXMLObj.onLoad = parseMainXML;
collXMLObj.onLoad = parseCollXML;
_global.siteIndex = 0;
text1_mc.myText.autoSize = true;
mainXMLObj.load("mainSiteData.xml");
collXMLObj.load("siteCollection.xml");
var cssSheet = new TextField.StyleSheet();
cssSheet.load("Styles.css");
text1_mc.myText.styleSheet = cssSheet;
function LoadFunct() {
var lod = _root.mainHolder.getBytesLoaded();
var tot = _root.mainHolder.getBytesTotal();
var percent = lod/tot;
_root.mainHolder.progressBar.gotoAndStop(percent);
if (percent == 1) {
delete this.onEnterFrame;
removeMovieClip(_root.mainHolder.progressBar);
}
}
_global.loadFile = function(oEvent:MovieClip, mov:String) {
mainHolder.attachMovie("progressBar", "progressBar", mainHolder.getNextHighestDepth(), {_x:50, _y:50});
mainHolder.loadMovie(mov);
mainHolder.picture.front.holder.loadMovie(mov);
mainHolder.buyNow.front.holder.smallPictHold.loadMovie(mov);
};
stop();
You can also download the working files here: http://www.intljewelry.com/IJC_Working.zip
Thanks so much in advance!