Skip to main content
Known Participant
June 2, 2013
Question

drawing panel...

  • June 2, 2013
  • 1 reply
  • 507 views

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

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
June 2, 2013

Try searching Google for some "AS3 drawing tutorials".  Here is a link to the first result from that search:

http://active.tutsplus.com/tutorials/games/create-a-basic-drawing-application-in-flash/

It provides the code in the discussion as well as source files.

cabaka11Author
Known Participant
June 2, 2013

Hello,

Thank you very much for your reply but that one is too complicated for me.

I cannot understand much from it. I need a simpler version that will

explain to me how to do a basic color picker.

Thank you for your time.

Cagri Kasap