# Particle trouble

**URL:** <https://forum.kirupa.com/t/particle-trouble/238600>\
**Category:** flash\
**Created:** [September 12, 2007, 11:41pm UTC](https://forum.kirupa.com/t/particle-trouble/238600 "2007-09-12T23:41:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![James001](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@James001](https://forum.kirupa.com/u/James001)\
**Post date:** [September 12, 2007, 11:41pm UTC](https://forum.kirupa.com/t/particle-trouble/238600/1 "2007-09-12T23:41:54Z")

</div>

I’m trying to create some simple particle effects here. When the animation in the particle has finished in each particle would like to remove it or replace with new ones. Maybe I need to add actionscript to the end of the timeline (of the particle)?

Not sure what script would be. something like \_root.function particles(remove). I don’t know , that was probably a bad guess and extremely sloppy syntax.

var i:Number = 1;  
setInterval(particles, 120);

function particles() {  
if (i \< 50) {  
var myClip:MovieClip = mytarget.attachMovie(“anim”, “anim”+ i, i);  
myClip.\_x = random(mytarget.\_width - myClip.\_width);  
myClip.\_y = random(mytarget.\_height - myClip.\_height);  
i++;  
[//myClip.blendMode](https://myClip.blendMode) = invert;  
setInterval(particles);  
}  
else if (i \> 0) {  
i–;  
yourMessage.removeMovieClip();

```
}

```

};
