Variable scope...

Try declaring them *outside* the onLoad() function, because those variables
conveniently drift out of scope (release themselves) as the code exits that
function...

Hope this helps...

--
Dok
Skyymap Inc.
770.321.3967 Office
770.321.3454 Fax 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Flash guru
Sent: Wednesday, December 07, 2005 3:20 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] XML question

Hey all,

here's the code i'm working with:

var main:XML = new XML();
main.ignoreWhite =true;
main.onLoad =function(success:Boolean){
 if (success) {
    var developers:Array = this.firstChild.childNodes;
    var siteUrl:Array = new Array();
    var stanceUrl:Array = new Array();
    var introUrl = new Array();
    for (var i=0; i<developers.length; i++){
        siteUrl.push(developers[i].attributes.site);
        stanceUrl.push(developers[i].attributes.stance);
        introUrl.push(developers[i].attributes.intro);
    }
 }
 else{ trace("xml not connected");}
}
main.load("main.xml");

The problem:

Why can't access the arrays out side the onload function? I want the onload
to just populate the arrays, so i can use their contents somewhere else.
Is this an xml thing or am i doing something wrong.  If i trace any of the
arrays out side the onLoad function i get undefined.

Fyi ~ i've already tried making the arrays global, no go that way.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to