: More send in time

Scott Rossi scott at tactilemedia.com
Mon Jun 30 22:15:00 EDT 2003


Recently, Ken Norris wrote:

> OK, all the other scripts I've seen, including mine (except for the screwup
> of putting 'the mouse' instead of 'the mouseLoc' which is what I meant to
> say) all use 'the mouseLoc'.
> 
> So what is so bad about using it then, except for using it in a loop?

There's nothing wrong with checking the mouseLoc.  The "wrong" aspect of
your script was the way you went about it.

BAD: "repeat until the mouse is up" (constant polling of the mouse state)

GOOD: checking a variable whose value is changed once the mouse is released

EXAMPLE:

on mouseDown
  set the uAllowCheck of me to true
  myLoop
end mouseDown

on myLoop
  if not the uAllowCheck of me then exit myLoop
  put "the mouse is down"
  send "myLoop" to me in 50 milliseconds
end myLoop

on mouseUp
  set the uAllowCheck of me to false
  put "the mouse is up"
end mouseUp

on mouseRelease
  mouseUp
end mouseRelease


Regards,

Scott Rossi
Creative Director

Tactile Media, Multimedia & Design
Email: scott at tactilemedia.com
Web: www.tactilemedia.com




More information about the use-livecode mailing list