detecting for how long a key is being pressed

Oliver Hardt oliver.hardt at mac.com
Tue Sep 6 18:07:12 EDT 2005


hi Malte:  thanks for the script -- the trick with keeping track of  
the last key pressed worked fine.  it solved my problem.  best, olli.

On 6-Sep-05, at 5:22 PM, Malte Brill wrote:

> Hi olli,
>
> here is a starter. it is not absolutely reliable, as the user might  
> hit 2 keys, one after another. If you need a more reliable script  
> just let me know.
>
> In the card script:
>
> global gOldKey,gStartMillisecs
>
> on rawKeyDown theKey
>   if theKey<>gOldKey then
>     put theKey into gOldKey
>     put the milliseconds into gStartMillisecs
>   end if
> end rawKeyDown
>
> on rawKeyUp
>   put the milliseconds-gStartMillisecs
>   put empty into gOldKey
> end rawKeyUp
>
> Hope that helps,
>
> Malte
>
> ---
> ArcadeEngine - prepare to WOW your audience within minutes
> http://www.runrev.com/section/revselect/arcadeengine
> http://www.derbrill.com/arcadeengine/forum  
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list