2 Replies Latest reply on Feb 2, 2007 11:58 AM by peterent

    Draw a line on canvas control doesn't work if the canvas has backgroundColor

    lli123
      I cannot draw a line on the canvas control if the canvas has backgroundColor. The reason I have to use the backgroundColor in the canvas is that I have to do drag and drop. The drag and drop is require the canvas must has backgroundColor. This is my sample code:
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      horizontalAlign="center" verticalAlign="top" width="800" height="600"
      creationComplete="initApp()">
      <mx:Script>
      <![CDATA[
      private function initApp():void
      {
      canvas0.graphics.clear();
      canvas0.graphics.lineStyle(1,0x487096,1);
      /*1. draw a line */
      canvas0.graphics.moveTo(30, 10);
      canvas0.graphics.lineTo(90, 60);
      }
      ]]>
      </mx:Script>
      <mx:Label id="xx" text="Just draw a line here"/>
      <mx:Canvas id="canvas0"
      borderStyle="solid" x="150" y="150"
      borderColor="#000000"
      backgroundColor="#FFFFFF"
      width="100%"
      height="200"
      >

      </mx:Canvas>
      </mx:Application>


      Can anyone give me a idea for how make it work for me?

      Thanks,
      Lucy