# attachMC problem

**URL:** <https://forum.kirupa.com/t/attachmc-problem/206199>\
**Category:** flash\
**Created:** [November 6, 2006, 3:55am UTC](https://forum.kirupa.com/t/attachmc-problem/206199 "2006-11-06T03:55:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixeldude](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@pixeldude](https://forum.kirupa.com/u/pixeldude)\
**Post date:** [November 6, 2006, 3:55am UTC](https://forum.kirupa.com/t/attachmc-problem/206199/1 "2006-11-06T03:55:41Z")

</div>

Hi there…

Ok the codes below are attaching the mc one by one on stage…so my problem is how to eliminate previos attach before move to next attach MC…let say as u can see in my code…I just settign the interval…for 2 second…in other to attach the mc on eby one…so how to set up the code so that if the 2nd mc has attach it’ll remove the 1st one attach for certain time…and so on…

the scenario like this…

mc1 attach  
after 2 second  
mc2 attach --\> remove mc1  
after 2 second  
mc3 attach --\> remove mc2  
and so on…

```auto

stop();

var shapename:Array = ["shape0","shape1","shaep2"];

var mcholder:MovieClip = this.createEmptyMovieClip("mcholder",this.getNextHighestDepth());
var len:Number = shapename.length;
var count:Number = 0;
var i:Number = 0;

function attachShape():Void{
	if(i<len){
		var shapeMC = mcholder.attachMovie("shape"+i,"shape"+i,100+i);
	    trace(shapeMC);
	    shapeMC._x = 100+shapeMC._width*i;
        shapeMC._y = 100;
		i++;
	}else{
	    clearInterval(ID);
		trace("done attaching shape");
	}
}

ID = setInterval(attachShape,2000);

```

So which part in my code I have to alter…hope will get some shed on light…any help are appreciate…

thanks…
