allright um doing it thanks folks... :D On 8/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > sounds like you need to have event listeners and dispatch an event once > the onload is complete, as David was suggesting > > Sean > > > in this case i should call the function and the trace inside the > > onLoad(success) function.. but this is not convenient as in i need to > > manipulate the flow from within the class instance... > > > > private function onLoad(success) { > > if(success) { > > trace("xml File Successfully Loaded..."); > > getCoreNodes(); > > companySearch("Demo"); > > trace(CompanySorts); > > > > }else{ > > trace("Cannot Load Xml File..."); > > } > > } > > > > On 8/5/07, David Ngo <[EMAIL PROTECTED]> wrote: > >> > >> What he means is, your arrays will not populate until after the XML is > >> fully > >> loaded and parsed. So if you're trying to trace or access those arrays, > >> they're going to be null/empty. You'd be better served to either fire > an > >> event once the XML has been parsed, or fire a callback and pass along a > >> reference to the parent class. > >> > >> > >> -----Original Message----- > >> From: [EMAIL PROTECTED] > >> [mailto:[EMAIL PROTECTED] On Behalf Of Omar > >> Fouad > >> Sent: Sunday, August 05, 2007 7:09 AM > >> To: Rákos Attila; flashcoders@chattyfig.figleaf.com > >> Subject: Re: Re[2]: [Flashcoders] public variable tracing inside class > >> only.. > >> > >> actually the xml file is being read as in i can extract vaules thourgh > >> it. > >> > >> On 8/5/07, Omar Fouad <[EMAIL PROTECTED]> wrote: > >> > > >> > i dont get you... > >> > > >> > On 8/5/07, Rákos Attila <[EMAIL PROTECTED]> wrote: > >> > > > >> > > > >> > > 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 > >> > > > >> > > >> > > >> > > >> > -- > >> > Omar M. Fouad - Digital Emotions > >> > http://www.omarfouad.net > >> > > >> > +2010 - 2346633 - +2012 - 2644441 > >> > > >> > >> > >> > >> -- > >> Omar M. Fouad - Digital Emotions > >> http://www.omarfouad.net > >> > >> This e-mail and any attachment is for authorised use by the intended > >> recipient(s) only. It may contain proprietary material, confidential > >> information and/or be subject to legal privilege. It should not be > >> copied, > >> disclosed to, retained or used by, any other party. If you are not an > >> intended recipient then please promptly delete this e-mail and any > >> attachment and all copies and inform the sender. Thank you. > >> > >> _______________________________________________ > >> 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 > >> > > > > > > > > -- > > Omar M. Fouad - Digital Emotions > > http://www.omarfouad.net > > > > This e-mail and any attachment is for authorised use by the intended > > recipient(s) only. It may contain proprietary material, confidential > > information and/or be subject to legal privilege. It should not be > copied, > > disclosed to, retained or used by, any other party. If you are not an > > intended recipient then please promptly delete this e-mail and any > > attachment and all copies and inform the sender. Thank you. > > _______________________________________________ > > 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 >
-- Omar M. Fouad - Digital Emotions http://www.omarfouad.net This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
_______________________________________________ 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