Here's an example:
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
xmlns:local="*" >
 
<mx:Script>
<![CDATA[
 
private var stateList:Array = [
    { label: "Alaska", selected: false },
    { label: "Arkansas", selected: false },
    { label: "California", selected: false },
    { label: "Delaware", selected: false },
    { label: "Florida", selected: false },
    { label: "Georgia", selected: false },
    { label: "Hawaii", selected: false },
    { label: "Massachusetts", selected: false },
    { label: "Nevada", selected: false },
    { label: "Pennsylvaia", selected: false },
    { label: "South Dakota", selected: false },
    { label: "Tennessee", selected: false },
    { label: "Utah", selected: false },
    { label: "Virginia", selected: false },
    { label: "Washington", selected: false }
    ];
 

private function showSelected():void
{
 var s:String = "";
 var n:int = stateList.length;
 for (var i:int = 0; i < n; i++)
 {
  if (stateList[i].selected)
   s += stateList[i].label + "\n";
 }
 ta1.text = s;
}
 
]]>
</mx:Script>
 
<mx:List id="list1" initialize="list1.dataProvider = stateList"
width="200" >
 <mx:itemRenderer>
  <mx:Component>
   <mx:CheckBox selectedField="selected" change="data.selected =
selected" />
  </mx:Component>
 </mx:itemRenderer>
</mx:List>
<mx:Button label="show selected" click="showSelected()" />
<mx:TextArea id="ta1" width="200" height="100" />
 
</mx:Application>
 
 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Clint Tredway
Sent: Tuesday, March 27, 2007 1:14 PM
To: [email protected]
Subject: Re: [flexcoders] List Control with checkbox items



here is a couple of ideas. (I didnt test these, but either 'should
work')

1. have a function tied to the click event of the checkbox that adds
that index to the selectedItems of the list control

2. when submitting the info, loop through the list and check to see if
any check boxes are checked. 

option 1 would mean you would need to change how your itemRenderer is
built, but it should work.


On 27 Mar 2007 13:02:37 -0700, Rick Root < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote: 

        Anyone else got any ideas here?
        
        

        On 3/27/07, Rick Root <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote: 

                (wow, gmail makes it difficult to quote emails from
yahoo groups!)
                 
                That almost works.... here's my MXML:
                 
                  <mx:List allowMultipleSelection="true" height="203"
width="360"
dataProvider="{parentDocument.ro.getListData.lastResult.CONTROL_CODES}"
labelField="TABLFLD" id="lstControlCodes" 
                    rendererIsEditor="true"
itemRenderer="mx.controls.CheckBox">
                  </mx:List>
                
                The problem here is that the checkboxes do not relate to
the actual selected status of the items.  For example, if I click 3
different items without holding down the control key, all 3 items have
checkboxes, but only one (the last) is highlighted in blue.. meaning
it's the only one REALLY selected as far as the list control is
concerned. 
                
                 
                Rick


                -- 
                CFMBB - Coldfusion Message Boards, Version 1.21 Now
Available!
                http://www.cfmbb.org <http://www.cfmbb.org/>  




        -- 
        CFMBB - Coldfusion Message Boards, Version 1.21 Now Available!
        http://www.cfmbb.org <http://www.cfmbb.org>  

        

        




-- 
http://indeegrumpee.spaces.live.com/
<http://indeegrumpee.spaces.live.com/>  

 

Reply via email to