# AS2 - Rotate an mc with keystrokes

**URL:** <https://forum.kirupa.com/t/as2-rotate-an-mc-with-keystrokes/331978>\
**Category:** flash\
**Created:** [December 13, 2013, 7:23pm UTC](https://forum.kirupa.com/t/as2-rotate-an-mc-with-keystrokes/331978 "2013-12-13T19:23:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skarab](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@Skarab](https://forum.kirupa.com/u/Skarab)\
**Post date:** [December 13, 2013, 7:23pm UTC](https://forum.kirupa.com/t/as2-rotate-an-mc-with-keystrokes/331978/1 "2013-12-13T19:23:32Z")

</div>

I’ve got a movie clip that I am rotating with the left and right arrow keys and it seems to be a bit buggy. Here’s the code:

```auto

var keyListener:Object = new Object();
Key.addListener(keyListener);
keyListener.onKeyDown = function(){
    if(Key.isDown(Key.RIGHT)){
    rotateContainer_mc.nextFrame();
    }
    else if
    (Key.isDown (Key.LEFT)) {
        rotateContainer_mc.prevFrame();
        };
};

```

In each frame it is rotated one degree and it rotates 15 degrees. But sometimes, instead of fifteen key strokes, it will rotate the whole range in 5 or even 3 keystrokes. Very frustrating! Is there a better solution for this?
