I sort of just started messing around with as3 and i'm trying to get movement down but i'm having a problem with two things, for some reason the basic standing animation want play when i run it, and the speedup animation in which i tried to play want work either, both just stop at the first frame of the animation and want play anymore, both are movieclips on a frame inside a movieclip, can somebody help please? and by the way i put key.isdown because i'm using the KeyObject for as3 which allows you to Here's my code:
sonic.gotoAndStop('stand'; var Key:KeyObject = new KeyObject(stage); stage.addEventListener(Event.ENTER_FRAME ,onkey); var sonicspeed:Number = 0; var friction:Number = .6 //movement function onkey(e:Event):void{ sonic.x += sonicspeed; if (sonic.x > 550){ sonic.x = 0; }else if(sonic.x < 0){ sonic.x = 550; }if (Key.isDown(Key.LEFT)){ sonic.scaleX=1; sonicspeed -= 1.5; sonic.gotoAndStop('run'; }else if (Key.isDown(Key.RIGHT)){ sonic.scaleX=-1; sonicspeed += 1.5; sonic.gotoAndStop('run'; }else{ sonic.gotoAndStop('walk'; sonicspeed *= friction; } //speed properties if (sonicspeed > 40){ sonicspeed = 40; sonic.gotoAndStop('speeding'; }if (sonicspeed < -40){ sonicspeed = -40; [b]sonic.gotoAndStop('speeding';[/b] }if (Math.abs(sonicspeed)< 0.001){ sonic.gotoAndStop('slowing'; } if (Math.abs(sonicspeed)< 0.00009){ sonic.gotoAndStop('stand'; sonicspeed = 0; } }