0 Replies Latest reply on Sep 2, 2007 9:29 AM by Neavo

    Novice need your help, please take a look at my codes.

    Neavo
      Please take a look at the codes below, what's wrong with it? it suppose to draw a rectangle on the canvas on a mouse click, but I dont' see anything.

      Appreciate your help.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="horizontal" creationComplete="initApp()">
      <mx:Script>
      <![CDATA[
      import mx.controls.Alert;
      import mx.containers.Canvas;


      public function initApp(): void
      {
      addDPanelMouseEventListener();
      }

      public function addDPanelMouseEventListener():void
      {
      dPanel.addEventListener(MouseEvent.CLICK, dpMouseClick);
      }

      public function dpMouseClick(e:MouseEvent):void
      {
      dPanel.graphics.beginFill(0xcc0000, 1);
      dPanel.graphics.lineStyle(1, 0x0000ff);
      dPanel.graphics.drawRect(0, 0, 100, 100);
      dPanel.graphics.endFill();
      }
      ]]>
      </mx:Script>

      <mx:Canvas id="dPanel"
      height="100%" width="100%"
      borderStyle="none"
      backgroundColor="#EFEFFF"
      horizontalScrollPolicy = "off"
      verticalScrollPolicy = "off"
      >
      </mx:Canvas>
      </mx:Application>