<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="init()"> <s:layout> <s:HorizontalLayout/> </s:layout> <fx:Script> <![CDATA[ import mx.binding.utils.ChangeWatcher; import mx.controls.Alert; import mx.events.FlexEvent; protected var _watcher:ChangeWatcher; protected function init():void { toggleWatch(); } private function toggleWatch():void { if(_watcher && _watcher.isWatching()){ _watcher.unwatch(); toogleButton.label = "Watch"; }else{ _watcher = ChangeWatcher.watch(inputFiled, "text", onTextChange); toogleButton.label ="Stop Watching"; } } private function onTextChange(event:Event):void { myLabel.text = inputFiled.text; } ]]> </fx:Script> <s:Label id="myLabel"/> <s:TextInput id="inputFiled" text="start text"/> <s:Button id="toogleButton" label="Watch Text" click="toggleWatch()"/> </s:Application>