# If Key.isDown, stay down? Toggle Switch?

**URL:** <https://forum.kirupa.com/t/if-key-isdown-stay-down-toggle-switch/323099>\
**Category:** Uncategorized\
**Created:** [June 16, 2011, 8:32pm UTC](https://forum.kirupa.com/t/if-key-isdown-stay-down-toggle-switch/323099 "2011-06-16T20:32:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![magicart87](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@magicart87](https://forum.kirupa.com/u/magicart87)\
**Post date:** [June 16, 2011, 8:32pm UTC](https://forum.kirupa.com/t/if-key-isdown-stay-down-toggle-switch/323099/1 "2011-06-16T20:32:35Z")

</div>

How do I make it so that a key down function acts as a hard on/off switch, Instead of the momentary temporary toggle normally associated with “if Key.isdown”

Example: The “CONTROL” key is pressed, gotoAndPlay’s an action, until the key is pressed again, which then gotoAndStop’S the action. Would I still use “if Key.isDown” or something else entirely. I know it’s possible, as I have done it in the past, but for the life of me; can’t remember how!? How do create a key-press to act as on/off switch?

_Any_ pointers would be most appreciated!
