# Code Help

**URL:** <https://forum.kirupa.com/t/code-help/185716>\
**Category:** Uncategorized\
**Created:** [April 15, 2006, 8:17pm UTC](https://forum.kirupa.com/t/code-help/185716 "2006-04-15T20:17:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![artistwantab](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@artistwantab](https://forum.kirupa.com/u/artistwantab)\
**Post date:** [April 15, 2006, 8:17pm UTC](https://forum.kirupa.com/t/code-help/185716/1 "2006-04-15T20:17:00Z")

</div>

I have two Swfs that are supposed to do exactly the same thing. On works on MouseDown the other is supposed to work when the movie is played.

I have included both swf as an example. Don’t forget to click on stage for explosion002.

Here is the code of the NON-Working .fla.

Thanks for all the help.

```auto
function particle () {
 for (var i = 0; i < 25; i++) {
  this.attachMovie ("ball", "ball", +i, i);
  _x = Stage.width / 2;
  _y = Stage.height / 2;
  var rn = Math.floor (Math.random () * (300 - 25)) + 25;
  this._xscale = rn;
  this._yscale = rn;
  this.duplicateMovieClip ("ball" + this.i, this.i);
  removeMovieClip ("ball" + (this.i - 20));
  x_speed = .5 + (10 - random (20));
  y_speed = .5 + (10 - random (20));
  this.x_speed *= .98;
  this._alpha -= 0;
  this._x += this.x_speed;
  this._y += this.y_speed;
  if (this._y > 450 || this._y < 0 || this._x > 750 || this._x < 0 || this._alpha <= 0) {
   this.removeMovieClip ();
   updateAfterEvent ();
  }
 }
}
particle (this);

```
