<?xml
version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
backgroundGradientAlphas="[1.0, 1.0]"
backgroundGradientColors="[#841E1E, #841E1E]">
<mx:Script>
<![CDATA[
import
mx.controls.Alert;
private var
country:Array = new Array();
private var
cstates:Array = new Array();
public function init():void
{
country = ["India","USA","UK","Japan"];
cstates[0] = ["New
Delhi","Andhra Pradesh","Uttar
Pradesh", "Punjab", "Haryana", "Maharashtra", "Assam"];
cstates[1] = ["Washington
DC","ALABAMA", "ALASKA", "ARIZONA", "ARKANSAS", "CALIFORNIA", "COLORADO"];
cstates[2] = ["
London","Swindon", "Berkshire","Darlington","Armagh","Cookstown","Perth
and Kinross","Clwyd","Somerset","Lewisham","Trafford"];
cstates[3] = ["Tokyo","Kyoto","Akita","Shimane","Aomori","Tottori","Saga","Gunma","Fukushima","Fukuoka","Kagawa"];
countryCMB.dataProvider =
country;
cstatesCMB.dataProvider =
cstates[0];
textSelected.text = "Country
= "+country[0]+"\nCapital = "+cstates[0][0];
}
public function
updateCmb():void
{
cstatesCMB.dataProvider =
cstates[countryCMB.selectedIndex]
textSelected.text = "Country
= "+country[countryCMB.selectedIndex]+"\nCapital
= "+cstates[countryCMB.selectedIndex][0];
}
]]>
</mx:Script>
<mx:Canvas x="10" y="10" width="446"
height="186" color="#FDFBFB">
<mx:Text
x="10" y="13" text="Select
your Country" width="132"/>
<mx:ComboBox
x="166" y="10" id="countryCMB"
change="updateCmb()" creationComplete="init()" color="#0F0E0E"></mx:ComboBox>
<mx:Label
x="10" y="59" text="States
are"/>
<mx:ComboBox
x="166" y="56" id="cstatesCMB"
color="#0F0E0E"></mx:ComboBox>
<mx:Text
x="10" y="119" width="393"
height="46" id="textSelected"/>
</mx:Canvas>
</mx:Application>
No comments:
Post a Comment