I want to load swf assets
so I have written these codes in project.xml
<library path="Assets/B2B.swf" preload="true" generate="true"/>
and in Main.hx also I have written these codes:
var clip = Assets.getMovieClip ("layout:Layout");
when I build with test html5, I don’t have any problem and SWF assets are loaded in my html5.
but if somebody has IDM (Internet Download Manager) on windows, show downloaded window and try to download SWF file with IDM and the SWF file doesn’t load in my html5
How can I fix it?
The SWF processing tools will convert your SWF into a new format at compile-time in order to run well on HTML5. Granted, this was written years ago when parsing a SWF at runtime in HTML5 was a horrible idea. It would still be inefficient nowadays, though not as bad as it used to be.
Do you need to load new SWF files at runtime in your project, or does compile-time work okay?
I would appreciate if you give me a solution for both methods(compile-time work & at runtime)
The OpenFL samples are using the compile-time approach. Both the “NyanCat” and “SimpleLayout” samples should process the SWF at compile-time, and in the generated output directory the result is automatically loaded, and is no longer a SWF.
For the runtime approach, there is a somewhat more complicated approach using
openfl process (path to SWF) which converts the SWF to a ZIP file. This ZIP file can be loaded then at runtime using
AssetLibrary.loadFromFile (I believe) and constructed at runtime.
There is no support for true SWF files at runtime right now, though I would welcome help on this front. We have the technology for it, it just would need additional work to polish it up. There’s a little bit of work on this regard in an openfl-player project