// Movement code, v1.1
// ©2002 Tyler Albright
onClipEvent (load) {
gotoAndStop(7);
var inc = 12;
var dir = “Right”;
KeyListener = new Object();
KeyListener.onKeyUp = function() {
if (dir == “Down”) {
gotoAndStop(7);
} else if (dir == “Right”) {
gotoAndStop(5);
} else if (dir == “Up”) {
gotoAndStop(6);
} else if (dir == “Left”) {
gotoAndStop(8);
}
};
Key.addListener(KeyListener);
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
dir = “Left”;
this._x -= inc;
gotoAndStop(4);
} else if (Key.isDown(Key.RIGHT)) {
dir = “Right”;
this._x += inc;
gotoAndStop(1);
} else if (Key.isDown(Key.UP)) {
dir = “Up”;
this._y -= inc;
gotoAndStop(2);
} else if (Key.isDown(Key.DOWN)) {
dir = “Down”;
this._y += inc;
gotoAndStop(3);
}
}
That is the code i used… and it works… but the problem is… it works only on the first scene and the animation doesn’t work when moving can someone find the problem and how can you use it with other scenes…