One last time and then I abandon this idea of importing XML files forever
I have attached a sample .fla file plus folders with the other files in the Variables not found only on âsimulate downloadâ post if you want to try running it.
There are 42 XML text files and 42 buttons on stage. In âTest Movieâ all 42 external XML files load perfectly every time - switch to âSimulate Downloadâ and keep clicking. It wonât take long to âbreak itâ and an âundefinedâ will appear. But if you keep clicking, the same text will be defined on the next time around - so this isnât simply a case of the array not being created properly.
This is the frame in the preloader that creates the array that holds the XML files - it loops until they are all loaded - the counter is set and incremented in the other preloader frames:
function loadXML(loaded) {
if (loaded) {
//loops back to load all text
var xnRootNode:XMLNode = this;
**myText[nCounter] = xnRootNode; **
gotoAndPlay(next);
}
}
var xmlData:XML = new XML();
xmlData.ignoreWhite = true;
xmlData.load(allText[nCounter], allPics[nCounter] );
xmlData.onLoad = loadXML;
This is the line of code that gets the XML content when a button is clicked - itâs in a mc (âstageContent_mcâ) to make it available globally, therefore â_root.â is in the line below. This is definitely where âundefinedâ happens - in the code that grabs the XML content from the array, right before itâs dynamically put into the text field.
textForStage = _root.myText[textNum];
âtextNumâ will never fail to show the number clicked when âundefinedâ appears - but âtextForStageâ which is the actual text in the array will show âundefinedâ in the output window.
Any ideas on how to solve this (after a year) would be GREATLY appreciated.
Thanks
Charles
P.S. Any idea why the gifs are actually not loading INTO the .fla file? There is a definite lag time when using real gifs with larger file size.)