whoknows361
Technical User
hello all. I have successful code at this point - however, there is one thing that continues to occur that I can't figure out how to fix. IF you go to:
you will see that for about 3 seconds before all of my images load via my arrays, you see the frame in the upper left hand corner of the movie and then it dissapears.
Here is my code:
Is there something I can change in the above code so that this frame being visible for a couple of seconds doesn't occur? Thanks in advance.
Jonathan
you will see that for about 3 seconds before all of my images load via my arrays, you see the frame in the upper left hand corner of the movie and then it dissapears.
Here is my code:
Code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = []; //creating array for xml data image
description = []; //creating array for xml data description
price = []; //creating array for xml data price
bigimage =[];
fulldescription = [];
match1smallpic = [];
match1bigpic = [];
match1price = [];
match1description = [];
match1fulldescription = [];
match2smallpic = [];
match2bigpic = [];
match2price = [];
match2description = [];
match2fulldescription = [];
_root.total = xmlNode.childNodes.length; //used to make sure go through all nodes //don't change _root value
for (i=0; i<_root.total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
price[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
bigimage[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
fulldescription[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
match1smallpic[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
match1bigpic[i] = xmlNode.childNodes[i].childNodes[6].firstChild.nodeValue;
match1price[i] = xmlNode.childNodes[i].childNodes[7].firstChild.nodeValue;
match1description[i] = xmlNode.childNodes[i].childNodes[8].firstChild.nodeValue;
match1fulldescription[i] = xmlNode.childNodes[i].childNodes[9].firstChild.nodeValue;
match2smallpic[i] = xmlNode.childNodes[i].childNodes[10].firstChild.nodeValue;
match2bigpic[i] = xmlNode.childNodes[i].childNodes[11].firstChild.nodeValue;
match2price[i] = xmlNode.childNodes[i].childNodes[12].firstChild.nodeValue;
match2description[i] = xmlNode.childNodes[i].childNodes[13].firstChild.nodeValue;
match2fulldescription[i] = xmlNode.childNodes[i].childNodes[14].firstChild.nodeValue;
//just loaded all data into the arrays - notice the childnodes value for the level of
//each item//
thumbnails_fn(i); //this function does all the actions we want//
}
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
function thumbnails_fn(k) {
contentMain.attachMovie("text", "text", 1);
contentMain.text._x = 25;
contentMain.text._y = 25;
itemname = "item" + k; //so we know what number item it is on//
contentMain.attachMovie("item", itemname, contentMain.getNextHighestDepth());
//item is the name of the mc that we want our pics/text to load into//
//it loads into contentMain for scrollbar - must use next highest depth.//
tlistener = new Object(); //this function is called after pic is loaded into first "item//
tlistener.onLoadInit = function(target_mc) { //target mc is contentMain.item#.picture
//following if statements are for the number of items per line & placing next line at correct place//
if (k <= 2) { //3 is the number of items per line, remember it starts at 0 so 3 equals 4 item mc's per line//
target_mc._parent._x = 15+(eval(contentMain["item"+k])._width+5)*k; //15 sets the spacing between "item" mc's//
target_mc._parent._y = 150;//offsetting the first row (moving down) so that my header can be seen.
}
else if (k >=3 && k <=5) {//second line starts at fifth item mc//
target_mc._parent._y = 325; //175 (150 (initial setting) + 175) is the amount of spacing on between levels (y value)//
target_mc._parent._x = 15+(eval(contentMain["item"+k])._width+5)*(k-3); //15 is spacing between mc's & 4 is the number of item mc's on first level//
}
else if (k >=6 && k <=8) {
target_mc._parent._y = 500;
target_mc._parent._x = 15+(eval(contentMain["item"+k])._width+5)*(k-6);
}
else if(k>=9 && k<=11) {
target_mc._parent._y = 675;
target_mc._parent._x = 15+(eval(contentMain["item"+k])._width+5)*(k-9);
}
else if(k>=12 && k<=14) {
target_mc._parent._y = 850;
target_mc._parent._x = 15+(eval(contentMain["item"+k])._width+5)*(k-12);
}
else if(k>=15 && k<=18) {
target_mc._parent._y = 1025;
target_mc._parent._x = 15+(eval(contentMain["item"+k])._width+5)*(k-15);
}
target_mc._parent.description.text = description[k];//adds the description from xml
target_mc._parent.price.text = "$" + price[k];//adds price from xml
target_mc._parent.onRelease = function() {
_root.itemchoicenumber = k; //do not change root value!
_root.bigpicchoice = bigimage[k];
_root.gotoAndStop(10);
}
target_mc._parent.onRollOver = function() {
this._alpha = 50;
this._width = this._width + 5;
this._height = this._height +5;
};
target_mc._parent.onRollOut = function() {
this._alpha = 100;
this._width = this._width - 5;
this._height = this._height - 5;
};
};
image_mcl = new MovieClipLoader(); //these 3 lines load the pic into the "item" mc, into the "picture"mc for placement.
image_mcl.addListener(tlistener); //also it calls the tlistener function where all actions for specific movie is held.
image_mcl.loadClip(image[k], contentMain[itemname].picture);
}
Is there something I can change in the above code so that this frame being visible for a couple of seconds doesn't occur? Thanks in advance.
Jonathan