Help with movement animation

Please help me make it so when my character moves is plays the whole movement animation and not just one frame. Heres the code:

onClipEvent (load) {
moveSpeed = 4;
}
onClipEvent (enterFrame) {
if (Key.isDown (Key.RIGHT)) {
this._x += moveSpeed; _xscale = -100;
this.gotoAndPlay(1);
}
if (Key.isDown (Key.LEFT)) {
this._x -= moveSpeed; _xscale = 100;
this.gotoAndPlay(1)
}
 

the movemnt animation is 10 frames long but it only plays the first frame in the movie clip and then stops.

I want it to be something like this http://baiwanfuong.notix.net/tienzsiyusi.htm

Please help me Chen!

hm i think that should work, you haven’t got a stop(); in any keyframes inside the movie clip have you? if u haven’t try:

onClipEvent (load) {
moveSpeed = 4;
}
onClipEvent (enterFrame) {
if (Key.isDown (Key.RIGHT)) {
this._x += moveSpeed;
_xscale = -100;
walking1 = true;
}else{
walking1 = false;
}
if (Key.isDown (Key.LEFT)) {
this._x -= moveSpeed;
_xscale = 100;
walking2 = true;
}else{
walking2 = false;
}
if(walking1 || walking2){
this.gotoAndPlay(2);
}else{
this.gotoAndStop(1);
}
}
</pre> you’ve probably put stop(); in the first keyframe of the walking movie clip haven’t u, that should be ok to delete if you use the above code. but if u want to keep it in the last keyframe of the movie clip you’ll need gotoAndPlay(2); else it’ll go to the first one and stop again.

This is just what I’ve been working with the last two weeks.
I’ll give you an example of how mine works.
I’ve got a movie clip of the character, where frame 1 is facing north, 2 contains a movie clip where he walks north, 3 is facing south, 4 is another movie clip where he walks south and so on.

onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
setProperty (this, _x, this._x-5);
if (_currentframe != 6) {
gotoAndStop(6);
}
}

This isn’t really how my code looks now, since I can only find an early version of my project here. But it works anyways.
If you’re not in frame 6, which is the walk left frame, it will go there. Since there is a movie clip inside the frame, gotoAndStop will work fine.