# Packages cannot be nested

**URL:** <https://forum.kirupa.com/t/packages-cannot-be-nested/284334>\
**Category:** Uncategorized\
**Created:** [March 18, 2009, 6:10am UTC](https://forum.kirupa.com/t/packages-cannot-be-nested/284334 "2009-03-18T06:10:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsolis](https://avatars.discourse-cdn.com/v4/letter/r/3bc359/32.png) [@rsolis](https://forum.kirupa.com/u/rsolis)\
**Post date:** [March 18, 2009, 6:10am UTC](https://forum.kirupa.com/t/packages-cannot-be-nested/284334/1 "2009-03-18T06:10:39Z")

</div>

Hi Everyone,

Need your help. I am a novice in ActionScript 3.0. I am trying to use the sample code from AS 3.0 tutorial but it return me an error “Packages cannot be nested”. How can I fix it?

Here’s the sample code: fla file format.

package  
{  
import flash.display.Sprite;

```
public class ClickExample extends Sprite
{
    public function ClickExample()
    {
        var child:ChildSprite = new ChildSprite();
        addChild(child);
    }
}

```

}

import flash.display.Sprite;  
import flash.events.MouseEvent;

class ChildSprite extends Sprite  
{  
public function ChildSprite()  
{  
graphics.beginFill(0xFF0000);  
graphics.drawRect(0,0,100,100);  
graphics.endFill();  
addEventListener(MouseEvent.CLICK, clickHandler);  
}

private function clickHandler(event:MouseEvents):void  
{  
trace("clickHandler detected an event of type: " + event.type);  
trace("the this keyword refers to: " + this);  
}  
}

Thanks,  
Roger 🙂
