Just to be clear about Delegate, all it does is create a reference to a function but in a specified scope. AFAIK there is no restriction as to where you "can" use it. Thus i use it all over the place ;P I'm not sure if that's good practise but by god it's made life easier.
- A dc wrote: > hi - > >> It's a scoping issue. Your XML object is calling the drawMenu function >> in its own scope and not within the scope of the WireMenu instance. >> Use the delegate class when assigning your onLoad handler. > > my understanding is that the Delegate class can only be used where an > addEventListener could be used; it makes the dispatching object a > little clearer. > > however in this case, > > xmlObj = new XML(); > xmlObj.addEventListener(this.onLoad, this); > >>> There is no method with the name 'addEventListener'. > > fails, since there is no "addEventListener" for an XML object... > > the question is how to pass a calling object reference to an > XML.onLoad event... > > within its scope that event only knows it is part of an XMLObject. > but there must be some way to pass an object handler to that event? > > or does this onLoad have to just sit outside the object, like a dumb > global function? > > /dc > > On 15/09/06, Pranav Negandhi <[EMAIL PROTECTED]> wrote: >> >> documentation on the Delegate class for syntax and arguments. >> >> >> Regards, >> Pranav Negandhi >> Fractal | ink >> O: 91-22-6660-3682 >> M: 91-98211-73656 >> www.fractalink.com >> >> >> > -----Original Message----- >> > From: [EMAIL PROTECTED] >> > [mailto:[EMAIL PROTECTED] On Behalf Of dc >> > Sent: Friday, 15 September 2006 18:02 >> > To: Flashcoders mailing list >> > Subject: [Flashcoders] loading xml >> > >> > >> > hiya - >> > >> > I'm trying to load some xml from within an object. a little confused >> > how to handle callbacks. >> > >> > inside the class (constructor) i create an XML object, call >> > its load func. >> > >> > class WireMenu { >> > private var myXML:XML; >> > >> > public function WireMenu(xmlPath){ >> > myXML = new XML(); >> > myXML.ignoreWhite = true; >> > myXML.onLoad = this.drawMenu; >> > myXML.load(xmlPath); >> > >> > } >> > >> > >> > all good, but the function that gets called back (drawMenu) only gets >> > passed a boolean/sucess flag. how do i get at the loaded XML data? >> > >> > the data also doesnt seem to be within the myXML object either... >> > that method is like this: >> > >> > function drawMenu(p1, p2) { >> > _root.dbg.text = "drawing"; >> > trace("WireMenu.drawMenu()"); >> > trace(myXML.firstChild); // null >> > trace(p1); // true: so we were able to >> > load, but where did it go? >> > trace(p2); // null >> > } >> > >> > tx for any help!! >> > >> > /dc >> > _______________________________________________ >> > 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 >> > > > -- > ------------------------------------------- > David "DC" Collier > mailto:[EMAIL PROTECTED] > +81 (0)80 6521 9559 > skype: callto://d3ntaku > ------------------------------------------- > Pikkle 株式会社 > http://www.pikkle.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