Problem creating component

hi! i’m trying to create a simple component like a button. all seems to be working fine, the only problem is that anything i put on “avatar layer” doesn’t disappear when compiling. here’s my class code


package {
	
	import flash.display.MovieClip
	import flash.display.Sprite 
	import flash.text.*
	import flash.display.Loader;
	import flash.net.URLRequest;
	import flash.display.SimpleButton;
	import flash.events.MouseEvent;
	import flash.filters.GlowFilter;
	import flash.events.MouseEvent;
	
	public class boton extends Sprite {
		
		private var glyphName:	String;
		private var glyph:		Sprite;
		private var glyphSpace:	Number;
		private var texto:		TextField;
		private var formato:	TextFormat;
		private var tipo:		String;
		private var ancho:		Number;
		private var alto:		Number;
		private var clipBoton:	Sprite;
		private var textoTrans:	String; 
		
		
		public function boton() {}
		
		
		private function seteos():void {

			var glyphTop:Number;

			switch (tipo) {
				case "PP":
					ancho=80;
					alto=70;
					glyphSpace=20;
					glyphTop=15;
					clipBoton = new botonPP() as Sprite;
					break;
				case "P":
					ancho=133;
					alto=62;
					glyphSpace=15;
					glyphTop=10;
					clipBoton = new botonP() as Sprite;
					break;
				case "G":
					ancho=210;
					alto=58;
					glyphSpace=25;
					glyphTop=15;
					clipBoton = new botonG() as Sprite;
					break;
				default:
					tipo="M";
					ancho=162;
					alto=58;
					glyphSpace=25;
					glyphTop=15;
					clipBoton = new botonM() as Sprite;
			}
			
			addChildAt(clipBoton,0)

			if (tipo != "PP") {
				var fuente:Font = new Bell();
				formato = new TextFormat()
				formato.font=fuente.fontName
				formato.color=0x000000
				formato.size=16
				formato.align="center"

				texto = new TextField()
				texto.embedFonts=true;
				texto.antiAliasType = AntiAliasType.ADVANCED;
				texto.selectable=false;
				texto.defaultTextFormat=formato;
				texto.text = textoTrans;
				texto.width=(glyphName!="nada")?ancho-(glyphSpace+50):ancho;
				texto.height=30;
				texto.x=(glyphName!="nada")?(glyphSpace+35):5;
				texto.y=glyphTop+5
				addChild(texto)
			}
		
			if (glyphName!="nada") {
				var loader:Loader = new Loader();
				loader.load(new URLRequest(glyphName));
				glyph = new Sprite()
				glyph.addChild(loader)
				glyph.x=glyphSpace;
				glyph.y=glyphTop;
				addChild(glyph)
			}	
			addEventListener(MouseEvent.MOUSE_OVER,mouseOver)
			addEventListener(MouseEvent.MOUSE_OUT,mouseOut)
		}
		
		private function mouseOver(e:MouseEvent):void {
			var filtro:Array = new Array();
			var glow:GlowFilter = new GlowFilter(0x0098FF,0.5,6,6,2,1);
			filtro.push(glow);
			clipBoton.filters=filtro;
		}
		
		
		private function mouseOut(e:MouseEvent):void {
			clipBoton.filters=[];
		}
		
		
		[Inspectable(defaultValue="", type="String")]
		public function set label(txt:String) {
			textoTrans=txt;
			if (glyphName && tipo) seteos();
		}
		
		public function get label():String {
			return texto.text;
		}
		
		[Inspectable(defaultValue="", type="String")]
		public function set grafico(txt:String) {
			glyphName=txt;
			if (textoTrans && tipo) seteos();
		}
		
		public function get grafico():String {
			return glyphName;
		}
		
		[Inspectable(defaultValue="M", type="String")]
		public function set tamano(tam:String) {
			tipo=tam;
			if (glyphName && textoTrans) seteos();
		}
		
		public function get tamano():String {
			return tipo;
		}
		
	}
}


thanks!