2 Replies Latest reply: Jun 2, 2013 6:36 AM by cabaka11 RSS

    drawing panel...

    cabaka11 Community Member

      Hello,

       

      I am planning to create a simple drawing panel by using AS3. I want to prepare several color buttons upon the pressing of each one will the user be able to select a drawing color.

       

      I have had the code like this.

       

      var spriteyellow: Sprite = new Sprite();

      addChild(spriteyellow);

      stage.addEventListener(MouseEvent.MOUSE_DOWN, yellowing);

      function yellowing(e:MouseEvent){

          spriteyellow.graphics.lineStyle(1, 0xffdd33);

          spriteyellow.graphics.lineTo(mouseX, mouseY);

      }

       

      There are also problems with this code: 1) I cannot set the thickness of the line (I want it to be adjustable). 2) I cannot start from anywhere on the screen. It always starts from the default left upper corner.

       

      Barring the two problems above, this code so far only draws lines on the screen. I, also, do not know how I sould connect the selection buttons with conditional statement that will change with each color button itself.

       

      If anyone could help, I would be very happy.

       

      Best Regards,

      Cagri Kasap