use Delegate -======================== import mx.utils.Delegate; var a:Array = new Array(); .. .. main.onLoad = Delegate.create(this, populateXML);
function populateXML():Void { trace(a); } Goodluck, On 12/7/05, Flash guru <[EMAIL PROTECTED]> wrote: > 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 > -- Ramon Miguel M. Tayag _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders