You're right Slava. Repeat loops suspend _all_ other animation in Director.
Frame scripts won't work well either when the frame rate drops down too
much.

However, courtesy of timeOut objects, you can have smooth motion without
the lockout of repeat loops. Here's some code over the top of my head.
Untested.

property pUpdateTimer
property fActive

on beginSprite me
     -- Initiate the timeOut object
     pUpdateTimer = timeOut("update_screen").new(100, #mUpdateScreen, me)
     fActive = FALSE
end beginSprite me

on mouseDown me
     -- When the user clicks, set the flag to TRUE
     fActive = TRUE
end mouseDown me

on mouseUp me
     -- When the user releases the cursor, set the flag to FALSE
     fActive = FALSE
end mouseUp me

on mouseUpOutside me
     -- When the user releases the cursor, set the flag to FALSE
     fActive = FALSE
end mouseUpOutside me

on mUpdateScreen me
     -- If the flag is TRUE, then update the location of the sprite
     if fActive then
          sprite(me.spriteNum).loc = the mouseLoc
     end if
end mUpdateScreen me

The idea behind using timeOut objects is that they always fire off at a
fixed interval. There's no dependency on frame rate or screen refreshes. So
even if you set your handler to be triggered every millisecond, it'll
always work. The flag simply checks that the user has actually pressed the
mouse button over the current sprite. If the flag is TRUE, then the
mUpdateScreen handler updates the location of the sprite to the mouseLoc.

As I said earlier, this is pretty basic code. You'll need to add the frills
in it for the kind of movement you're looking for the sprite.

HTH.

Cordially,
Pranav Negandhi
New Media Applications.
Learnet India Limited, Mumbai.
Phone: 91-22-859 8042 Ext: 410



<snip>
Yes, sure. Adding an updateStage after every location update makes no
difference--it is still possible to break the mouse pointer away from the
sprite with a quick motion, and then the hander stops working.

I also tried putting the sequence in the exitFrame script. In that case,
the handler always works, but is very "laggy," even at 25 frames/sec.

Putting the same sequence in a repeat loop, as I've seen in one DOUG
article, makes the movement jerky for some reason. Also, a repeat loop
suspends background actions, at least on the Mac.

I don't know what else to try.
<snip>



[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to