PDA

View Full Version : Drawing with mouse



seanmacintosh
March 8th, 2004, 10:41 AM
Hi

I'm trying to find a FLASH 5 tutorial that shows how to draw with the mouse. By that I mean the end user could draw pretty pictures in my movie. I found one at Flashkit.com, but it seems to be a FlashMX tute.:-/

Thanks.Sean.

claudio
March 8th, 2004, 11:31 AM
http://www.kirupa.com/developer/actionscript/drawingboard_flash5.htm

seanmacintosh
March 8th, 2004, 02:06 PM
:)

claudio
March 8th, 2004, 02:11 PM
welcome :)

seanmacintosh
March 8th, 2004, 02:48 PM
The movie works fine tested on its own, however, when I load it as an external swf into my main movie the "erase " button doesn't work?? but I can still draw.

Any suggestions??

Thanks.Sean.

claudio
March 8th, 2004, 02:58 PM
Use this code instead for the eraser:
on (press) {
for (clips in controller) {
removeMovieClip(controller[clips]);
}
}

seanmacintosh
March 8th, 2004, 04:10 PM
That solved the problem perfectly:)

The only remaining difficulty I am having is this:

The main movie is 750x500 and the external swfs are 500x350. When I load the drawing swf into the main movie its location is correct, but it seems to lose any kind perimeter or boundry... so not only can I draw in the external swf, but also the main--any way around this??

Thanks for all the help.
Sean.M.

claudio
March 8th, 2004, 10:33 PM
welcome :)
onClipEvent (load) {
maxX = 500;
maxY = 350;
function draw() {
i++;
this.attachMovie("mcLine", "line"+i, i);
var mc = this["line"+i];
x_start = x_end;
y_start = y_end;
x_end = _xmouse>maxX ? maxX : _xmouse;
y_end = _ymouse>maxY ? maxY : _ymouse;
mc._x = x_start;
mc._y = y_start;
mc._xscale = x_end-x_start;
mc._yscale = y_end-y_start;
}
}
onClipEvent (mouseDown) {
x_end = _xmouse>maxX ? maxX : _xmouse;
y_end = _ymouse>maxY ? maxY : _ymouse;
pressing = 1;
}
onClipEvent (mouseUp) {
pressing = 0;
}
onClipEvent (enterFrame) {
if (pressing) {
draw();
}
}

seanmacintosh
March 9th, 2004, 08:29 AM
Thank you SO much!:)

claudio
March 9th, 2004, 10:08 AM
Glad i could help =)