The only time I really use watch is when extending the MovieClip class and have 
a need to know when a built-in property changes, 
like MovieClip.enabled

class Comp extends MovieClip {

    private var __enabled:Boolean = true;

    function Comp {
        watch("enabled", setEnabled);
    }

    private function setEnabled(prop:String, oldVal:Boolean, 
newVal:Boolean):Boolean {
        __enabled = newVal;
        // do some stuff when enabled changed

        return newVal;
    }
}

regards,
Muzak

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: Saturday, August 11, 2007 12:06 PM
> To: flashcoders
> Subject: [Flashcoders] Q:Watch vs listener/broadcaster
>
> Hi
> I'm aware of watch, but have never really used it.
> I was wondering if perhaps I am missing out on a really useful tool.
>
> Can someone  give me an example of when it would make sense to use watch
> instead of setting up a listener broadcaster?
>


_______________________________________________
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