# Flipping movie clip left/right

**URL:** <https://forum.kirupa.com/t/flipping-movie-clip-left-right/318272>\
**Category:** flash\
**Created:** [January 15, 2011, 1:53am UTC](https://forum.kirupa.com/t/flipping-movie-clip-left-right/318272 "2011-01-15T01:53:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flip11](https://avatars.discourse-cdn.com/v4/letter/f/eb8c5e/32.png) [@flip11](https://forum.kirupa.com/u/flip11)\
**Post date:** [January 15, 2011, 1:53am UTC](https://forum.kirupa.com/t/flipping-movie-clip-left-right/318272/1 "2011-01-15T01:53:11Z")

</div>

Hello, I am trying to flip a character in a game left/right when pressing the left/right key. I have got the movieclip to do this by changing it every time you press the key, but if you hold it down it spazzes and flips back and forth, can you help?

I have attached the .fla

Thanks

var speed:Number = 10;  
object\_mc.onEnterFrame = function() {  
if (Key.isDown(Key.RIGHT)) {  
this.\_x = this.\_x+speed;  
this.\_xscale \*= -1;  
} else if (Key.isDown(Key.LEFT)) {  
this.\_x = this.\_x-speed;  
this.\_xscale \*= -1;  
}  
if (Key.isDown(Key.UP)) {  
this.\_y = this.\_y-speed;  
} else if (Key.isDown(Key.DOWN)) {  
this.\_y = this.\_y+speed;  
}  
};
