-- Generic behavior to get key state
-- KeyboardControl Xtra 1.1 or later required
property Key
on getPropertyDescriptionList
set description = [:]
addProp description, #Key, [#default: "", #format:#string, #comment:"Key to be checked:"]
return description
end
on getBehaviorDescription
return "Gets the State of a given Key"
end
on enterFrame
getState
end
on getState
set Ok = KeyboardControlIsKeyDown(Key)
if getAt(Ok,1) = 0 then
case getAt(Ok,3) of
0: set KeyState = "Up"
1: set KeyState = "Down"
end case
if KeyState = "Down" then
put "The following key is pressed: " & Key
end if
else
-- An error has occured, show error code
alert("Error: " & getAt(Ok,1) & " - base error code")
end if
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA