Mouse.hide();
_root.createEmptyMovieClip("canvas_mc",1);
pencil.swapDepths(2);
eraser.swapDe pths(1);
eraser._visible=false;
_root.onEnterFrame = function() {
pencil._x = _xmouse;
pencil._y = _ymouse;
eraser._x=_xmouse;
eraser._y=_ymouse;
};
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
_root.drawing = true;
canvas_mc.moveTo(_xmouse,_ymouse);
canvas_mc.lineStyle(3,0x99CC00,100);
};
mouseListener.onMouseUp = function() {
_root.drawing = false;
};
mouseListener.onMouseMove = function() {
if (_root.drawing) {
canvas_mc.lineTo(_xmouse,_ymouse);
}
updateAfterEvent();
};
Mouse.addListener(mouseListener);
//
var eraseObj:Object=new Object();
eraseObj.onMouseDown = function() {
_root.drawing = true;
canvas_mc.moveTo(_xmouse,_ymouse);
canvas_mc.lineStyle(8,0xffffff,100);
};
eraseObj.onMouseUp = function() {
_root.drawing = false;
};
eraseObj.onMouseMove = function() {
if (_root.drawing) {
canvas_mc.lineTo(_xmouse,_ymouse);
}
updateAfterEvent();
};
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.CONTROL)) {
pencil._visible=false;
eraser._visible=true;
Mouse.removeListener(mouseListener);
Mouse.addListener(eraseObj);
}
};
keyListener.onKeyUp=function(){
pencil._visible=true;
eraser._visible=false;
Mouse.addListener(mouseListener);
Mouse.removeListener(eraseObj);
}
Key.addListener(keyListener);
--
As drawing flash
Labels:
0 comentarios:
Publicar un comentario