A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: xml help

Hybrid View

  1. #1
    Senior Member
    Join Date
    Aug 2000
    Posts
    173

    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

  2. #2
    See-n-reMember azwaldo's Avatar
    Join Date
    Mar 2003
    Location
    Sonoran Desert
    Posts
    745
    '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);
    __azwaldo__

  3. #3
    Senior Member
    Join Date
    Aug 2000
    Posts
    173
    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.

  4. #4
    See-n-reMember azwaldo's Avatar
    Join Date
    Mar 2003
    Location
    Sonoran Desert
    Posts
    745

    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
    __azwaldo__

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center