Final Preview:
Use Keyboard Arrow Keys to move up, bottom, left, right.
Step-1 Open a new document in Flash.
Step-2 Create a boy head or whichever you like.
Step-3 Convert it into “movie clip” and name it as “sprite”.
Step-4 Write the following action script in a new layer, Key frame-1.
spriteDirection = 0;
setInterval(function () {
if (Key.isDown(Key.RIGHT)) {
setDirection(0);
_root.sprite._x += 3;
}
if (Key.isDown(Key.LEFT)) {
setDirection(1);
_root.sprite._x -= 3;
}
if (Key.isDown(Key.DOWN)) {
_root.sprite._y += 3;
}
if (Key.isDown(Key.UP)) {
_root.sprite._y -= 3;
}
updateAfterEvent(); }, 10);
Leave a Reply