SWF doent work when export to html5 on openfl 2.1.5

Hey… i’m trying by diffirent methood:

var swf = new SWF (Assets.getBytes ("swflib/animations.swf"));      
animeContainer = swf.createMovieClip ("Anime_1"); 
addChild (animeContainer);

and second is:

Assets.loadLibrary ("animations", function(_) {
	animeContainer = Assets.getMovieClip("animations:Anime_1");
	addChild (animeContainer);	

After, when i export to html5 is nothing on the screen. But, when i export to flash it works fine…:frowning:
Alse, if delete the type=“swf” from project.xml i can see first frame from swf but it doesn’t play in html5…

My listings:

actuate: [1.7.5]
aether: [1.7.1]
away3d-examples: 1.0.4-alp
away3d: [1.0.4-alpha]
box2d: [1.2.0]
format: [3.1.1]
hxcpp: [3.1.39]
layout: [1.0.4]
lime-tools: [1.5.7]
lime: 1.0.1 [2.0.0-alpha.7
nme-dev: 1.3.2 [dev:C:\Use
nme: 5.1.8 [dev:C:\Users\b
openfl-native: [1.4.0]
openfl-samples: 1.3.0 2.1.
openfl-stage3d: [0.1.6]
openfl-tools: [1.0.10]
openfl: 1.2.2 2.0.1 2.1.0
stage3d-glsl: [0.1.0]

now working on 2.1.5 openfl version and last updates for anothers…

The SWF library supports two formats, “swf” (which is parsed at runtime) and “swflite”, which is processed at compile-time, and is a unique format.

The “swf” format is not compatible with HTML5 right now, and might never be. Unzipping a SWF in memory is not an efficient way to start an HTML5 project.

The SWFLite format should work for HTML5 (this is what happens when you remove type=“swf”, it allows it to choose “swflite” instead) but currently, SWFLite does not support more than one frame. This functionality could fairly easily be ported from the SWF runtime support in the library and adapted for SWFLite, but I am currently focusing on the consistency and the performance of SWFLite before going into frame animation, but welcome contributions here :slight_smile:

I appreciate your answer!
but… The main reason why i chose openfl, is possibility to use swf assets, wich you advertise on main page of openfl.org. http://data3.floomby.com/files/share/11_11_2014/6/aBhCsaYxVkGlkWmnGAGugQ.jpg :smile:

**p.s.**Flash developers now is moving to new platforms and looking for good of them, wich have same features… so, i think the swf assets including movieclips give’s for openfl much more interest and fame.

So, what is alternative way to load and play png-seguence in openfl project?

There are a few alternatives, such as the “spritesheet” library, as well work on Spine or Spriter support, I believe (I’m not sure if you can import/export to those formats?)

Any examples? I need to load and play the images sequence - not a spriteheet… It is a problem by using openfl?


You can modify a bitmap’s bitmapData property directly. This will change the image displayed by the bitmap without changing its location, rotation, scale, etc. Just load the images as bitmap data, create a single bitmap object, and change the bitmapData property to advance the frame.

This is very similar to what the spritesheet library does, only loading the images from a different source. You can refer to the source code for implementation details.

If you use an uncompressed SWF to load in HTML, would that still be considered inefficient?

Efficiency or no, there are a bunch of libraries that do load and parse SWFs in JavaScript, including Mozilla’s Shumway.

I’ve seen Shumway perform on the desktop, but I’ve never gotten any samples to work well on mobile. Do you think they’ve made more progress in this area? Unfortunately, I haven’t seen Shumway pass from “cool technical demo” to “productive for real projects” yet, though it seems to have so much potential

I agree, it’s not there yet. I have noticed a pretty large uptick in compatibility, which would be the first hurdle they’ll need to jump. The next will be performance. They are still working on compatibility for sure.

I am curious if an uncompressed (which can be gzipped by Apache, etc.) SWF is a viable format for shipping assets for HTML5, or if it would be better to use something else (SVGs, or something).

Since the “SWFLite” format is decomposed at compile-time, and not runtime, we have full control over the final format. At the moment, it saves images to separate PNGs, and saves a meta-data file which understands the MovieClip structure, and how (and if) that relates to the asset PNGs. It only exports the images referenced from symbols that have been “exported for ActionScript”, so it will not export unused objects from the library.

If using a single binary format would be better than using separate images, we could totally do that, though I figured that using separate images would work better for caching or the built in image loading behavior of the browser.

Still same issue!? After exporting NyanCat ffrom examples to html5, animation is no playing!%#&@&(*(

The “SWFLite” format in the SWF library does not export/support multiple MovieClip frames right now. The “SWF” format path does, and this code is largely the same as what SWFLite would need, and could be ported. The emphasis on the SWFLite library has been quality of reproducing single-frame layouts, first, and not strictly animation.

If anyone is interested in helping, I would be glad to make pointers, but I do not have the bandwidth (personally) to port SWFLite animation

Thanks guys

Seeing that this thread was last updated in February, I just wanted to ask if anything has changed since then? Is there a way to export SWF with nested multiframe movieclips in the library (or other swfs there, embedded as MovieClips) into html5?

Hasn’t happened yet, I welcome any helpful hands to help on stuff like this :slight_smile:

1 Like

I think we got to go away from swf and start porting our code to other language. Adobe is now slowly dropping support for flash, it is even difficult play flash for mobile.

Maybe you can export swf into the a movie SWF to Video, but interactivity is lost of course. Or redesign your project using OpenFl/Haxe then animate using Actuators. :smile:

Hey, follow-up on this, SWF 2.x supports SWFLite with multiple frames, auto-play is disabled by default (because animating is not optimized to pool/re-use objects) but that functionality could be written or ported. It’s a step in the right direction :wink:


I’d definitely be interested in helping out with the SWFLite Library development, seeing as the HTML5 export functionality is very interesting. The multi-frame functionality does not seem to be working for me after grabbing an update on the whole OpenFL stack (SWF lib is at 2.0.2 right now), so I guess I will have to get over that first :S

You wouldn’t happen to have any working samples would you?

Hey Joshua, I haven’t looked at the OpenFL code yet, but I have some game dev experience and I would be interested in taking a look at the whole animated MovieClip + HTML5. Could you elaborate a bit about what is missing and how one would tackle that?

Thank you!

Hey guys :smile:

The current SWF “lite” library does export multiple frames, but it does not play() automatically. The performance is not good enough to do that (yet!)

Here’s an example of the “swf” functionality:


In “swf lite” all children are removed before rendering a new frame:


There’s no re-use/pooling, so you can guess why it’s slow :wink:

1 Like