Hi all - been rather dumbfounded by the following behaviour in F6MX when looping through XML. My loop is similar to this
If this line runs
//trace ("type: "+itemType+", x: "+itemX+", y: "+itemY+", textid: "+itemTextID+", imageid: "+itemImageID);
it successflly writes out all items in a list
When this line runs
trace ("x : "+itemX+", y: "+itemY+", textid: "+itemTextID+", imageid: "+itemImageID);
it successfully writes out the list of items as it goes through.
However ... when the onRollOver or onRelease actions fire off - they all use the variables associated with the final one. ie - if the final one was using textID 2 then all of them use textID 2. Text_Arr is just a number=value array of text entries to use. I've narrowed the problem down to it being the last one they always use, but nothing I do seems to make them use the right one. Any ideas? :/
_________________________________
Leozack
Code:
do {
//trace ("nodename = "+itemNode.nodeName);
if (itemNode.nodeName == "item") {
itemType = itemX = itemY= itemTextID = itemImageID = itemURL = "";
itemNum ++;
itemType = Number(itemNode.attributes.type);
itemX = Number(itemNode.attributes.x);
itemY = Number(itemNode.attributes.y);
//if (itemNode.attributes.textid != null) { itemTextID = Number(itemNode.attributes.textid); } else { itemTextID = ""; }
itemTextID = Number(itemNode.attributes.textid);
//if (itemNode.attributes.imageid != null) { itemImageID = Number(itemNode.attributes.imageid); } else { itemImageID = ""; }
itemImageID = Number(itemNode.attributes.imageid);
//if (itemNode.attributes.url != null) { itemURL = itemNode.attributes.url; } else { itemURL = ""; }
itemURL = itemNode.attributes.url;
//trace ("type: "+itemType+", x: "+itemX+", y: "+itemY+", textid: "+itemTextID+", imageid: "+itemImageID);
switch(itemType){
case 1: // Infopoint
var thisItem_mc = imgItemsMC.attachMovie("info_mc", "Item_mc"+itemNum,itemNum);
thisItem_mc._xscale = thisItem_mc._yscale = iconScale;
thisItem_mc._alpha = iconAlpha;
thisItem_mc._x = itemX;
thisItem_mc._y = itemY;
trace ("x : "+itemX+", y: "+itemY+", textid: "+itemTextID+", imageid: "+itemImageID);
if (bInfoBox) {
thisItem_mc.onRollOver = thisItem_mc.onDragOver = function(){
SetText(infoMC.info_text, Text_arr[itemTextID], infoTF);
}
thisItem_mc.onRollOut = thisItem_mc.onDragOut = function(){
SetText(infoMC.info_text, imageNode.firstChild.firstChild, infoTF);
}
}
break;
//trace ("type: "+itemType+", x: "+itemX+", y: "+itemY+", textid: "+itemTextID+", imageid: "+itemImageID);
it successflly writes out all items in a list
When this line runs
trace ("x : "+itemX+", y: "+itemY+", textid: "+itemTextID+", imageid: "+itemImageID);
it successfully writes out the list of items as it goes through.
However ... when the onRollOver or onRelease actions fire off - they all use the variables associated with the final one. ie - if the final one was using textID 2 then all of them use textID 2. Text_Arr is just a number=value array of text entries to use. I've narrowed the problem down to it being the last one they always use, but nothing I do seems to make them use the right one. Any ideas? :/
_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);