This blog has been moved. This redirect you our new blog with all old posts..

Read Mulitiple selected item of List Box Using Flex

How to read multiple selection list box in flex?

<mx:List allowMultipleSelection="true"
id="searchResult" width="100%"
height="100"
verticalScrollPolicy="on"
click="filter">

<mx:dataProvider>
<mx:Object label="Schmidt, Frank" value="1"/>
<mx:Object label="Schmidt, Peter" value="2"/>
</mx:dataProvider>
</mx:List>


function filter():void{
var str:String="";
for each(var ob:Object in searchResult.selectedItems){
str+=(str=="")?ob.value.toString():","+ob.value.toString();
i++;
}
trace(str); // this will return you indexs of list box
}

No comments: