Very simple setup here. I made a object and made it a symbol and converted to symbol
(named it Ball
). Then exported it for ActionScript.
I then made a actionscript file and named it Main.as and insterted the following under.
public class Main extends Sprite
private var ball:Ball;
private var speed:Number = 5;
public function Main ():void
ball = new Ball();
ball.x = stage.stageWidth/2;
ball.y = stage.stageHeight/2;
private function KeyDown (key:KeyboardEvent):void
ball.x -= speed;
ball.x += speed;
ball.y -= speed;
ball.y += speed;
Bare in mind that this is NOT the best way to do it. It is just a simple way to get you started.
If you want to have more smooth flow in the movement and add some physic, check out Foundation Actionscript 3.0 Animation: Making Things Move! great book to start with.
Good luck with your scripting!