Here are some handlers that I use frequently to do what you are doing. These supply a
bit more than just the control key option. You'd need to rework a few things but maybe
the gest of it could be helpful?
Regards,
Kraig
on keyDown(me)
if isCorrectModifier(me) then
--aCustomKey is your alphabetic key, like "a", or "c", etc.
if isCorrectSecondaryModifier(me, aCustomKey) then
--do something
end if
end if
end
-----------------------------------
--PURPOSE: Determines whether the control key and any additional modifier key are
-- being pressed.
--ACCEPTS: 'me' as an instance of this script.
--RETURNS: Boolean. True if the proper keys are being pressed, false otherwise.
-----------------------------------
on isControl(me)
if (the controlDown) then
if NOT(the shiftDown) then
return(TRUE)
end if
end if
return(FALSE)
end isControl
-----------------------------------
--PURPOSE: Verifies the control key and shift key are both selected.
--ACCEPTS: 'me' as an instance of this script.
--RETURNS: True if mofifier keys are selected. Returns false otherwise.
-----------------------------------
on isControlShift(me)
if (the controlDown) then
if (the shiftDown) then
return(TRUE)
end if
end if
return(FALSE)
end on
-----------------------------------
--PURPOSE: Verifies the the correct mofifier key was selected.
--ACCEPTS: 'me' as an instance of this script.
--RETURNS: True if the modifier is correct. Returns false otherwise.
-----------------------------------
on isCorrectModifier(me)
case pModifier of
"No modifier key":
return(me.isNone())
"Shift Key":
return(me.isShift())
"Control key":
return(me.isControl())
"Shift key and Control key":
return(me.isControlShift())
otherwise:
return(FALSE)
end case
end isCorrectModifier
-----------------------------------
on isCorrectSecondaryModifier(me, aCustomKey)
return(the keyPressed = aCustomKey)
end isCorrectSecondaryModifier
-----------------------------------
--PURPOSE: Verifies that no mofifier key is selected.
--ACCEPTS: 'me' as an instance of this script.
--RETURNS: True if no mofifier key is selected. Returns false otherwise.
-----------------------------------
on isNone(me)
if NOT(the shiftDown) then
if NOT(the controlDown) then
return(TRUE)
end if
end if
return(FALSE)
end isNone
-----------------------------------
--PURPOSE: Verifies the shift key is selected.
--ACCEPTS: 'me' as an instance of this script.
--RETURNS: True if mofifier key is selected. Returns false otherwise.
-----------------------------------
on isShift(me)
if (the shiftDown) then
if NOT(the controlDown) then
return(TRUE)
end if
end if
return(FALSE)
end isShift
Macromedia
606 Townsend
San Francisco, California 94103
U.S.A.
-----------------------------------------
Macromedia CONFIDENTIAL AND PROPRIETARY
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]