# Help! Having problems with scripting of sketchpad

**URL:** <https://forum.kirupa.com/t/help-having-problems-with-scripting-of-sketchpad/219132>\
**Category:** Uncategorized\
**Created:** [March 14, 2007, 5:02am UTC](https://forum.kirupa.com/t/help-having-problems-with-scripting-of-sketchpad/219132 "2007-03-14T05:02:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![juz\_me](https://avatars.discourse-cdn.com/v4/letter/j/8baadc/32.png) [@juz\_me](https://forum.kirupa.com/u/juz_me)\
**Post date:** [March 14, 2007, 5:02am UTC](https://forum.kirupa.com/t/help-having-problems-with-scripting-of-sketchpad/219132/1 "2007-03-14T05:02:03Z")

</div>

Basically what i want to achieve is a sketch pad (within an image) with colour swatches (where ppl can draw on it, and change colour). I tried out this tutorial which works nicely, however, the funny part is, i can only draw STARTING from the left area. If i were to start drawing from the right, nothing appears. But if i start drawing from the left ONLY then i can continue drawing to the right. It’s weird and i dun understand why is this is so. Can anyone help me out pls? Wud really appreciate it. If possible, fast answer as i am stuck with my project. Hope to hear from someone soon.

By the way, this is the script that i used,

lineThickness = 0;  
selectedColour = “0x000000”;  
drawOn.onMouseDown = startDrawing;  
drawOn.onMouseUp = stopDrawing;  
function startDrawing() {  
if (\_xmouse\<455) {  
drawOn.lineStyle(lineThickness, selectedColour);  
drawOn.moveTo(drawOn.\_xmouse,drawOn.\_ymouse);  
drawOn.onMouseMove = drawLine;  
}  
}  
function drawLine() {  
drawOn.lineTo(this.\_xmouse, this.\_ymouse);  
}  
function stopDrawing() {  
delete this.onMouseMove;  
}  
line0.onPress = function() {  
lineThickness = 0;  
};  
line3.onPress = function() {  
lineThickness = 3;  
};  
line6.onPress = function() {  
lineThickness = 6;  
};  
colourRed.onPress = function() {  
selectedColour = “0xFF0000”;  
};  
colourGreen.onPress = function() {  
selectedColour = “0x00FF00”;  
};  
colourBlue.onPress = function() {  
selectedColour = “0x000099”;  
};  
colourWhite.onPress = function() {  
selectedColour = “0xFFFFFF”;  
};  
colourBlack.onPress = function() {  
selectedColour = “0x000000”;  
};  
colourViolet.onPress = function() {  
selectedColour = “0xCC00FF”;  
};  
colourPurple.onPress = function() {  
selectedColour = “0x9900FF”;  
};  
colourYellow.onPress = function() {  
selectedColour = “0xFFFF00”;  
};
