Removing an mc only if a condition is met

Hi There,
this is my first post here at Kirupa. I’m trying to remove an mc only if a condition is met, the problem is that it dissapears because I’m not leaving AS enough time to adding it to the stage and removing it. Below is a copy of my code.

import flash.display.Loader;
import flash.net.URLRequest;

var myObject:Object = new Object();
var myArray:Array = [“redBall”,“blueBall”,“greenBall”];
var myChildren:Array = new Array();
var myLoader:Loader;
var myURLRequest:URLRequest;
var _click:uint;
var posX:Number = 6;
var flag:Boolean;

// declare my object
myObject = {idx:Number,loc:String,mc:Sprite};

stage.addEventListener(Event.ENTER_FRAME, _counter);
// when click is 3 ;
function _counter(e:Event)//e:Event
{
if(_click > 1) stage.removeEventListener(Event.ENTER_FRAME, _counter);
picksSWF(_click);
}

function picksSWF(f:Number)
{
//loaders and requests constructors
myLoader = new Loader();
myURLRequest = new URLRequest();
//feeding myObject loc with the movieClip name
myObject.loc = myArray[f];
//feeding the url with the loc
myURLRequest.url = myObject.loc + “.swf”;
//running the loader
myLoader.load(myURLRequest);
// feeding myObject.mc with the Loader which is a movieClip
myObject.mc = myLoader;
myChildren[f] = myObject.mc;
// adding myObject.mc to stage
addChild(myChildren[f]);
trace(“it just added the mc”);
// feeding the idx with the variable
myObject.idx = f;
// feeding the loaded movies array
myChildren[f] = myObject.mc;
trace("myChildren[f] = "+myChildren.join())
// putting elements on stage
myLoader.x = posX;
trace("posX = “+posX+” myLoader.x = "+myLoader.x)
trace(_click)
// _click continues
// adds value to position
if (flag)
{
trace(“flag”);
removeChild(myChildren[f-1]);
//stage.removeEventListener(Event.ENTER_FRAME, _counter);
}

posX += 30;
_click++;
trace(_click);
flag = true;

}

Thanks a lot.