Step1
first open up Adobe Flash
and start a new document.
make sure you choose Action script 2.
Step2
now make a object you want
to move.
Step3
now select it, right click
and press "convert to symbol...".
Step4
now mark the circle called "movie clip"
and call it what ever you like.
Step5
now that you have made the
movie clip right click on
it and select "Actions".
Step6
a little box will pop-up
click it and type in
A):
onClipEvent (load) {
walkSpeed = 10;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= walkSpeed;
}
if (Key.isDown(Key.RIGHT)) {
_x += walkSpeed;
}
if (Key.isDown(Key.DOWN)) {
_y += walkSpeed;
}
if (Key.isDown(Key.UP)) {
_y -= walkSpeed;
}
}
Step7
or B)
warning this is a bit more advanced and is an edit.
call your object an instance name and then go to the first frame in you flash document and type in:
this.[object instance name].onLoad = function () {
walkSpeed = 10;
}
this.[object instance name].onEnterFrame= function () {
if (Key.isDown(Key.LEFT)) {
_x -= walkSpeed;
}
if (Key.isDown(Key.RIGHT)) {
_x += walkSpeed;
}
if (Key.isDown(Key.DOWN)) {
_y += walkSpeed;
}
if (Key.isDown(Key.UP)) {
_y -= walkSpeed;
}
}
Step8
select "control>Test Movie"
and play around with your game.