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;
}
};