flex: working with checkboxes

hi guys

what is the best way to work with check boxes on the flex UI? I am using java in the backend
my requirment is i need some nice checkboxes on the UI which should be passed to the java backend.

any ideas?

Who is Participating?
Pravin AsarConnect With a Mentor Principal Systems EngineerCommented:
Flex RemoteObject method can help you with that.


It is bit more involved in terms of code and set-up at server side.


Look at


IF you are looking to cycle through data and pickup the values assoicated with selected checkboxes look at the following example code.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">
                  import mx.events.CollectionEvent;
                  [Bindable] public var selected:String="";
                  public function update():void {
                        for (var ix:int=0; ix < srcData.source.length; ix++) {
                              if (srcData.getItemAt(ix).selected) {
                              trace (srcData.getItemAt(ix).value.toString());
                              selected += srcData.getItemAt(ix).value.toString() + ',';
      <mx:ArrayCollection id="srcData">
                  <mx:Object display="Option 1" value="value1" selected="false"/>
                  <mx:Object display="Option 2" value="value2" selected="true"/>
                  <mx:Object display="Option 3" value="value3" selected="false"/>
                  <mx:Object display="Option 4" value="value4" selected="false"/>
      <mx:DataGrid dataProvider="{srcData}" width="200" height="400">
                  <mx:DataGridColumn headerText="Selected Options" dataField="selected">
                                    <mx:CheckBox label="{data.display}" selected="{data.selected}" click="data.selected= !data.selected; outerDocument.srcData.refresh(); outerDocument.update(); trace(data.selected);"/>
      <mx:DataGrid dataProvider="{srcData}" width="200" height="400"/>
      <mx:TextInput text="{selected}"/>

Pravin AsarPrincipal Systems EngineerCommented:
To connect to back, you have few options such as RemoteObject, httpservice request.

Can you be specific what you have or planning to use on server side.

Here is good starter


royjaydAuthor Commented:
>>Can you be specific what you have or planning to use on server side.

I am using flex on the UI and using java with spring blazeds on the back.
I have multiple check box fields like

Country(check applicable values)
Usa           --checkbox1
Denmark   --checkbox2
London     --checkbox3

If usa and london is checked and denmark in unchecked , i need to pass all the checked and unchecked values to my java program in backend.
I want to pass them in a arraycollection (in flex) which needs to get translated to ArrayList on the java side.
any help would be helpful.

royjaydAuthor Commented:
any help anyone?

thanks in advance.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.