# \[FMX\] Creating a Ctrl Click

**URL:** <https://forum.kirupa.com/t/fmx-creating-a-ctrl-click/34184>\
**Category:** flash\
**Created:** [October 29, 2003, 2:02pm UTC](https://forum.kirupa.com/t/fmx-creating-a-ctrl-click/34184 "2003-10-29T14:02:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![davymacca](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@davymacca](https://forum.kirupa.com/u/davymacca)\
**Post date:** [October 29, 2003, 2:02pm UTC](https://forum.kirupa.com/t/fmx-creating-a-ctrl-click/34184/1 "2003-10-29T14:02:40Z")

</div>

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.  
:h:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 29, 2003, 3:33pm UTC](https://forum.kirupa.com/t/fmx-creating-a-ctrl-click/34184/2 "2003-10-29T15:33:03Z")

</div>

First set up a key listener.

```auto

theListener = new Object();

Key.addListener(theListener);

```

then set up your onPress function

```auto

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

```

That should do it.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 29, 2003, 4:00pm UTC](https://forum.kirupa.com/t/fmx-creating-a-ctrl-click/34184/3 "2003-10-29T16:00:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 29, 2003, 4:02pm UTC](https://forum.kirupa.com/t/fmx-creating-a-ctrl-click/34184/4 "2003-10-29T16:02:06Z")

</div>

the key listener is not necessary

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 29, 2003, 4:05pm UTC](https://forum.kirupa.com/t/fmx-creating-a-ctrl-click/34184/5 "2003-10-29T16:05:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 29, 2003, 4:05pm UTC](https://forum.kirupa.com/t/fmx-creating-a-ctrl-click/34184/6 "2003-10-29T16:05:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 29, 2003, 4:09pm UTC](https://forum.kirupa.com/t/fmx-creating-a-ctrl-click/34184/7 "2003-10-29T16:09:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 29, 2003, 4:10pm UTC](https://forum.kirupa.com/t/fmx-creating-a-ctrl-click/34184/8 "2003-10-29T16:10:52Z")

</div>

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

yes.

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

😉
