Using existing DisplayObjects with Flint

By Simen

I wanted to create a random cloud generator with Flint using existing DisplayObjects, it took a while to find the right initializer but after that it’s a breeze!

public class CloudsView extends View {
  public function CloudsView() {
  	// This class is exported from the IDE; containing
        // instances of the particles I want to use.
  	var particles:Array = new Array();
  	while (numChildren) {
  		particles.push(removeChildAt(0));
  	}
 
  	var emitter:Emitter2D = new Emitter2D();
  	...
  	emitter.addInitializer(new SharedImages(particles));

Leave a Reply