0 Replies Latest reply on Aug 30, 2006 8:42 AM by tamchsg

    TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::MouseEvent@e087c41 to Event.

    tamchsg
      Hi
      I notice an error in the manual under write an event listener.
      -----------------------------------------
      Example:
      <mx:Script>
      <![CDATA[
      public function createListener():void {
      btnConvert.addEventListener(MouseEvent.CLICK, convertCurrency);
      }

      public function convertCurrency(e:Event):void {
      var rate:Number = 120;
      var price:Number = Number(txtPrice.text);
      if (isNaN(price)) {
      lblResults.text = "Please enter a valid price.";
      } else {
      price = price * rate;
      lblResults.text = "Price in Yen: " + String(price);
      }
      }
      ]]>
      </mx:Script>

      -----------------------
      Please change it to : public function convertCurrency(event:MouseEvent):void {
      And the example works