Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Convert between bases-Integer to String
2D Collision from Explore Science
Cool Control Button
Evil Mouse Puddle
dmmMDB
Update QT3 movies
Font Dialog Behavior
Bounce That Sprite
lingo to php with browser on stage
MP3 Player
 

 

 

Behavior Generic behavior to get Key State.

Added on 3/24/2002

 

Compatibilities:
behavior D6_5 D7 D8 D8_5 PC US

Required Xtras:
KeyboardControl Xtra Standard

This item has not yet been rated

Author: Shockdev

Allows to determine if the key is pressed.

-- 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

Send e-mail