Here is one way: http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&objectID=252 Tracy
-----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Bob Remeika Sent: Thursday, August 18, 2005 5:04 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] How to programmatically select multiple items in a List control? Does anybody know how to do this? I would assume that it has something to do with pushing an index on the selectedIndices property but I have been unable to get it to work. I am able to select a single element by setting selectedIndex to a valid index though. I do also have multipleSelection="true" in my mxml. Here is my function: public function selectList(data:Object) { var optionGroupList:mx.controls.List = mx.controls.List(optionGroup); var lastIndex:Number = optionGroupList.length; //Echo.debug("selectList called with data: " + data + " " + contentProvider.length); for (var i:Number = 0; i < contentProvider.length; ++i) { //Echo.debug("selectList: " + contentProvider[i].data + " == " + data); if (contentProvider[i].data == data.toString()) { Echo.debug("selecting " + i); if (optionGroupList.selectedIndices == undefined) optionGroupList.selectedIndex = i; else optionGroupList.selectedIndices.push(i); //optionGroupList.selectedIndices[lastIndex++] = i; //optionGroupList.selectedItems.push(contentProvider[i]); //optionGroupList.selectedIndex = i; } } mx.controls.Alert.show("selected indices: " + optionGroupList.selectedIndices.length); //optionGroupList.layoutChildren(); } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hrfmiei/M=362329.6886308.7839368.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124413457/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992 ">Fair play? Video games influencing politics. Click and talk back!</a>.</font> --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/