Omar, look again into the replies on your "Loading xml in AS 2" thread. XML loading is a _non_blocking_ _asynchronous_ process.
Attila =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From: Omar Fouad <[EMAIL PROTECTED]> To: flashcoders@chattyfig.figleaf.com <flashcoders@chattyfig.figleaf.com> Date: Sunday, August 5, 2007, 12:40:46 PM Subject: [Flashcoders] public variable tracing inside class only.. --====----====----====----====----====----====----====----====----====----===-- here is the whole code import omarfouad.UT.Delegate; class Xm { public var currentFile:XML = new XML(); public var CompanySorts:Array = new Array(); private var CompanyA:Array = new Array(); private var ActivityA:Array = new Array(); private var LocationA:Array = new Array(); public function Xm(path) { var xmlFile:XML = new XML(); xmlFile.ignoreWhite = true; xmlFile.onLoad = Delegate.create(this, onLoad); xmlFile.load(path); this.currentFile = xmlFile; } private function onLoad(success) { if(success) { trace("xml File Successfully Loaded..."); getCoreNodes(); }else{ trace("Cannot Load Xml File..."); } } private function totalNodes():Number { var totalNodes = currentFile.childNodes[0].childNodes.length; return totalNodes; } private function getCoreNodes () { for (var i:Number=0;i<totalNodes();i++) { CompanyA[i] = currentFile.childNodes [0].childNodes[i].childNodes[0].childNodes[0].nodeValue; } for (var i:Number=0;i<totalNodes();i++) { LocationA[i] = currentFile.childNodes [0].childNodes[i].childNodes[6].childNodes[0].nodeValue; } for (var i:Number=0;i<totalNodes();i++) { ActivityA[i] = currentFile.childNodes [0].childNodes[i].childNodes[7].childNodes[0].nodeValue; }; }; private function contains(str:String,value:String):Boolean { var ind = (str.indexOf(value)); if(ind == 0) { return true; }else{ return false; }; }; public function companySearch(criteria:String) { trace("Searching"); var totalCompanies:Number = CompanyA.length; for (var i:Number = 0; i<totalCompanies;i++) { if(this.contains(CompanyA[i], criteria)==true) { CompanySorts.push(CompanyA[i]); }; }; //trace(CompanySorts); it traces fine but let's omit it }; }; in Main.as class Main { static function main() { var a:Xm = new Xm("data.xml"); a.companySearch("Demo"); trace(a.CompanySorts);// this one doesnt trace (the same one on the Xm Class) - it gets an error *node "message" value not found* }; }; is there something wrong? -- Omar M. Fouad - Digital Emotions http://www.omarfouad.net +2010 - 2346633 - +2012 - 2644441 _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com