4 Replies Latest reply on Jul 16, 2007 6:15 AM by jnguye19

    List Control addItem

      I've been trying the sample My First Flex in Flex 2 Builder.
      I'm doing fine until this line...
      this line is giving me error.
      Actually I followed all the code given in sample and it's working fine until the above line which
      was not working.

        • 1. Re: List Control addItem
          I also am having trouble with that tutorial. After I changed Void to void, I get this error:

          1061: Call to a possibly undefined method addItem through a reference with static type mx.controls:List.



          This is in reference to the adobe tutorial found at


          Any help?
          • 2. Re: List Control addItem
            try these code:

            <?xml version="1.0"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" >
            <!-- data model -->
            <mx:Array id="coffeeArray">
            <mx:Object label="Red Sea" data="Smooth and fragrant"/>
            <mx:Object label="Andes" data="Rich and pungentt"/>
            <mx:Object label="Blue Mountain" data="Delicate and refined"/>
            <mx:ArrayCollection id="listArray"/>
            public function addToCart():void
            var aObject:Object = new Object();
            aObject.label = coffeeCombo.selectedItem.label;
            aObject.data = coffeeCombo.selectedItem.data;

            <!-- view -->
            <mx:Panel title="My First Flex App">
            <mx:Label text="Coffee Blends"/>
            <mx:ComboBox id="coffeeCombo" dataProvider="{coffeeArray}"/>
            <mx:Text text="{coffeeCombo.selectedItem.data}"/>
            <mx:Button label="Add to Cart" click="addToCart()"/>
            <mx:List id="cart" dataProvider="{listArray}"/>
            • 3. List Control addItem
              Had the same problem... Struggled a little with it before ending up here.

              Is it a version problem?
              • 4. Re: List Control addItem
                jnguye19 Level 1
                I found in another post that this tutorial is for version 1.5, which is a bit different from version 2.0

                Adobe needs to update their tutorials or at least bring out the fact that the tutorial is only for version 1.5