Page 1 of 1

Space Bar?

Posted: Tue Apr 01, 2008 2:22 pm
by gjn1w07
Hi,

Sorry if this seems to be a simple question - I'm quite new to this!

What is the command to make something happen when someone presses the space bar? I know for instance that for the tab key it's on tabKey, but I can't seem to find the equiviliant for the space bar.

Thanks in advance!

Posted: Tue Apr 01, 2008 3:39 pm
by BvG
there is no specific message for the space key, because it's not a modifier key, like shift and the others. You can catch it with the key or rawkey messages, for example:

Code: Select all

on keyUp theKey
  if theKey = space then
    --do stuff here
  end if
end keyUp
if you want to do something while the spacebar is down in some other messag, then this could be one way to do it:

Code: Select all

on mouseUp
  if 65293 is among the items of the keysDown then
    --spacebar is down
  end if
end mouseUp

Thanks!

Posted: Wed Apr 02, 2008 9:52 am
by gjn1w07
Great that's exactly what I needed. Cheers!