mouse tracking blues

jbv jbv.silences at club-internet.fr
Tue Jul 9 15:18:01 EDT 2002


Hi list,

First I want to point out that I've read the archives
and am aware of Scott's advice to not use a repeat
loop inside a mousedown handler, but to use
mousemove / mouserelease instead.

However, I'm facing a problem for which using
a repeat loop inside a mousedown seems to be the
only solution, and of course I met the problem of
the mouseup event not being trapped by my script.

In a few words, when the mouse is down on an image
(very large one, like a panoramic) the image is supposed
to scroll back & forth horizontally according to the position
of the mouse relative to the loc of that image, the scroll speed
being proportional to the distance between the mouseloc and
the loc of the image (actually like in a QTVR).
So I used the following script :

on mousedown
  repeat until the mouse is up
      show img 1 at max(-633,min(1432,(item 1 of loc of img
1)-(trunc(((item
1 of the mouseloc)-400)/10)))),300
  end repeat
end mousedown

It works great (very smooth scrolling), except that the up
position of the mouse isn't recognized about 15% of the
time, and the img keeps scrolling even when the mouse btn
has been released.
It is obvious that I can't use mousemove, since the image must
keep scrolling even when the mouse isn't moving, as long
as it is down.

I tried to use mousestilldown (which is a loop by itself) :

on mousestilldown
      show img 1 at max(-633,min(1432,(item 1 of loc of img
1)-(trunc(((item
1 of the mouseloc)-400)/10)))),300
end mousestilldown

It works (the release of the mouse btn is always detected),
although the scrolling effect isn't smooth at all...

If anyone has a brilliant idea for a possible solution,
I thank him / her in advance...

JB





More information about the metacard mailing list