check this link:
http://www.asmakta.com/eraseme2/charc/charcproto3.html
The reason for "var val" is in order to implement this tool into the greater project.
"Val" is set to 5 -hiiting a button sets the val to 15 -conditions for the tool to work are: the button needs to be pushed to activate it and the cursor needs to be over "pad".
That being said, I also need to dissable the tool when I click another -such as an eraser, clicking and eraser button sets "val" to 5 again -it dissables this drawing tool, and sets a new value for "val" which is a new condition for the eraser to work -ie: if(val==5)eraser=true ---then eraser is active and at the same time dissabling the other too.
Regarding your suggestion:
I read up on turning off event listeners but I ran into the same problem last time I experemented that is:
it didn't really stop drawing on on MOUSE_UP and although your code is set up more efficiently, I don't know why it didn't actually turn off the event listener, which is why it just keeps drawing with MOUSE_MOVEfunction stopDrawing(e:MouseEvent):void {
trace("END DRAWING");
pad.removeEventListener(MouseEvent.MOUSE_MOVE, Draw);
}
It does it's job of activating with the button, and working with mouse move, but it does not stop on mouse up and enabe the user to start and stop drawing on MOUSE_DOWN.
Mine does that -but as you look at it -the bug is it in that it stops after a short interval in the MOUSE_DOWN position -But it does
1)limit use until activated 2) start only on MOUSE_DOWN 3) stop when the mouse is of the pad 4) resume again on the pad on mouse down 5) allow the whole process to be dissabled when I add another button later.
I'm trying to see the limitations in creating a draw tool like this -if in fact I have exceeded the limitations in what I can do with Flash in this area -unless there is another way to attack this problem.
separate bug:
I tried different frame-rate settings to ensure that rather than a "staggered" pattern I get a steady "stream" -as it does when you move the mouse slowly.
I saw some examples in using math functions to control the interval something happens, like maybe the rate new instances of "grain" are redrawn in order to make work faster when the user moves the mouse faster.





Bookmarks