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);
        html_data.load("http://somesite.ca/some.html";);
    }

    private function htmlDataHandler(rawData:String):Void {
        this.__rawHTML = rawData;
        this.doSomething();
    }

    private function doSomething():Void {
        // do something with __rawHTML
    }
}

regards,
Muzak

----- Original Message ----- 
From: "Andrew Murphy" <[EMAIL PROTECTED]>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Thursday, February 15, 2007 2:48 AM
Subject: [Flashcoders] Problem with cascading functions within a class


Im programming a class which includes something like following methods:


// grab some .html

public function grabHTML():Void {

            // loads the .html

            var html_data:LoadVars = new LoadVars();

            // once the .html is loaded

            html_data.onData = function():Void {

                        // run doSomething()

                        doSomething();

            };

            html_data.load("http://somesite.ca/some.html";);

};

// does something after the .html has been loaded

public function doSomething():Void {

            trace("doing something");

};











Unfortunately the second function doSomething never happens.  Can anyone
clue me in as to what Im doing wrong..?



Thank you. :)



-[a]-




-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.17.39/686 - Release Date: 14/02/2007
7:54 AM

_______________________________________________
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