Posted by: pachamuthu | June 4, 2009

ComboBox control

Definition:

        The Combobox control is contains a drop down list from which the user can select a single value.

Source Code:

<?xml version=”1.0″?>
<!– dpcontrols/ComboBoxEvent.mxml –>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” >
<mx:Script>
<![CDATA[
import flash.events.Event;
import mx.events.DropdownEvent;

private function dropEvent(event:DropdownEvent):void {
forChange.text+=event.type + "\n";
}

private function changeEvent(event:Event):void {
forChange.text+=event.currentTarget.selectedItem.label + " " +
event.currentTarget.selectedIndex + "\n";
}
]]>
</mx:Script>

<mx:ComboBox open=”dropEvent(event)” close=”dropEvent(event)” width=”100″ height=”25″
change=”changeEvent(event)” color=”red” >
<mx:ArrayCollection>
<mx:Object label=”TN” data=”TamilNadu”/>
<mx:Object label=”KL” data=”Karela”/>
<mx:Object label=”SA” data=”South Africa”/>
<mx:Object label=”USA” data=”America”/>
<mx:Object label=”IN” data=”India”/>
</mx:ArrayCollection>
</mx:ComboBox>
<mx:TextArea id=”forChange” width=”150″ height=”150″/>
</mx:Application>

with regards,
pachamuthu.p


Leave a response

Your response:

Categories