AS 3 getBounds

Can anyone of you guys help me out with this one?

The following piece of code works in the timeline:

var ball:Sprite = new Sprite;
addChild(ball);
ball.graphics.beginFill(Math.random()*0xff0000);
ball.graphics.drawCircle(0,0,10);
ball.graphics.endFill();

var speedX = +10;
var speedY = +10;

addEventListener(Event.ENTER_FRAME, enterFrameHandler);

function enterFrameHandler(event:Event):void
{
ball.x += speedX;
ball.y += speedY;
var bounds:Rectangle = ball.getBounds(stage);

if (bounds.left < 0 || bounds.right > stage.stageWidth)
{
    speedX *=  -1;
}


if (bounds.top < 0 || bounds.bottom > stage.stageHeight)
{
    speedY *=  -1;
}

}

I am trying to achieve a similar result by using an external file but I can’t figure out how to do it.
Here is the AS 3 file I’m having a problem with:

package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Rectangle;

public class Ball extends Sprite
{
    private var ball:Sprite = new Sprite  ;
    private var speedX:int = +10;
    private var speedY:int = -10;


    public function Ball()
    {


        addChild(ball);
        ball.graphics.beginFill(Math.random()*0xffffff);
        ball.graphics.drawCircle(0,0,20);
        ball.graphics.endFill();
        addEventListener(Event.ENTER_FRAME, enterFrameHandler);


    }


    private function enterFrameHandler(event:Event):void
    {
        ball.x += speedX;
        ball.y += speedY; 
        
        var bounds:Rectangle = ball.getBounds(stage);
        
        if (bounds.left < 0 || bounds.right > stage.stageWidth)
        {
            speedX *=  -1;
        }


        if (bounds.top < 0 || bounds.bottom > stage.stageHeight)
        {
            speedY *=  -1;
        }
                    
    }


}

}

Is the stage accessed differently with the getBounds method in an external file than in the timeline?

I’d really appreciate it if anyone can help me out with this one.

Thanks.

globo23