PLS help with correct unloading of UILoader - external SWF

Hey Guys,

I am a self taught newbie and after putting together a heavy interactive flash DVD presentation, I am running into serious Memory leak issues that i didnt even know about before…

I created a main menu carousel. On click of one of the menu items a already preset UILoader (on Timeline on top of the carousel) will attach/load the requested external SWF and fade out the main menu. A back button will unload the UILoader and take you back to the fade in of the main menu carousel and so on… Each external loaded SWF has user interactivity (buttons) inside of them to then load mostly videos into a FLV Playback component.

To show and hide the UILoader (transitional) i am using FlashEFF2 and as tweening engine TwennLite. For simplicity reasons i reduced the attached code to only one menu item being clickable.

The problem is that while running the presentation and loading n unloading the swf the app gets very sluggish/slow and i can see in my memory monitor that the memory increases with each load…

my guess is that i am not unloading the UILoader properly and the content is not getting garbage collected…but as already mentioned i am a newbie and would really appreciate some help guys…:puzzled:

im working on Mac/Flash CS4/FP10 (if that helps).
What do i need to change on my code or add to make the removed items disappear from the memory? :sigh:

Here my code:

import gs.TweenLite;
import gs.easing.*;

///////////////////////////Flash EFF START
import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.symbol.stripes.FESStripesNo2;

var myPattern:FESStripesNo2 = new FESStripesNo2();
var myEffect:FlashEff2Code = new FlashEff2Code();
myPattern.tweenDuration = 3;
//myPattern.waveThickness = 25;

myEffect.showTransition = myPattern;
myEffect.showDelay = 0;
myEffect.showAutoPlay = false;
myEffect._targetInstanceName = "myUILoader";

myEffect.hideTransition = myPattern;
myEffect.hideDelay = 0;
myEffect.hideAutoPlay = false;
myEffect._targetInstanceName = "myUILoader";
/////////////////////////////////FLASH EFF END

/////////////////////CAROUSEL START////////////////////////////
var centerX:Number = 640;
var centerY:Number = 480;
var radiusX:Number = 300;
var radiusY:Number = 50;
var speed:Number = 0.03;
var minSpeed:Number = -0.03;
var maxSpeed:Number = 0.03;
var rangeSpeed:Number = maxSpeed - minSpeed;
var minY:Number = centerY - radiusY;
var maxY:Number = centerY + radiusY;
var rangeY:Number = maxY - minY;
var minScale:Number = 0.6;
var maxScale:Number = 1;
var rangeScale:Number = maxScale - minScale;
var itemArray:Array = new Array();

var M1: MenuItem1 = new MenuItem1;
var M2: MenuItem2 = new MenuItem2;
var M3: MenuItem3 = new MenuItem3;


var canvas:MovieClip = new MovieClip();

for (var i:Number = 0; i < itemArray.length; i++)
	itemArray*.itemAngle = Math.PI * 2 / itemArray.length * i;

function animate(e:Event):void
	speed = (mouseX - centerX)/30000;
	e.currentTarget.x = Math.cos(e.currentTarget.itemAngle) * radiusX + centerX;
	e.currentTarget.y = Math.sin(e.currentTarget.itemAngle) * radiusY + centerY;
	e.currentTarget.itemAngle += speed;
	for(var i:Number = 0; i < itemArray.length; i++)
		canvas.setChildIndex(itemArray*, i);
		var pct:Number = (itemArray*.y - minY) / rangeY;
		var scale:Number = pct * rangeScale + minScale;
		itemArray*.scaleX = itemArray*.scaleY = scale;
///////////////////////CAROUSEL END//////////////////////////

myUILoader.scaleContent = false;

var mainmenu: backTOmain = new backTOmain; ///main menu button gets attached
mainmenu.x = 87;
mainmenu.y = 30;
mainmenu.alpha = 0;
mainmenu.buttonMode = true;

M3.mouseChildren = false;
M3.doubleClickEnabled = true;
M3.addEventListener(MouseEvent.DOUBLE_CLICK, loadNo3);

function loadNo3 (e:MouseEvent):void
{, 1, {alpha:0, onComplete: remove});
	myUILoader.source = "No3.swf";
	myUILoader.addEventListener(Event.COMPLETE, FadeIn);
	function FadeIn ():void
	{;, 3, {alpha:1, onComplete: addListenerBack});
		function addListenerBack ():void
			mainmenu.addEventListener(MouseEvent.CLICK, BackToMainMenu);

	function remove ():void

function BackToMainMenu (e:MouseEvent):void
	mainmenu.removeEventListener(MouseEvent.CLICK, BackToMainMenu);, 3, {alpha:0, onComplete: removeMedia});
	carousel.alpha = 1;

	function removeMedia ():void

Thank you already in advance…