[FMX] Creating a Ctrl Click

Is it possible to detect a key press along side a mouse click eg

A movie clip clicked
Click = false 

But if the same movie is clicked whilst holding down the Ctrl key 
Click = true

Basically its an action listener for the control key.

What is the best way to do this (when I say best I really mean easiest)

I will be using this in a jigsaw puzzle scenario and when a piece is Ctrl Clicked the piece will rotate but when its clicked regularly it will just follow the mouse.

First set up a key listener.

theListener = new Object();


then set up your onPress function

_root.movieName.onPress = function(){
if Key.isDown(Key.CONTROL){

That should do it.

Cheeres for that one there rolando.lopez it worked like a charm :thumb:

the key listener is not necessary

so the Key.isDown function is available without a listener?

could you just stick it straight onto a onClipEvent(enterFrame)?

if you put it on an enterframe, then anytime you press control your actions will happen.

*Originally posted by rolando.lopez *
**so the Key.isDown function is available without a listener? **


a key listener recieves events based on key actions. That means when a key action occurs, something like a key down, the “onKeyDown” function within the listener will be called. Listeners have no effect on things outside of that object and the methods within it.

Key.isDown is a property all the same as Key.CONTROL - no need for a listener - and if it was needed, it would need to be Key, not some random object