arrowKey 'up' and 'down'

RM richmondmathewson at gmail.com
Sat Apr 23 14:00:19 EDT 2016


OK, OK, I've been messing around with moving daft images around using the
arrowKeys on my keyboard - nothing new there.

However, I have been moving graphic objects around that have been 
flipping their way
through a series of backGroundPattern images as they have been moved, 
and this has
created a problem:

if I have this sort of code in my cardScript:

(pseudocode)

on arrowKey ArKey
   if ArKey = "right" then
     move object in some way this line defines
     send signal to object to initiate animation script within object
   end if
end arrowKey

when I hit my right arrow key ONCE the object moves and then animates ONCE.

HOWEVER, if I keep my finger on the right arrow key the movement 
repeats, but the multiple
instances of the "send signal to object" scriptLine get "saved up" and 
fire at the point I take my finger
off the arrow key; both looking daft and, potentially, interfering with 
what I should see when, say,
I press the left arrow key.

Obviously "this will not do" . . . .

So?

I tried a keyUp script in my cardScript, but that failed to fire.

So?

How can I tell when an end-user ('punter') has stopped pressing an arrowKey?

There is no 'arrowKeyUp' or 'arrowKeyDown' as far as I know.

Richmond.




More information about the use-livecode mailing list