<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="/2006/mxml"
layout="absolute" initialize="init();">
<mx:Script>
<!--[CDATA[
import ;
import ;
private var watcher1:ChangeWatcher;
private var watcher2:ChangeWatcher;
/**
* Dynamic binding
* @return void
* **/
private function Binding():void {
//Bind txtInput with ID txt2
//Binding text with txtInput attribute
//TxtInput with monitor ID txt1
//The monitor's attribute is txtInput text
watcher1 = (txt2,"text",txt1,"text");
//Binding txtInput with txtComb
//Binding text with txtInput attribute
//ComboBox with monitor ID of comb
//The monitor attribute is the value of ComboBox
watcher2 = (txtComb,"text",comb,"value");
}
/**
* Unbind
* @return void
* **/
private function UnBinding():void {
//Unbind
();
();
}
]]-->
</mx:Script>
<mx:ApplicationControlBar dock="true">
<mx:Button label="Dynamic Binding" click="Binding();"/>
<mx:Button label="UnBinding();"/>
</mx:ApplicationControlBar>
<mx:VBox width="200" height="200">
<mx:Spacer height="30"/>
<mx:TextInput />
<mx:TextInput />
<mx:Spacer height="30"/>
<mx:ComboBox >
<mx:dataProvider>
<mx:Array>
<mx:String>Beijing</mx:String>
<mx:String>Shanghai</mx:String>
<mx:String>Hangzhou</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>
<mx:TextInput />
</mx:VBox>
</mx:Application>