# Quick code fix needed, probably real simple

**URL:** https://forum.kirupa.com/t/quick-code-fix-needed-probably-real-simple/283960
**Category:** flash
**Created:** [March 12, 2009, 11:33pm UTC](https://forum.kirupa.com/t/quick-code-fix-needed-probably-real-simple/283960 "2009-03-12T23:33:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Frey](https://avatars.discourse-cdn.com/v4/letter/f/aeb1de/32.png) [@Frey](https://forum.kirupa.com/u/Frey)
#### Post date: [March 12, 2009, 11:33pm UTC](https://forum.kirupa.com/t/quick-code-fix-needed-probably-real-simple/283960/1 "2009-03-12T23:33:31Z")

</div>

Right basically I have a character and a background. The background scrolls as you press left or right on keyboard to create the illusion of movement.

I want the character to flip when you change from holding down left to right and vice versa, but when I do the following code it doubles the size of the character once and then it stays. It flips fine but in the transformed fat size. Any ideas?

Here’s the code:

```auto
var mySpeed:Number = 10;

function keyIsDown(evt:KeyboardEvent):void{
    
    if(evt.keyCode==Keyboard.RIGHT){
        walkingPlane_mc.x+=mySpeed;
        greyCharacter_mc.scaleX=-1;
    }
    
    if(evt.keyCode==Keyboard.LEFT){
        walkingPlane_mc.x-=mySpeed;
        greyCharacter_mc.scaleX=+1;
    }
}

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyIsDown);

```
