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
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;
				optTextY += 30;
				optText.text = acOptionTypeName[i].name + ": ";
				var optCombo:ComboBox = new ComboBox();
				optCombo.x = optComboX;
				optCombo.y = optComboY;
				optComboY += 30;
				acOptionArray = event.result.options.optionTypeName[i].option as ArrayCollection;
				optCombo.dataProvider = acOptionArray;
				optCombo.labelField = "value";
				//optCombo.value = "id";

Open in new window

Question by:rarid122481

    Author Comment

    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)      
                      [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"      
    LVL 19

    Accepted Solution

    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: - look near the bottom at the comments

    Author Closing Comment

    thank you

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
    Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
    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 what frame rate is, how to control it and what effect it has on the video.

    794 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now