Smoother drawing board

this morning i suddenly remembered a post a while back about some one wanting to smooth lines drawn using the drawing api from the drawing board tut an i thout of the simple solution - dont do it from the mouse, do it from an eased mc which follows the mouse.
so i simply combined the 2 tuts (one for mouse following with easing and the drawing board tut) and came up with attached…
one problem tho the post doesnt turn up in searches (too old i presume… god only knows how old the post was!! :S lol)
but neway… if whoever it was is stil lookin for the answer, here tis…


pretty clever prophet. Thanks for sharing! :slight_smile:

There is one problem, however. If you move your mouse very fast and then stop it, the pencil will continut to move but no lines will be drawn :x

Might need an enterframe event in there to take up for that lost slack. :wink:

too tight! I likes this, not sure where I might use it but hey… awesome!

yer i noticed that… a slight movement solves it… but hey, i gotta say - i am surprised - i was expectin ppl 2 say “o its obv bn done b4” and slaggin me off for bein slow etc… but instead i get praised from senocular… NICE! :wink: lol

just seemed logical to me is all…

did as u suggested and hey presto, waddya know joe it works :wink:
cheers sen!


EDIT:- the fla mysteriously compressed itself a bit in uploading to kirupa… if ne1 has probs with the file ill upload agen but for now im goin 2 bed coz i hav headache :S

If possible, could you post the AS used as a txt file? I don’t use the Flash IDE, so I can’t view FLAs, but I would love to look at your code! Even a SWF I could decompile would be great!

Thanks :slight_smile:

erm sure…

this code on frame1:


and this code on the mc:

onClipEvent (load) {
	_x = 0
	_y = 0
	speed = 5
onClipEvent (enterFrame) {
	endX = _root._xmouse
	endY = _root._ymouse
	_x += (endX-_x)/speed
	_y += (endY-_y)/speed
// Code to draw the line to the pencil point
	_root.onMouseDown = function(){
		this.onMouseMove = function(){
//Code to stop the drawing when the mouse is NOT down
	_root.onMouseUp = function(){
		this.onMouseMove = null

it really is simply combining two tuts! the lines will draw to the mc you put the above code on (instance name of pencil) erm… the swf is here:


Thanks Prophet, nice work! :slight_smile:

meh, salrite aint it :stuck_out_tongue: lol
seriously, its nothing… im quite surprised its not been done before to be perfectly honest!!