Re: [Flashcoders] Problem with cascading functions within a class

2007-02-15 Thread Omar Fouad
mmm still don't get the delegate concept On 2/15/07, Muzak [EMAIL PROTECTED] wrote: Look into the Delegate class -- mx.utils.Delegate import mx.utils.Delegate; class YourClass { private var __rawHTML:String; public function grabHTML():Void { var html_data:LoadVars = new

Re: [Flashcoders] Problem with cascading functions within a class

2007-02-15 Thread Andy Herrman
So, the problem with your initial code is that the scope of the function (what `this` refers to) is not your class, but instead is the scope of the object it's being called on. So, essentially your code is trying to call `html_data.doSomething()`, which doesn't exist. You really want it to be

Re: [Flashcoders] Problem with cascading functions within a class

2007-02-15 Thread T. Michael Keesey
Incidentally, in AS3 all functions preserve their scope, so Delegate is no longer needed. (Yay!) But, in the meantime, Delegate is the best solution to the problem of associating a function call with a scope. Also worth mentioning is that since static functions have no scope, you don't need to

Re: [Flashcoders] Problem with cascading functions within a class

2007-02-14 Thread Iv
Hello Andrew, public function grabHTML():Void { var html_data:LoadVars = new LoadVars(); var grabber = this; html_data.onData = function():Void { grabber.doSomething(); };

Re: [Flashcoders] Problem with cascading functions within a class

2007-02-14 Thread T. Michael Keesey
Delegate! import mx.utils.Delegate; // ... public function grabHTML():Void { var html_data:LoadVars = new LoadVars(); html_data.onData = Delegate.create(this, doSomething); html_data.load(http://somesite.ca/some.html;); } On 2/14/07, Andrew Murphy [EMAIL PROTECTED] wrote: I'm

RE: [Flashcoders] Problem with cascading functions within a class

2007-02-14 Thread Andrew Murphy
*goes to read up on Delegate* Thank you. :) -[a]- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of T. Michael Keesey Sent: February 14, 2007 9:20 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Problem with cascading functions within a class

Re: [Flashcoders] Problem with cascading functions within a class

2007-02-14 Thread Muzak
Look into the Delegate class -- mx.utils.Delegate import mx.utils.Delegate; class YourClass { private var __rawHTML:String; public function grabHTML():Void { var html_data:LoadVars = new LoadVars(); html_data.onData = Delegate.create(this, this.htmlDataHandler);