2 Replies Latest reply on Feb 8, 2007 10:05 PM by Cheree Singal

    Add Item to list

    conlucia
      I'm trying to test this short example, by adobe, but it doesn't work.
      The error is: non valid metod in cart.addItem???
      Please help me..

      Tank you in advance.

      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      <mx:Array id="coffeeArray">
      <mx:Object>
      <label>Red Sea</label>
      <data>Smooth and fragrant</data>
      </mx:Object>
      <mx:Object>
      <label>Andes</label>
      <data>Rich and pungent</data>
      </mx:Object>
      <mx:Object>
      <label>Blue Mountain</label>
      <data>Delicate and refined</data>
      </mx:Object>
      </mx:Array>
      <mx:Script>
      <![CDATA[
      function addToChart():void
      {
      cart.addItem(coffeeCombo.selectedItem.label,coffeeCombo.selectedItem.data);
      }
      ]]>
      </mx:Script>
      <mx:Panel title="La mia prima applicazione Flex" width="284" height="384">
      <mx:Label text="Coffee Blends"/>
      <mx:ComboBox id="coffeeCombo" dataProvider="{coffeeArray}" width="163"/>
      <mx:Text text="Descrizione: {coffeeCombo.selectedItem.data}"/>
      <mx:Button label="Aggiungi al Carrello" click="addToChart()"/>
      <mx:List id="cart"></mx:List>
      </mx:Panel>
      </mx:Application>