troubleshooting Question

mx:ComboBox selected item on load

Avatar of stargateatlantis
stargateatlantis asked on
Apache Flex
5 Comments1 Solution4794 ViewsLast Modified:
Basically i have a XML file called countries.xml which contains the following XML code.  What I want to do is when the application runs CANADA is selected in the combo box.  


<countires>
   <ctnry countryCode='0' label='Select Country' />
   <ctnry countryCode='CAN' label='Canada' />
   <ctnry countryCode='USA' label='United States' />
   <ctnry countryCode='UK' label='United Kingdom' />
   <ctnry countryCode='OTH' label='Other' />
</countires>
 
 
FLEX CODE BELOW
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initDash();">	
	<mx:Script>
		<![CDATA[
				
				var lstCounVal;		
		
		//int dash when load
		public function initDash():void
		{
			 this.sercountry.send(); 
		}
		
		
			//Close Event Country//
		public function handleCloseEventCountry(eventObj:Event):void 
		{
			
			//Get Country value//
			lstCounVal=lstcountry.selectedItem.countryCode;
		   
		}
		
		public function countryinit():void
		{
			   lstcountry.selectedItem = "{countires['CAD']}";
		}	
		
		
		]]>
	</mx:Script>
	<mx:ComboBox x="21" y="54" width="143" id="lstcountry" labelField="label" dataProvider="{sercountry.lastResult.countires.ctnry}" creationComplete="countryinit();"></mx:ComboBox>
  
  <mx:HTTPService id='sercountry' url='countires.xml' useProxy="false" method="POST">
  </mx:HTTPService>
</mx:Application>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros