Hola,
aquí te dejo un ejemplo:
Código ActionScript :
//creamos la pelota
var ball:Sprite = new Sprite();
var radius:int = 16;
var g:Graphics = ball.graphics;
g.beginFill(0xFF0000);
g.drawCircle(0, 0, radius);
g.endFill();
ball.x = stage.stageWidth / 2;
ball.y = stage.stageHeight / 2;
addChild(ball);
//variables para guardar los cuatro bordes del sprite de la pelota
var ballLeft:Number;
var ballRight:Number;
var ballUp:Number;
var ballDown:Number;
//velocidades en las direcciones x e y, que en este ejemplo estarán aleatoriamente entre 0 y 10
var speedX:int = 10 * Math.random();
var speedY:int = 10 * Math.random();
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
function enterFrameHandler(event:Event)
{
ballLeft = ball.x - radius;
ballRight = ball.x + radius;
ballUp = ball.y - radius;
ballDown = ball.y + radius;
if (ballLeft < 0 || ballRight > stage.stageWidth) speedX *= -1;
if (ballUp < 0 || ballDown > stage.stageHeight) speedY *= -1;
ball.x += speedX;
ball.y += speedY;
}