-
xml help
I am having a problem with the onLoad function for xml. I load the xml fine I can travers it and get the data from the xml. but when I want to use it outside the function it does not exist.
Code:
eventsXML = new XML();
eventsXML.load('events.xml');
eventsXML.onLoad = function(success) {
if (success) {
bob="ADSF";
trace("inside "+bob);
}
};
trace("outside "+bob);
ok this the code I have. Assume the xml loads fine. It will trace bob "inside" fine. However it will not trace bob "outside". I have tried setting bob to _root. this, return, I cant figure it out. how do I get the date outside that fucntion so I can use it in the rest of the movie
-
See-n-reMember
'bob' is a var created within the fxn, so it's scope is within that fxn.
don't you want to access eventsXML anyway?
Code:
trace("outside "+bob);
trace("eventsXML: ");
trace(eventsXML);
-
I do I just put a simplified code to display the proble. Once I access eventsXML I will be taking values from the xml and assigning them to movieclips and other variables in the movie. but as you see I cant get it out of that funcion if I try to trace bob from any where but in the function it returns nothing. same goes when I set variables from the xml I cant get them out of that function to use.
-
See-n-reMember
got fla?
if I try to trace bob from any where but in the function it returns nothing.
you could establish 'bob' as a _global var on creation...
Code:
_global.bob = "ADSF";
// or _global.bob = _root.eventsXML.bob
// if bob is in the XML file
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|