0 Replies Latest reply on Mar 21, 2007 3:09 AM by salimsdesign

    Bug in function

    salimsdesign
      I am new to Flex. I have just started learning Flex2 and I followed a tutorial from Adobe site.
      The link: http://www.adobe.com/devnet/flex/articles/first_flexapp.html

      I followed all the steps but when I play the Project I found an error (1046: Type was not found or was not a compile-time constant: Void.).

      Here is the 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</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[

      private function addToCart():Void
      {
      cart.addItem(coffeeCombo.selectedItem.label,coffeeCombo.selectedItem.data);
      }
      ]]>

      </mx:Script>
      <!-- view -->
      <mx:Panel title="My First Flex App">
      <mx:Label text="Coffee Blends"/>
      <mx:ComboBox id="coffeeCombo" dataProvider="{coffeeArray}"/>
      <mx:Text text="Description: {coffeeCombo.selectedItem.data}"/>
      <mx:Button label="Add to Cart" click="addToCart()"/>
      <mx:List id="cart"/>
      </mx:Panel>
      </mx:Application>


      I guess the tutorial that I followed is not meant for Flex2 and it was for Flex2. So I am getting the error message.
      quote:

      Text