Loading data from xml file...strange conflict?

Hi,

I am loading some data from an xml file into an array in the second frame. In the third frame I am loading data from a text file.

When I go back to the 2nd frame from the third the data no longer seems to be in the array from the xml file.

I am honestly not competely sure that is the problem as things are getting convulated…BUT does anyone see anything inherently wrong with the setup described above?

Thanks,

Fed

Do you use the array in the next frame? If you give the array new value’s you could be popping out the xml data unwittingly. Does everything else work ok? It could be that some other part of your script is unloading the data or messing with the array. If you are editing the array dynamically between frame 2 and 3, make sure that your script is not deleting what is already there to make way for the new data.

Have you tried letting the import xml action run over all frames (on its own actions layer)?

<Do you use the array in the next frame?>
Nope

<Does everything else work ok?>
Yep

<It could be that some other part of your script is unloading the data or messing with the array.>
Ya, that’s what I’m thinking too…but the trick is finding which part

<If you are editing the array dynamically between frame 2 and 3, make sure that your script is not deleting what is already there to make way for the new data.>
not editing the array between frames.

<Have you tried letting the import xml action run over all frames (on its own actions layer)?>
Gave this a try but had not effect…not any worse…but didn’t fix the problem…

Thanks for the suggestions…this one is giving me fits!

I’ve experimented with commenting out everything that is happening in the 3rd frame and the problem persists…

It seems to be an issue with switching frames…Here is the code to load the XML…is there something here that is creating a problem when the timeline jumps to a new frame and back again??

[AS]_root.titles_xml = new XML();
_root.titles_xml.ignoreWhite = true;
_root.titles_xml.onLoad = function(success) {
if (success) {
var gallery = this.firstChild;
for (var i = 0; i<gallery.childNodes.length; i++) {
etArray.push(gallery.childNodes*.attributes.exhibit);
ptArray.push(gallery.childNodes*.attributes.portrait);
}
}
};
_root.titles_xml.load(“titles.xml”);
[/AS]

Include:
[AS]
etArray = new Array();
ptArray = new Array();
[/AS]

I just remembered, but haven’t tried it, that using the “var” keyword defines the variable as a local variable. Once the function is over, the variable no longer exists.

So just drop the “var” keyword from the declaration of the variable “gallery”.

Tried both suggestions and no effect…

don’t think it is a problem with the variables…as there are other local variables defined that work fine when jumping from frame to frame…

this just doesn’t make sense to me. If you go back to frame 2…does it not just re-run that entire frame’s AS including the loading of the XML?..everything else works fine…