Hi, The problem here is scope. When you call parseMessages, you doing it in the scope of the mySocket object (where the method doesn't exist.)
There's a pretty simple workaround for this using the Delegate utility that comes with Flash. At the top of your class file, do this : import mx.utils.Delegate; Change this line: mySocket.onXML = handleIncoming; To this: mySocket.onXML = Delegate.create(this,handleIncoming); And that should solve your problem. Basically you're creating a proxy function on the XMLSocket object that then invokes the handleIncoming function on your OSC object. There are other ways to do this, but I think the Delegate method is generally considered the best practice. Hope that helps, Jim -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of hbruyere Sent: Thursday, November 24, 2005 10:19 PM To: [email protected] Subject: [Flashcoders] OOP newbie question Hi, Here is a OOP newbie question. I have a class (see below).. Everything works fine. but the method "handleIncoming" can not access () or maybe even find) the method "parseMessages". If I give the complete path to the instance of the OSC class (made in my fla - for example "_root.OSC_Obj.parseMessages (xmlIn);" ) it works. How should I code this to make it works ? class OSC { var mySocket : XMLSocket; // // public function OSC () { connect (); } // // function connect () { mySocket = new XMLSocket (); mySocket.onXML = handleIncoming; } // // function handleIncoming (xmlIn) { parseMessages (xmlIn); } // function parseMessages (node) { actions...... } } Thanks for your attention, //h _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

