# Keep going after key is released?

**URL:** <https://forum.kirupa.com/t/keep-going-after-key-is-released/295522>\
**Category:** flash\
**Created:** [August 31, 2009, 8:09pm UTC](https://forum.kirupa.com/t/keep-going-after-key-is-released/295522 "2009-08-31T20:09:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Press\_Tilty](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@Press\_Tilty](https://forum.kirupa.com/u/Press_Tilty)\
**Post date:** [August 31, 2009, 8:09pm UTC](https://forum.kirupa.com/t/keep-going-after-key-is-released/295522/1 "2009-08-31T20:09:15Z")

</div>

So I have this code:

```auto

if (Key.isDown(Key.SPACE) {
		if (rotationPM != 360) {
			this._rotation += 65;
			rotationPM += 60;
		} else if (rotationPM == 360) {
			this._rotation = 0;
		}
	} else {
		this._rotation = 0;
		rotationPM = 0;
	}

```

(rotationPM is declared as 0 on load)  
So what it does, is the character rotates around for as long as you hold down the SPACE, or until rotation = 360. When it hits 360, rotationPM/\_rotation both set to 0. That all works fine. Unfortunately, it takes time to do a 360.

What my question is…can I have it do the 360 even if you de-press SPACE halfway through?

Functions seem like they could be an answer, but I don’t know AS 2 functions (I have used C++ functions, so I know the idea).

If someone thinks that functions would work, pleas point me to a tutorial.

THX  
Press Tilty
