Using SWF library with HTML5 output duplicating the stage


I’m using the SWF library to run library symbols created in the Flash IDE and for the most part, it is working great, but when doing a build for HTML 5, while it is creating bitmaps of the assets fine, including ’ preload=“true” ’ is causing two separate versions of the app to be shown, one on top of the other. Publishing to Flash works ok.

Interesting. Some time ago I experimented with SWF Library and noted that Main class initialized twice. Can you add trace() somewhere in your init code and look how many times it prints to the console?

Thanks for the quick response T1mL3arn,

I have and that’s the weird thing. Last night I spent quite a long time looking to see what it might be (assuming I’d instantiated something twice), and the trace statement (in both the web console and Flash debugger) only calls once. I also tried including the library and also providing a link to the SWF with the line in my project.xml like so:

[Open XML node] library path=“to/your.swf” preload=“true” [Close XML node]

but without calling any of the assets at runtime from Haxe. ’ preload=“true” ’ caused 2 versions of the stage (only in HTML5, not Flash), but removing it didn’t, so my current belief is it may be the library and the preload feature.

Call @singmajesty ! What exactly do the “preload” attribute ? No info about it on this page.

Using preload has been a “beta” feature so far, but it skips the need to Assets.loadLibrary () and includes the library load as part of the preload process

Using this plus generate enables you not only to Assets.getMovieClip right away, but also to new MySWFSymbolClass () instead of Assets.getMovieClip ("library:MySWFSymbolClass");, to bring the code even closer to the standard Flash workflow