1 Reply Latest reply on Sep 28, 2006 12:19 AM by help_me_god_1999

    A  Event Problem

    help_me_god_1999
      recently,i meet a trouble ,below is my code:
      package
      {
      import flash.display.Sprite;
      import flash.events.MouseEvent;
      import flash.display.Shape;

      public class Test extends Sprite
      {
      public function Test():void{
      this.graphics.beginFill(0xff0000);
      this.graphics.drawRect(0,0,100,100);
      }
      public function clickEvent(event:MouseEvent):void{
      trace("========================================");
      }
      }
      }

      in my opinion, when i clicked the rectangle, there will print a line of "=",but it just didn't . it seems that actionscript didn't response the mouse event, and i don't know why, i'm so confused ...
        • 1. Re: A  Event Problem
          help_me_god_1999 Level 1
          sorry, the code upper is not correct, below is the code ,but it just didn't response the mouse event

          package
          {
          import flash.display.Sprite;
          import flash.events.MouseEvent;
          import flash.display.Shape;

          public class Test extends Sprite
          {
          public function Test():void{
          this.graphics.beginFill(0xff0000);
          this.graphics.drawRect(0,0,100,100);
          this.addEventListener(MouseEvent.CLICK,clickEvent);
          }
          public function clickEvent(event:MouseEvent):void{
          trace("========================================");
          }
          }
          }