When u use  Changewatcher, the host must expose a data-binding event
on the property.
this will be acheived if the property access specifer is public

So just change

[Bindable] public var value:Number=0;

Also make use ChangeWatcher.watch(..) to check whether binding is
possible

if(ChangeWatcher.canWatch(this, "value"))
                        {
                                Alert.show("can watch")
                        ChangeWatcher.watch(this, "value", handler);
                 }

On Dec 21, 4:45 pm, Manfred <[email protected]> wrote:
> Hi!
>
> How can i use the ChangeWatcher class with variables of type integer
> or Number?
> Below is the example:
>
> <mx:Script>
>
>         <![CDATA[
>                 import mx.controls.Alert;
>                 import mx.binding.utils.ChangeWatcher;
>
>                 [Bindable]
>                 private var value:Number;
>
>                 private function init():void{
>                         ChangeWatcher.watch(this, 'value', handler);
>                 }
>
>                 private function changeValue():void{
>                         value = value  + 1;
>                 }
>
>                 private function handler():void{
>                         Alert.show("changed")
>                 }
>
>         ]]>
> </mx:Script>
>
> <mx:Button click="changeValue()"/>
>
> But nothing happens.. What should i do?
>
> Many thanks in advance.
>
> Manfred

--

You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.


Reply via email to