<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>
import mx.controls.Alert;
private function changeHandler(event:Event):void
{
if (categoryList.selectedIndex == 0)
{
Alert.show("You selected all categories", "Everything!");
}
else
{
Alert.show("You selected " + categoryList.selectedItem, "One Thing!");
}
}
</mx:Script>
<mx:ComboBox id="categoryList" change="changeHandler(event)">
<mx:dataProvider>
<mx:String>All Categories</mx:String>
<mx:String>A</mx:String>
<mx:String>B</mx:String>
<mx:String>C</mx:String>
<mx:String>D</mx:String>
</mx:dataProvider>
</mx:ComboBox>
</mx:Application>
|