# 1037: packages cannot be nested

**URL:** https://forum.kirupa.com/t/1037-packages-cannot-be-nested/255599
**Category:** flash
**Created:** [March 25, 2008, 5:00am UTC](https://forum.kirupa.com/t/1037-packages-cannot-be-nested/255599 "2008-03-25T05:00:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Evan70](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@Evan70](https://forum.kirupa.com/u/Evan70)
#### Post date: [March 25, 2008, 5:00am UTC](https://forum.kirupa.com/t/1037-packages-cannot-be-nested/255599/1 "2008-03-25T05:00:19Z")

</div>

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:
