# Control/Alt/Soft Detection in AS2.

**URL:** <https://forum.kirupa.com/t/control-alt-soft-detection-in-as2/638045>\
**Category:** Uncategorized\
**Created:** [April 8, 2018, 3:14pm UTC](https://forum.kirupa.com/t/control-alt-soft-detection-in-as2/638045 "2018-04-08T15:14:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bracer](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@Bracer](https://forum.kirupa.com/u/Bracer)\
**Post date:** [April 8, 2018, 3:14pm UTC](https://forum.kirupa.com/t/control-alt-soft-detection-in-as2/638045/1 "2018-04-08T15:14:39Z")

</div>

In Actionscript, you can detect Alt/Control/■■■■ + Whatever other key you press like this:  
AS3:  
stage.addEventListener(KeyboardEvent.KEY\_DOWN, displayKey);

function displayKey(keyEvent:KeyboardEvent)  
{

```
var modifier:String = "";

if (keyEvent.ctrlKey)
{

	modifier = "Ctrl + ";

}
else if (keyEvent.altKey)
{
	modifier = "Alt + ";
}
else if (keyEvent.shiftKey)
{

	modifier = "Shift + ";
}

yText.text = modifier + keyEvent.keyCode;

```

}

In AS2 you can do this:  
var keyListener:Object = new Object();

keyListener.onKeyDown = function()  
{  
yText.text = Key.getCode();  
}  
Key.addListener(keyListener);  
But this AS2 code only allow single detection of keys, does AS2 support detecting of control/Alt/Shift + other keys like AS3 ?
