flex: working with checkboxes

Posted on 2011-05-11
Medium Priority
Last Modified: 2012-05-11
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?

Question by:royjayd
  • 2
  • 2
LVL 29

Expert Comment

by:Pravin Asar
ID: 35738940
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



Author Comment

ID: 35739036
>>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.


Author Comment

ID: 35739600
any help anyone?

thanks in advance.
LVL 29

Accepted Solution

Pravin Asar earned 1400 total points
ID: 35740267
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}"/>


Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question