?
Solved

I want to generate combo boxes dynamically in Flex 3 with an ArrayCollection, having success until returning only one record

Posted on 2009-12-18
3
Medium Priority
?
306 Views
Last Modified: 2013-11-11
When my arraycollection returns more than one row, i have success generating my dynamic text fields and combo boxes. I am attaching code and screen shots.
private function skuOptionsHandler(event:ResultEvent):void
		{
			acOptionTypeName = event.result.options.optionTypeName as ArrayCollection;
			for(var i:int; i < acOptionTypeName.length; i++)
			{
				var optText:Text = new Text();
				optText.x = optTextX;
				optText.y = optTextY;
				details.addChild(optText);
				optTextY += 30;
				optText.text = acOptionTypeName[i].name + ": ";
				
				var optCombo:ComboBox = new ComboBox();
				optCombo.x = optComboX;
				optCombo.y = optComboY;
				details.addChild(optCombo);
				optComboY += 30;
				acOptionArray = event.result.options.optionTypeName[i].option as ArrayCollection;
				optCombo.dataProvider = acOptionArray;
				optCombo.labelField = "value";
				//optCombo.value = "id";
			}
		}

Open in new window

Untitled-1-0001-ac-that-works.jpg
Untitled-1-0002-ac-that-doesnt-w.jpg
0
Comment
Question by:rarid122481
  • 2
3 Comments
 

Author Comment

by:rarid122481
ID: 26081363
when i debug, i complex string is returned instead of the needed arraycollection

result      mx.utils.ObjectProxy (@1aeefa19)      
      object      Object (@1af72769)      
      options      mx.utils.ObjectProxy (@1aeefc59)      
            object      Object (@1af90061)      
            optionTypeName      mx.collections.ArrayCollection (@1af5f081)      
                  [inherited]      
                  [0]      mx.utils.ObjectProxy (@1aeefce9)      
                  [1]      mx.utils.ObjectProxy (@1aeefd79)      
                  [2]      mx.utils.ObjectProxy (@1aeefe51)      
                  [3]      mx.utils.ObjectProxy (@1aeeff29)      
                        name      "Drill Bit Type"      
                        object      Object (@1af90c91)      
                        option      ComplexString (@e8b6311)      
                              id      294 [0x126]      
                              value      "French Backfill"      
0
 
LVL 19

Accepted Solution

by:
moagrius earned 2000 total points
ID: 26081366
when only one result is returned, it is returned as an ObjectProxy.

you just need to test if event.results.rows.row is an ArrayCollection or an ObjectProxy, then react appropriately.

the identical issue is referenced on livedocs:  http://livedocs.adobe.com/flex/3/html/help.html?content=dpcontrols_6.html - look near the bottom at the comments
0
 

Author Closing Comment

by:rarid122481
ID: 31667791
thank you
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

839 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