I'm working in an application that is a kind of presentation with lots of content that should be displayed in "frames".

But I realized, after some struggle, that to put all the content inside the .FLA file doesn't work. Just a couple of tables with text imported from ms word are enough to let the FLA file unusable, even though it occupies little space on disk.

So I've written a function that loads content from an XML file and display it into a movieclip, that contains empty textfields and image containers. Another function organizes the content.

The problem is that the SWF file gets extremely heavy after navigating over a couple of frames, and I believe is shouldn't cause all the content is dynamic. I managed to remove all the listeners and loaded images.

If i have the windows task manager(ctrlalt del) opened while the Flash application is on, I notice that every time I update the content of a "frame" by clicking on a menu item or the navigation buttons, the flashplayer consumes more and more memory.

Why???
Thanks in advance!!!

Here are the functions:

Code:
function gotoPrevFrame():void {
	if (int(_link)>1)
	{
		linkInt=int(_link);
		linkInt--;
		_link=String(linkInt);
		updateContent(_link);
		formatContent();
	}
	else if (int(_link)==1)
	{
		container.gotoAndStop(1);
		_link="0";
	}
	updateFrameCount();
	resizeListener(null);
}

function gotoNextFrame():void
{
	trace ("int: "+ int(_link));
	trace ("cl: "+ (conteudo.length()-1));
	
	if (int(_link)==0)
	{
		container.gotoAndStop(2);
		_link="1";
	} else if (int(_link)  <conteudo.length()-1)
	{
		linkInt=int(_link);
		linkInt++;
		_link=String(linkInt);
		updateContent(_link);
		formatContent();
	}
	updateFrameCount();
	resizeListener(null);
}

function updateContent(link: String):void {

	counter=60;

	// TITULO

	if (conteudo[link].tit!=undefined) {
		container._tit.text=conteudo[link].tit;
		container._tit.y=counter;
		// sempre haverá um tÃ*tulo
		counter+=40;
	} else {
		container._tit.text="";
	}

	// SUB-TITULO

	if (conteudo[link].subtit!=undefined) {
		container._subtit.text=conteudo[link].subtit;
		container._subtit.y=counter;
		counter+=40;
	} else {
		container._subtit.text="";

		//container._txt.y = container._tit.y + 40;
	}

	// TEXTO

	if (conteudo[link].txt!=undefined) {
		trace("tem texto");
		//trace (conteudo[link].txt);
		container._txt.autoSize=TextFieldAutoSize.CENTER;
		container._txt.getCharBoundaries(100);
		container._txt.htmlText=conteudo[link].txt;

		container._txt.y=counter+20;

		counter+=container._txt.height;

	} else {
		container._txt.htmlText="";
	}

	// IMAGEM

	if (container._img.numChildren>0)
	{
		container._img.removeChildAt(0);
	}

	if (conteudo[link].img!=undefined) {
		imgLoader.load(new URLRequest(conteudo[link].img.@link));
		imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);
		counter++;
	} else {

	}
}

function updateFrameCount():void
{
	menu_inf.frameCount.text=String(int(_link)+1)+"/"+conteudo.length();
}

function imgLoaded(e:Event):void {
	var imgLoader:Loader=Loader(e.target.loader);
	imgLoader.name="img";
//	imgLoader.x = -stage.stageWidth/2;
	container._img.addChild(imgLoader);
//	container._img.imgLoader.x = -stage.stageWidth /2;
	container._img.y=counter+40;

	//if (conteudo[link].txt != undefined)
	//{
	//container._img.y = container._img.y + (container._txt.height - 20);
	//trace ("hhh: "+container._txt.height);
	//}

	imgLoader.removeEventListener(Event.COMPLETE, imgLoaded);

	formatContent();
}

function resizeListener(e:Event):void {
	initMenu();

	trace("resizing");

	resizeMe(background, stage.stageWidth, stage.stageHeight);
	//if (container._img)

	menu_inf.x=stage.stageWidth/2;
	menu_inf.y=stage.stageHeight;
	menu_inf.frameCount.x=- stage.stageWidth/2+10;
	menu_inf.btn_container_right.x=stage.stageWidth/2-10;
	
	formatContent();
}

function formatContent()
{
//	o frame 1 do container tem a pagina de apresentacao
// e o frame 2 um esqueleto para todas as outras
// quando vou do frame 1 para  2 e vice-versa  da problemas
// porque o flash nao identifica os objetos textfields, etc.
// como resolver isso'?
		
	container.x=(stage.stageWidth)/2;

	if (container.currentFrame==1)
	{
		trace ("cur.Frame: " + container.currentFrame);
		trace ("maintitle: " + container._maintitle);
		
		container._maintitle.y = (stage.stageHeight - container._maintitle.height)/2 - 120;
//		container._maintitle.x = (stage.stageWidth)/2 - container._maintitle.width/2;

		container._logocrescer.y = (stage.stageHeight)/2 + 110;
//		container._logocrescer.x = (stage.stageWidth)/2;
	}
	if (container.currentFrame==2)
	{
		//container._txt.getCharBoundaries(100);
		if (stage.stageWidth <= 800){
			container._txt.width = container._txt2.width = stage.stageWidth - 20;
			container._txt2.width  = stage.stageWidth - 20;
		}else if (stage.stageWidth <= 900){
			container._txt.width = container._txt2.width = stage.stageWidth/1.1;
		}else if (stage.stageWidth <= 1000){
			container._txt.width = container._txt2.width = stage.stageWidth/1.2;
		}else if (stage.stageWidth <= 1100){
			container._txt.width = container._txt2.width = stage.stageWidth/1.3;
		}else{
			container._txt.width = container._txt2.width = stage.stageWidth/1.4;
		}
			

		container._txt.x = 	-(container._txt.width/2);
		container._txt2.x = -(container._txt2.width/2);

		container._img.x = -container._img.width/2;
		container._img.y = container._txt.y+container._txt.height+25;
	}
}