Hi there, I have a sketch pad and it works and everything, but I need like an eraser to be added on. Anyone keen on taking a look? Any help is appreciated. Thank you!
(See the attached file)
Here is the code:
lineThickness = 0;
selectedColor = “0x000000”;
_root.onMouseDown = startDrawing;
_root.onMouseUp = stopDrawing;
function startDrawing() {
if (_xmouse<455) {
_root.lineStyle(lineThickness, selectedColor);
_root.moveTo(_root._xmouse, _root._ymouse);
_root.onMouseMove = drawLine;
}
this.attachMovie(“cursor_id”, “cursor_mc”, this.getNextHighestDepth(),
{_x:_xmouse, _y:_ymouse});
Mouse.hide();
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function() {
pencil._x = _xmouse;
pencil._y = _ymouse;
updateAfterEvent();
};
Mouse.addListener(mouseListener);
this.createEmptyMovieClip(“drawing_mc”, this.getNextHighestDepth());
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
this.drawing = true;
drawing_mc.moveTo(_xmouse, _ymouse);
};
mouseListener.onMouseUp = function() {
this.drawing = false;
};
mouseListener.onMouseMove = function() {
if (this.drawing) {
drawing_mc.lineTo(_xmouse, _ymouse);
}
updateAfterEvent();
};
Mouse.addListener(mouseListener);
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.DELETEKEY) || Key.isDown(Key.BACKSPACE)) {
drawing_mc.clear();
}
};
Key.addListener(keyListener);
}
function drawLine() {
_root.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;
};
line9.onPress = function() {
lineThickness = 9;
};
line12.onPress = function() {
lineThickness = 12;
};
colorRed.onPress = function() {
selectedColor = “0xFF0000”;
};
colorGreen.onPress = function() {
selectedColor = “0x00FF00”;
};
colorOrange.onPress = function() {
selectedColor = “0xff9900”;
};
colorBlue.onPress = function() {
selectedColor = “0x00FFFF”;
};
colorYellow.onPress = function() {
selectedColor = “0xFFFF00”;
};
colorDblue.onPress = function() {
selectedColor = “0x0000FF”;
};
colorPink.onPress = function() {
selectedColor = “0xFF00FF”;
};
colorPurple.onPress = function() {
selectedColor = “0x6633CC”;
};
colorBlack.onPress = function() {
selectedColor = “0x000000”;
};