# Deleting movie Clips after X amount of time

**URL:** <https://forum.kirupa.com/t/deleting-movie-clips-after-x-amount-of-time/287721>\
**Category:** flash\
**Created:** [May 5, 2009, 4:51pm UTC](https://forum.kirupa.com/t/deleting-movie-clips-after-x-amount-of-time/287721 "2009-05-05T16:51:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zigsta](https://avatars.discourse-cdn.com/v4/letter/z/ed8c4c/32.png) [@zigsta](https://forum.kirupa.com/u/zigsta)\
**Post date:** [May 5, 2009, 4:51pm UTC](https://forum.kirupa.com/t/deleting-movie-clips-after-x-amount-of-time/287721/1 "2009-05-05T16:51:06Z")

</div>

Hi there

Right then I’m sure you guys can sort this out very simply. Basically I have this code that creates duplicate instances of a movie clip and puts them on stage with a few random settings where ever the mouse goes.

This is cool but I want the duplicates to disappear after a certain amount of time (2-3 seconds or so) - or disappear when a certain amount of them have been placed on the stage.

I have played around with the getTimer() function with no joy but I am not even sure if this is the right thing to use.

Please can any body help.

Many thanks in advance.

* * *

var num:Number = 0;

\_root.onMouseMove=function() {

```
var temp = _root.attachMovie("flower","flower"+num++,_root.getNextHighestDepth());

temp._x = _root._xmouse + Math.random()*80;
temp._y = _root._ymouse + Math.random()*80;
temp.gotoAndPlay(Math.ceil(Math.random()*4));
temp._xscale = temp._yscale = Math.random()*100 +20;
temp._rotation = Math.random()*360;
temp._alpha = Math.random()*100 + 30;

```

}
