# ParticlePlane

**URL:** https://forum.kirupa.com/t/particleplane/292136
**Category:** flash
**Created:** [July 10, 2009, 2:47pm UTC](https://forum.kirupa.com/t/particleplane/292136 "2009-07-10T14:47:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![SticksStones](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@SticksStones](https://forum.kirupa.com/u/SticksStones)
#### Post date: [July 10, 2009, 2:47pm UTC](https://forum.kirupa.com/t/particleplane/292136/1 "2009-07-10T14:47:12Z")

</div>

I’m trying to write a class which can spawn many instances of a given sprite. Something like…

package {  
import flash.display.Sprite;

```
public class particlePlane extends Sprite{

    public function particlePlane(particleType:Object, ammount:uint, planeWidth:uint, planeHeight:uint) {
    trace("particlePlane: Populating with "+ammount+" "+particleType);
        for (var count = 1;count &lt;= ammount; count++) {
            var particle = particleType;
            particle.x = Math.random() * planeWidth;
            particle.y = Math.random() * planeHeight;
            this.addChild(particle);
        }
     }
}

```

}

The trouble is I want it to work with any sprite, so I don’t have to import each and every type. Is it possible to pass a class reference like this?
