Zame-haxe-particles doesn't work on html5 target

I try to implement zame particles and use sample code from zame-particles. It work fine on flash target but get black screen when i call

ParticleLoader.load("particle/particle.plist");

I create particle with this particle editor and set

	<haxedef name="canvas" />

on html5 target. What’s wrong?

Did samples/minimal and samples/showcase works? Do you use github version or haxelib version?

I use haxelib version (1.0.2). I just copy code from github samples/minimal and as I said: flash target works well, html5 convert everything in black screen.

Strange. Everything work fine for me. Demo - http://pub.zame-dev.org/zp/ (compiled with lime test html5 -Dcanvas

Which Haxe and OpenFL versions you use? I use:

  • Haxe - 3.4.0
  • OpenFL - 4.5.1
  • Lime - 3.5.2

My configuration:
-haxe: 3.2.0-rc.3
-openfl: 4.5.2
-lime 3.5.2.

I have strange behavior on android also.

I upgrade haxe compiler to 3.4.0 but still the same. Maybe is something wrong with particle.plist? link

Work for me - http://pub.zame-dev.org/zp2/

Did my link work for you?

Yes, it works. Problem is probably my project settings.

If you want, you can send project to me ( [email protected] ), I’ll try to look why it is not working.

OK, I found the problem- because I encapsulate particle engine in it’s own class MyParticle.hx I add renderer as a child of class before instance of class is added to display list.

var classInstance = new MyParticles()
classInstance.init();

MyParticles class:

public function init():Void
	{
		var renderer = DefaultParticleRenderer.createInstance();
		addChild(cast renderer);
		
		ps = ParticleLoader.load("particle/particle.plist");
		renderer.addParticleSystem(ps);
		
		particleDuration = 1.0;
		
		ps.duration = particleDuration;
		
	}

and this line solve the problem:

var classInstance = new MyParticles();
addChild(classInstance );
classInstance.init();

Adding encapsulated instance after adding particle system also works fine for me:

class App extends Sprite {
    public function new() : Void {
        super();
        ready();
    }

    private function ready() : Void {
        var classInstance = new MyParticles();
        classInstance.init();

        addChild(classInstance);
    }
}

class MyParticles extends Sprite {
    public function new() : Void {
        super();
    }

    public function init() : Void {
        var renderer = DefaultParticleRenderer.createInstance();
        addChild(cast renderer);

        var ps = ParticleLoader.load("particle/fire.plist");
        renderer.addParticleSystem(ps);

        // stage is not available if sprite is not added to display list,
        // so use openfl.Lib.current.stage in that case
        var currentStage = (stage != null ? stage : openfl.Lib.current.stage);

        ps.emit(currentStage.stageWidth / 2, currentStage.stageHeight / 2);
    }
}

Maybe you use stage before adding MyParticles to display list?

No, I don’t use stage. It’s as it writen above.
But as I said this work:

var classInstance = new MyParticles();
addChild(classInstance );
classInstance.init();