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
Animate Text Shadow
3DVista Studio Director Xtra
Shockwave Remote Faq
Invaders
Resizing Flash Sprite to its Original Size
Generic behavior to set Wallpaper
Toggle ImageEnabled Property of a Flash Member
FreePPP Control
DriveInfo
Pan QTVR Sprite
 

 

 

Behavior Wait for a Keypress

Added on 7/6/2000

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: KumarK

Wait for a Keypress

---- written for Director 8 ---
---- Kumar.K ----
---- kumark@icode.com ----

------ Custom Properties ------

property  WhereTo,whichkey

------ Get Behavior Description List ------
on getPropertyDescriptionList me
  set description = [:]
  if the currentspritenum <> 0 then exit
  actionlist=["Go Next Frame","Go Next Marker","Go Previous Marker","Go Loop","Exit"]
  keylist=["Backspace Key","Enter Key","Return Key","Space Key","Tab Key","Left Arrow","Right Arrow","Up Arrow","Down Arrow"]
  addProp description, #whichkey, [#comment: "wait for Which Key ?",#format:#String,#range:keylist,#default:keylist[1]]  
  addProp description, #WhereTo, [#comment: "What Next(after a Key press or Mouse Click) ?",#format:#String,#range:actionlist,#default:actionlist[1]]
  return description
end getPropertyDescriptionList
------ Get Behavior Description List ------

-- Get Behavior description --
on getBehaviorDescription me
  return
    "Wait for a KeyPress" & RETURN & RETURN &
    "This Behavior make the playback head hold on a frame untill a key press . " &
    "PARAMETERS:" & RETURN &
    "* Which Key :" & RETURN &
    "* What to Do after Key press."
end getBehaviorDescription
-- Get Behavior description --

------ Availbale for only Frame Script ------
on isOKToAttach (me, aSpriteType, aSpriteNum)
  case aSpriteType of
    #graphic:
      return false
    #script:
      return true
  end case
end isOKToAttach
------ Availbale for only Frame Script ------

-- Events --
on ExitFrame me
  go the frame
end ExitFrame

on keydown
  case whichkey of
    "Backspace Key":if the key=backspace then whatnext
    "Enter Key":  if the key=Enter then whatnext
    "Return Key":  if the key=RETURN then whatnext
    "Space Key":if the key=space then whatnext
    "Tab Key": if the key=Tab then whatnext  
    "Left Arrow":if the keycode = 123 then whatnext
    "Right Arrow":if the keycode = 124 then whatnext  
    "Up Arrow":   if the keycode = 126 then whatnext  
    "Down Arrow":   if the keycode = 125 then whatnext        
  end case  
end keydown
------ Events ------

----custom handlers----
on whatnext
  case WhereTo of
    "Go Next Frame":Go the frame + 1
    "Go Next Marker": Go Next
    "Go Previous Marker": Go previous
    "Go Loop": Go Loop
    "Exit":quit
  end case
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail