Tyr binding the label to the combobox's selectedItem.projectname

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Cathal
Sent: Monday, July 21, 2008 11:26 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Populate label with item from combobox

 

Hi,

I have a combobox which is populate by an XML file and works fine.

code:
<mx:ComboBox creationComplete="userProjects.send()"
dataProvider="{userProject}" labelField="projectname"
change="setCompanyName(event)" width="313"> </mx:ComboBox>

Once, the combo box is changed it fills a label with the value selected.

code:
private function setCompanyName(evt:Event):void
{
lblCompanyName.text = evt.currentTarget.selectedItem.projectname;
}

The problem is what if only one item exists in the combobox. There
cannot be any change. I want the label to be filled by default item in
the combobox and also on any chnage, I've tryed with selectedItem and
selectedIndex but with no luck. Any suggestions is appreciated.

Kind Regards,
Cathal O'Brien 

 

Reply via email to