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. Look up the
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

Reply via email to