Problems with loading swf art that is marked as compression: "JPG"

I am converting a very large collection of Flash games into Haxe, and I’ve converted a lot of the code into Haxe already - and many of the games work when exporting Haxe to Flash already.

However, when exporting those games to html5, we are unable to display a lot of our swf art. Most of our art is marked as “Compression: JPG” (Adobe Animate property) which allows us to variably compress the art to make it smaller. However, that art does not appear to display when you load that MovieClip from an (exploded) swf. It does create a MovieClip of the correct width and height, but there are no pixels drawn.

Once we changed those pieces of art to “Compression: Lossless (PNG/JPG)” - the art displayed correctly.

Of course, we would really like to keep “Compression: JPG” because we can variably compress the art to avoid having giant file sizes.

I noted that when we had “Compression: JPG” selected, the “exploder” would generate a, say “23.jpg”, and “23a.png” - where the “a” png was the (black&white) alpha layer for jpg, and when we generated “Compression: Lossless”, it just generate a “23.png” (which was the entire art with transparency)

I always use jpeg compression from swf assets but I never had this problem. Or maybe long time ago!
There was recently an update on jpeg compression if I remember correctly. Can you tell what version of lime and openfl your are using? Can you try on last openfl if it’s not the case?

I’m using openfl 8.9.0 and lime 7.3.0 - which I believe are the latest versions. I’m trying to build the simplest sample swf that I can to show the issue.

I built a sample haxe to html5 project - here is a link to the code for that project:

But basically - the swf with just the jpg compressed assets (sample_JPG.swf) ( on the stage shows no art when I compile it into the project, and the swf with the png compressed assets (sample_PNG.swf) DOES display the art. You can also see that the png swf generates a “1.png” file in html5/bin/lib/sample, and the jpg file generates a “1.jpg” and a “1a.png” (which is an black and what alpha-channel only png). Note that due to some weird compile problem, I’m only getting the output art assets to change if I wipe out the whole “html5” output folder.

Here is the test code I’m using (it’s in the zip file above too):

package sample;

import flash.display.MovieClip;
import openfl.utils.AssetLibrary;
import openfl.utils.Assets;

class Sample extends MovieClip {
    public function new() {
        super();
        Assets.loadLibrary("sample").onComplete(handleLoad);
    }

    private function handleLoad(library:AssetLibrary):Void {
        var mc:MovieClip = library.getMovieClip("");
        addChild(mc);
    }
}

Thanks for the sample!

Do you see any errors in the debug console for the browser?

It appears to work for me here – but the JPEG + alpha approach requires loading two images and merging them together at runtime, it looks like you are using a large image and perhaps(?) there is a memory issue with doing this?

EDIT: I just made fixes to the dev version of OpenFL that may also help generate the alpha PNG images more reliably

I completely wiped out my c:\HaxeToolkit installation and re-installed - and now the jpg compressed art in swfs seem to be working fine. Maybe it was openfl 8.9.1 that fixed the problem (since I had 8.9.0 before). Anyway - thanks for the help! And just in case - how can I get the “dev” build of openfl?