PDA

View Full Version : Sketchpad Tutorial Question Pls Help :(



xcute
October 4th, 2003, 12:00 PM
createEmptyMovieClip("Line",1);
Line.lineStyle(2,0x000000,100);

onMouseDown = function (){
Line.moveTo(_xmouse, _ymouse);
onMouseMove = function (){
Line.lineTo(_xmouse, _ymouse);}
}
onMouseUp=function(){
onMouseMove=null;
}

How do we use this code on a movieclip (limited space for sketching) created by us ?


If i'm not mistaken the onMouseMove = null function for the code below is not correct ..please help!!

onClipEvent (load) {
lineStyle(2,0x000000,100);
}
onClipEvent (mouseDown) {
moveTo(_xmouse, _ymouse);
}

onClipEvent (mouseMove) {
lineTo(_xmouse, _ymouse);
}

onClipEvent (mouseUp) {
onMouseMove=null;
}

kode
October 4th, 2003, 12:34 PM
Well, since you can delete (or set to null/undefined/etc) static event handlers, you'll need to use a flag. :)

onClipEvent (load) {
var flag = false;
this.lineStyle(2, 0x000000, 100);
}
onClipEvent (mouseMove) {
if (flag) {
this.lineTo(this._xmouse, this._ymouse);
updateAfterEvent();
}
}
onClipEvent (mouseUp) {
flag = false;
}
onClipEvent (mouseDown) {
flag = true;
this.moveTo(this._xmouse, this._ymouse);
}

xcute
October 4th, 2003, 12:46 PM
:) Thanks for helping in stopping the mouse from drawing continuously but...the problem now is ...i want to create a space for the mouse to draw on...and not on the background..
For example i create a movie clip on the 1st frame and i want to draw on that movie clip and not on the frames background...how do i do that ?

kode
October 4th, 2003, 02:02 PM
I'm not sure that I understood your question (36+ hours without sleeping is not a really good idea anymore), but... see attachment. :P

ahmed
October 4th, 2003, 02:10 PM
there's a whole thread on drawing boards with like 3 different methods on limited the drawing space to a certain spot... let me look it up :)


[edit]

here

http://www.kirupaforum.com/forums/showthread.php?threadid=25456&highlight=lost

kode
October 4th, 2003, 02:13 PM
So true, ahmed... I remember that thread! :)

Then again, 36+ hours without sleeping is not a really good idea anymore... :P

ahmed
October 4th, 2003, 02:15 PM
haha :P

xcute
October 4th, 2003, 09:05 PM
kode...its the 36 hours no sleep prog that you did fer me is the one i want...thanks sooOooOOoo much :)

xcute
October 4th, 2003, 10:36 PM
another question...for the code you've done? how do you place an erase button to erase the contents ?
i tried many times but can't get it..
i could erase the content but after that cannot draw on it anymore........

kode
October 5th, 2003, 12:01 AM
After you call the clear method to erase the lines, you must define the line style again. ;)

xcute
October 5th, 2003, 12:10 AM
where do i definte the line style ?
the button would be outside of the movie rite ?

kode
October 5th, 2003, 12:19 AM
What do you mean? Outside of which movie?

Sorry... 46+ hours and counting. :sleep:

xcute
October 5th, 2003, 12:25 AM
you still haven't went to sleep ?
i mean the board.fla..you did..you had 2 movie clips..one called line_mc and one more called board_mc...i place the button on the timeline that i see..and i write
on(press){
line_mc.clear()
}
so it does clear the lines drawn
but then where do i write the codes to call back lineStyle ?
and i'm not sure what to call...

kode
October 5th, 2003, 12:26 AM
Ok... I added a button to clear the lines. :P


on (press) {
line_mc.clear();
line_mc.lineStyle(2, 0x000000, 100);
}
And nope, I went out with a couple of friends to get a beer. :P

xcute
October 5th, 2003, 12:33 AM
thanks so much!!
beer ? not drunk yet..phew :P
its bedtime..go sleep..:P

kode
October 5th, 2003, 12:42 AM
No problem. ;)

And fine!! I'll go to bed in a few minutes. :P

vader
October 5th, 2003, 11:18 PM
i have a question, how do you create a button in a drawing board that can change the thickness and the transparency of the line?

kode
October 6th, 2003, 01:00 AM
Just like we did with the clear button, but not calling the clear method and defining a different line style? :P

on (press) {
line_mc.lineStyle(10, 0xCC0000, 40);
}