Hi Daniel,
The combo box was not designed to do what you are trying to do. I suggest that you use a PopUpButton with a list popped up and you can set the allowMultipleSelection="true" for the list. You will have to handle what happens when you make a selection(because everytime you select an item in the list it will close the pop up). An idea would be to put the list in a HBox and when your condition is satisfied(probably after selecting the desired number of items) call the close() method of the popUpButton which will close it for you.
A simple example would look like this (for this one to close you'll have to select blue then (Ctrl+red)):
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="assets.*" backgroundColor="#FFFFFF" width="600" height="600">
<mx:Script>
<![CDATA[
import mx.events.*;
private var selectList:Array=new Array();
private function listenItemSelect(event:ListEvent):void{
ti.text=String(event.target.selectedIndices);
ti1.text="";
for ( var i:Object in event.target.selectedIndices){
ti1.text+=String(event.target.selectedItems[i].label)+ " ";
}
if (String(event.target.selectedIndices)=="2,1"){
myPopUpButton.label=ti1.text;
myPopUpButton.close();
}
}
]]>
</mx:Script>
<mx:Button id="myButton" label="Roll over this button to close the popUp of the PopUpButton" rollOver=" myPopUpButton.close()" />
<mx:PopUpButton id="myPopUpButton" label="{ti1.text}" >
<mx:popUp>
<mx:HBox >
<mx:List id="myList" allowMultipleSelection="true" itemClick="listenItemSelect(event)">
<mx:dataProvider>
<mx:Array>
<mx:Object label="Black" />
<mx:Object label="Blue" />
<mx:Object label="Red" />
<mx:Object label="Yellow" />
</mx:Array>
</mx:dataProvider>
</mx:List>
</mx:HBox>
</mx:popUp>
</mx:PopUpButton>
<mx:Spacer height="150" />
<mx:TextInput id="ti" />
<mx:TextInput id="ti1" text="Let's say Black" />
</mx:Application>
Hope this helps,
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="assets.*" backgroundColor="#FFFFFF" width="600" height="600">
<mx:Script>
<![CDATA[
import mx.events.*;
private var selectList:Array=new Array();
private function listenItemSelect(event:ListEvent):void{
ti.text=String(event.target.selectedIndices);
ti1.text="";
for ( var i:Object in event.target.selectedIndices){
ti1.text+=String(event.target.selectedItems[i].label)+ " ";
}
if (String(event.target.selectedIndices)=="2,1"){
myPopUpButton.label=ti1.text;
myPopUpButton.close();
}
}
]]>
</mx:Script>
<mx:Button id="myButton" label="Roll over this button to close the popUp of the PopUpButton" rollOver=" myPopUpButton.close()" />
<mx:PopUpButton id="myPopUpButton" label="{ti1.text}" >
<mx:popUp>
<mx:HBox >
<mx:List id="myList" allowMultipleSelection="true" itemClick="listenItemSelect(event)">
<mx:dataProvider>
<mx:Array>
<mx:Object label="Black" />
<mx:Object label="Blue" />
<mx:Object label="Red" />
<mx:Object label="Yellow" />
</mx:Array>
</mx:dataProvider>
</mx:List>
</mx:HBox>
</mx:popUp>
</mx:PopUpButton>
<mx:Spacer height="150" />
<mx:TextInput id="ti" />
<mx:TextInput id="ti1" text="Let's say Black" />
</mx:Application>
Hope this helps,
-sam
On 9/6/06, Daniel <[EMAIL PROTECTED]> wrote:
Im trying to create a multiple-selection combobox.
I'll appreciate any help you can give.
Thanks in advance.
Daniel
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
![]()
SPONSORED LINKS
Software development tool Software development Software development services Home design software Software development company
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
- Re: [flexcoders] ComboBox Multiple Selection Samuel Reuben
Reply via email to

