Using SWC in html5 target

I want using swc in html5 target!

I read this in URL: http://old.haxe.org/manual/swc

Haxe3 supports SWC linking. You no longer need to unzip the swc file manually and can directly link it with -swf-lib library.swc

then i try it add tag in project.xml

< haxeflag name="-swf-lib" value=“assets/swc/library.swc” />

result: in flash target work ok , but html5 not work!

html5 show error message:: Uncaught ReferenceError: MUSIC_btn is not defined

SWC not support in html5 target?

everyone help me?

1 Like

The “-swf-lib” argument in Haxe only works for the Flash target

BUT there is an OpenFL-compatible “swf” library that does work for HTML5, it does not currently support SWC, but does support the SWF inside, if you extract it (or just use the SWF that the Flash editor also produces).

There are a few samples that work with the SWF library:

openfl create sample SimpleSWFLayout
openfl create sample NyanCat
1 Like

thank you it’s OK!!

But another problem, that if I try it

code begin===============>

var mc = Assets.getMovieClip(“FX:$JackpotAnimation”);
Lib.current.addChild( mc );

code end=================>

In html5 target is OK!!
But if i try it mc.play(); not work

What happened?
Not Supported play()?

The HTML5 SWF support does not support animation, yet, but it wouldn’t be terribly hard to add – the focus (on my end, at least) has just been more on getting the accuracy up, so you can use it for layouts. If you need animation today, using a spritesheet exporter might work

1 Like

For MovieClips, I think it works well with Starling Framework…
Oups, we are in 2020, sorry… :woozy_face: