rpoy
10-23-2009, 01:09 PM
Hi!
I am trying to get the selected item from a listbox. I am able to add items like this...
for (var i:int = 0; i < lst.length; i++)
{
this.ListBox_lst.dataProvider.addItem({label: lst[i]});
}
but when I try to get the selected item:
private function onClick(e:MouseEvent):void
{
trace("Item Selected:" + this.ListBox_lst.getSelectedItem().label);
//_selectedItem = this.ListBox_lst.getSelectedItem().label;
}
I am getting an error that says:
Call to a possibley undefined method getSelectedItem through a reference with static type fl.contorols:List
Am I missing a an import statement or something?
I am trying to get the selected item from a listbox. I am able to add items like this...
for (var i:int = 0; i < lst.length; i++)
{
this.ListBox_lst.dataProvider.addItem({label: lst[i]});
}
but when I try to get the selected item:
private function onClick(e:MouseEvent):void
{
trace("Item Selected:" + this.ListBox_lst.getSelectedItem().label);
//_selectedItem = this.ListBox_lst.getSelectedItem().label;
}
I am getting an error that says:
Call to a possibley undefined method getSelectedItem through a reference with static type fl.contorols:List
Am I missing a an import statement or something?