1037: packages cannot be nested

I am using Flash cs3 with AS 3.0 and trying to experiment with code given in the "Actionscript 3.0 Cookbook"

I apply the script to a keyframe in layer1 where I would place my scripts,

**The error I am getting is [COLOR=Red]1037: packages cannot be nested[/COLOR]****[COLOR=Red]

[/COLOR]**[COLOR=Black]I have gone over it again and again, and can’t figure out what I am doing wrong.

I even tried just saving it as an “.as” file then in the upper right hand corner “targeted it” to a .fla file. Nothing.

I think I’m either not applying the code right or putting it in the right place or else I need to alter the code somehow.

Has anyone else used this book or run into this problem?
[/COLOR][COLOR=Red]
[/COLOR]This is the code:

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

    public  class  Velocity extends Sprite {
        private var _sprite:Sprite;
        private var _vx:Number = 3;
    
        public function Velocity () {
        _sprite =new Sprite();
        _sprite.graphics.beginFill(0x0000ff, 100);
        _sprite.graphics.drawCircle(0, 0, 25);
        _sprite.graphics.endFill();
        _sprite.x =50;
        _sprite.y =100;
        addChild (_sprite);
        addEventListener(Event.ENTER_FRAME, onEnterFrame);
}

public function onEnterFrame(event:Event):void{ 
    _sprite.x += _vx;
}

}
}

Any Ideas would be greatly appreciated!:puzzled: