Change Watcher actually watches for the change in the variable. For example we shall assume a variable name
myChange and its data-type is integer. it takes one as its value . we can use the change watcher method to read the changes in the mychange variable.
Note : changed value must not be one here for the variable. because one has already been assigned to it.
Following is the example for ChangeWatcher using array collection
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.binding.utils.ChangeWatcher;
import mx.collections.ArrayCollection;
private function init():void
{
mx.binding.utils.ChangeWatcher.watch(tester,"length",myNotify);
}
private function myNotify(event:Event):void
{
Alert.show("Array Altered!");
}
private function pushOne():void
{
tester.addItem({label:"Item", data:"Item"});
}
]]>
</mx:Script>
<mx:ArrayCollection id="tester">
<mx:Object label="Item" data="Item"/>
<mx:Object label="Item" data="Item"/>
<mx:Object label="Item" data="Item"/>
<mx:Object label="Item" data="Item"/>
</mx:ArrayCollection>
<mx:ComboBox id="foo" dataProvider="{tester}" horizontalCenter="0" verticalCenter="-114.5"/>
<mx:Button label="Add One Item" click="pushOne()" horizontalCenter="0" verticalCenter="121.5"/>
</mx:Application>
5/24/10
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Hi folks, I got a chance to work with JSF, it was an interesting requirement. Its about a custom component which would be of more use to ...
-
Hi Folks, I would like to share my another POC task in JSF with you all. "Primefaces Dropdown with Pagination & Filter "...
-
We shall create temp table in mysql using the sql script CREATE TEMPORARY TABLE testraghu(name VARCHAR(50) , phone VARCHAR(50)) Let us se...
-
Hi all, i would like to share a simple example of storing haspmap in mysql db. In order to store object into your db, the field type must ...
No comments:
Post a Comment