On Monday, June 23, 2003, at 10:55 AM, Ken Norris wrote:


So, how would I scroll an image with a keypress while it's down, then stop
on keyup.

Something like this might get you started:


local sendID = ""
local toTheRight = "false"
local toTheLeft  = "false"
constant rightArrow = 65363
constant leftArrow = 65361
constant stepSize = 4
constant stepPeriod = 0.2

on rawKeyDown keyCode
  if keyCode is rightArrow then put true into toTheRight
  if keyCode is leftArrow  then put true into toTheLeft
  updateMoving
end rawKeyDown

on rawKeyUp keyCode
  if keyCode is rightArrow then put false into toTheRight
  if keyCode is leftArrow  then put false into toTheLeft
  updateMoving
end rawKeyUp

on updateMoving
  if (toTheRight or toTheLeft) then
    if sendID is empty then
      moveStep
    end if
  else
    cancel sendID
    put empty into sendID
  end if
end updateMoving

on moveStep
if toTheRight then
if the right of image "My Image" < 320 then
move image "My Image" rel (stepSize,0) in stepPeriod seconds without waiting
end if
else
if the left of image "My Image" > 5 then
move image "My Image" rel ((-stepSize),0) in stepPeriod seconds without waiting
end if
end if
send moveStep to me in stepPeriod seconds
put the result into sendID
end moveStep



Dar Scott


_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to