Not tested (works under ASDT)

function MyClass(){
        socket = new XMLSocket();
                
        var _scope:MyClass = this;
        socket.onData = function(data){
                _scope.parse(data);
        }
 }

On Wed, 01 Mar 2006 09:20:29 -0300, Andreas Rønning <[EMAIL PROTECTED]> wrote:

A quick example class

class MyClass{
        var socket:XMLSocket;
        function parse(data:String):Void{
        }
        function MyClass(){
                socket = new XMLSocket();
                //interesting bit
                socket["creator"]=this;
                socket.onData = function(data){
                        this.creator.parse(data);
                }
        }
}

I know this isn't the best way to do it (hello delegate), but still.
One of the big things in FlashDevelop for me is the dynamic code completion, and when i type "this." in the onData handler, it gives me a list of methods for MyClass, when it should give me methods for socket. Or am i wrong? The scope of handlers confuses me.

- Andreas
_______________________________________________
[email protected]
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



--
_____________
Marcelo Volmaro
_______________________________________________
[email protected]
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