# Drawing Game:Selecting a new colour

**URL:** <https://forum.kirupa.com/t/drawing-game-selecting-a-new-colour/185637>\
**Category:** flash\
**Created:** [April 14, 2006, 8:38pm UTC](https://forum.kirupa.com/t/drawing-game-selecting-a-new-colour/185637 "2006-04-14T20:38:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![trigaahippie](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@trigaahippie](https://forum.kirupa.com/u/trigaahippie)\
**Post date:** [April 14, 2006, 8:38pm UTC](https://forum.kirupa.com/t/drawing-game-selecting-a-new-colour/185637/1 "2006-04-14T20:38:38Z")

</div>

Hey peeps, im trying to make a simple drawing board which will let the user select different colours using a paintbrush. I cant figure out how to go about it tho!!! If anyone can help with the code, id be very greatful. :pleased:

Code:  
// Enables The Drawing Canvas

\_root.onMouseDown = function() {  
if (\_root.canvas\_mc.hitTest(\_root.\_xmouse, \_root.\_ymouse)) {  
var x:Number = \_root.\_xmouse;  
var y:Number = \_root.\_ymouse;  
\_root.holder\_mc.moveTo(x, y);  
down = true;  
}  
};  
\_root.onMouseUp = function() {  
down = false;  
};  
var currentColor:String = “0x000000”;  
\_root.createEmptyMovieClip(“holder\_mc”, 100);  
function draw() {  
\_root.holder\_mc.lineStyle(2, parseInt(currentColor, 16), 100);  
var x:Number = \_root.\_xmouse;  
var y:Number = \_root.\_ymouse;  
\_root.holder\_mc.lineTo(x, y);  
}  
\_root.onMouseMove = function() {  
updateAfterEvent();  
if (down && \_root.canvas\_mc.hitTest(\_root.\_xmouse, \_root.\_ymouse)) {  
draw();  
}  
};

Paintbrush:

on (release) {  
\_root.fillColor = 0x00FF00;  
\_root.brush.gotoAndStop(4);  
}
