topical media & game development
lib-as-core-DictionaryUtilDemo.mx
lib-as-core-DictionaryUtilDemo.mx
(swf
)
[ flash
]
flex
<?xml version="1.0" encoding="utf-8"?>
<mx:Module
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import com.adobe.utils.DictionaryUtil;
private var dic:Dictionary = new Dictionary();
[Bindable]
private var keys:Array;
[Bindable]
private var values:Array;
private function doAddToDictionary():void
{
if(dicKey.text == "" )
{
var msg:String = "key of dictionary cannot be empty";
return;
}
dic[dicKey.text] = dicValue.text;
keys = DictionaryUtil.getKeys(dic);
values = DictionaryUtil.getValues(dic);
}
]]>
</mx:Script>
<mx:VBox width="100%" height="100%">
<mx:Form>
<mx:FormItem label="key">
<mx:TextInput id="dicKey" text="key1" />
</mx:FormItem>
<mx:FormItem label="value">
<mx:TextInput id="dicValue" text="value1"/>
</mx:FormItem>
<mx:FormItem>
<mx:Button label="add to dictionary" click="doAddToDictionary()"/>
</mx:FormItem>
</mx:Form>
<mx:Text text="keys:{ keys.toString()}"/>
<mx:Text text="values:{ values.toString()}"/>
</mx:VBox>
</mx:Module>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.