user990947
user990947

Reputation: 21

How to get Selected value for list in Actionscript 3?

I create a list Companents in as3, and I added item using list.addItem({label: "Topman"}); while i get the value of Selected list trace(list.selectedItem);

it returns [object Object].

How can I solve this problem? Anybody help me. Thanks in advance!

Upvotes: 0

Views: 4076

Answers (2)

user56250
user56250

Reputation:

Try this:

if ( list.selectedItem != null && list.selectedItem.hasOwnProperty("label") ) {
    trace( "Selected label is: " + list.selectedItem.label );
}

Upvotes: 4

laurent
laurent

Reputation: 90776

You can retrieve the label using list.selectedItem.label

Upvotes: 1

Related Questions