NICE!!!
Make it a bit smaller maybee then it looks better, not so rough! But NICE!!!! This way it looks way better.
Well, make a flash.
FPS 12, but better higher, maybee 16-20, not too high though, since the code will be bigger and your computer needs more resources (ram/speed)
2 buttons.
Codes:
//this button will clear a drawing
on (release) { drawing.removeMovieClip(); foo = new drawAPicture; }
//this button will start the re-draw!
on (release) {
drawing.removeMovieClip();
foo = new redraw;
}
Code for a frame 1:
//(remove the trace if you want to use it as drawing board)
Movieclip.prototype.drawLine = function(){
if (Math.abs(nL.x1 - _root._xmouse) > 1 && Math.abs(nL.y1 - _root._ymouse) > 1){
//insert rest of finction here
this.a++;
//nL for newLine
nL = this.createEmptyMovieClip("line"+this.a,this.a);
nL.lineStyle(3,0x339933,100);
if (this.lineSeg == 1){
this.lineSeg = 0;
nL.x0 = _root._xmouse;
nL.y0 = _root._ymouse;
} else {
nL.x0 = this["line"+(this.a-1)].x1;
nL.y0 = this["line"+(this.a-1)].y1;
}
nL.x1 = _root._xmouse;
nL.y1 = _root._ymouse;
this.newLine();
this.aRec();
}}
Movieclip.prototype.reDrawLine = function(){
this.a++;
if (a > _root.dA.x0.length){
this.onEnterFrame = null;
}
//nL for newLine
nL = this.createEmptyMovieClip("line"+this.a,this.a);
nL.lineStyle(3,0x339933,100);
this.aRead();
this.newLine();
}
Movieclip.prototype.newLine = function(){
trace('nL.moveTo('+nL.x0+','+nL.y0+');nL.lineTo('+nL.x1+','+nL.y1+');');
nL.moveTo(nL.x0,nL.y0);
nL.lineTo(nL.x1,nL.y1);
}
Movieclip.prototype.aRec = function(){
//array recording
_root.dA.x0[this.a] = nL.x0;
_root.dA.y0[this.a] = nL.y0;
_root.dA.x1[this.a] = nL.x1;
_root.dA.y1[this.a] = nL.y1;
}
Movieclip.prototype.aRead = function(){
//array recording
nL.x0 = _root.dA.x0[this.a]
nL.y0 = _root.dA.y0[this.a]
nL.x1 = _root.dA.x1[this.a]
nL.y1 = _root.dA.y1[this.a]
}
//dL for drawListener
dL = new Object;
Mouse.addListener(dL);
dL.onMouseDown = function(){
_root.drawing.lineSeg = 1;
_root.drawing.onEnterFrame = _root.drawing.drawLine;
}
dL.onMouseUp = function(){
_root.drawing.onEnterFrame = null;
}
drawAPicture = function(){
//one array for each coordinate (start and end, x and y)
_root.createEmptyMovieClip("drawing",1);
dA = new Array();
dA.x0 = new Array();
dA.y0 = new Array();
dA.x1 = new Array();
dA.y1 = new Array();
}
redraw = function(){
_root.createEmptyMovieClip("drawing",1);
drawing.onEnterFrame = reDrawLine;
}
foo = new drawAPicture;