Issues with OpenFL 4.5.1

So after upgrading from 4.5.0 to 4.5.1 there are some strange things going on here…
(CPP target, Windows 10, Haxe 3.2.1, hxcpp 3.4.2)

First problem is with assets from swf-files:

So this works fine in 4.5.0:

<library path="assets/assets.swf" type="swflite" generate="true" preload="true" embed="true" />

var mcAsset = new MCAsset();

In 4.5.1 it wont compile:

DefaultAssetLibrary.hx:1523: characters 83-141 : Should extend by using a class :
@:file("bin/windows/cpp/release/obj/tmp/lib/assets.json") #if display private #end class __ASSET__lib_assets_json extends lime.utils.Bytes {}

So, if i remove the embed=“true”

<library path="assets/assets.swf" type="swflite" generate="true" preload="true" />

The application compiles, but crashes the moment i run

new MCAsset();

Not sure whats going on here? Did something change from 4.5.0 to 4.5.1?
For now this is broken for me, i cant use 4.5.1.

Second problem:
This also works fine in 4.5.0:

texture = stage.stage3Ds[0].context3D.createTexture(1920, 512, BGRA, true);

In 4.5.1 the same line crashes the application.
However; if i wait 200ms after application start… it works…

Or if i first create a power-of-two texture then the application does not crash:

stage.stage3Ds[0].context3D.createTexture(512, 512, BGRA, true);
texture = stage.stage3Ds[0].context3D.createTexture(1920, 512, BGRA, true);

Is there any meaning behind the way this works or is it just a bug?



I have fixed the embedding issue, but I have disabled the embed="true" behavior for SWF libraries for now, because it has to be updated to work with embedded assets using the new asset library system. Anyway, the plan is to improve that in the future, but until that time, it should at least ignore the embed attribute instead of breaking :slight_smile:

I can run var texture = stage.stage3Ds[0].context3D.createTexture(1920, 512, BGRA, true); immediately after super() in my test application constructor, but maybe it works differently on your machine. What target are you using? Neko, C++? What platform?

Thanks :wink:

Im targeting c++, windows 10, Haxe 3.2.1, hxcpp 3.4.2)

Thanks for the embed=“true” fix!
However; this doesnt solve the whole problem. When i instantiate an MovieClip exported in the swf i get a crash.
After digging a bit into this, it seems the application will crash if the exported MovieClip contains bitmaps. Otherwise it seems it does not crash. Again, this works fine on 4.5.0.

Another thing to notice, and that is bitmap fills on shapes… repeat does not work anymore and only shows the bitmap 1 tile without repeats. This worked fine in an earlier version (before 4.5.0).

And… stage.stage3Ds[0].context3D.createTexture definitly crashes in versions after 4.5.0, but apparently just in certain scenarios. I’m not really sure of why or where yet. Will have to dig a bit more… but in 4.5.0 or earlier it does not have the same issue.

Thanks again!

Anyone else having the same issue? Application crash if you instanciate a symbol containing a bitmap from a swf ? on c++? It seems 4.5.1 and 4.5.2 have this bug, making it broken for using with SWF assets… Have to use 4.5.0 for now and wait for a fix…

For me I can’t even use .swf library because it cant find movieclips (well, it did for a hot minute, and after updating .swf with different movieclip naming it hasn’t worked since and I cant figure out why).

I started yesterday new discussion/thread about it with error messages and details.

Can you try the NyanCat sample? It is animated using bitmaps

openfl create NyanCat
cd NyanCat
openfl test neko

Yes. It crashes if i change Assets.getMovieClip to use “new”

Consider the following:

<library path="Assets/library.swf" preload="true" generate="true" />

Runs fine:

var cat = Assets.getMovieClip ("library:NyanCatAnimation");


var cat = new NyanCatAnimation();

So this is clearly a bug then, hope you can look into it!


Thanks for the help in diagnosing this, the problem has been solved :slight_smile:

An early Christmas gift from Josh, thanks! :smile:

Great that the generate bug is fixed! :slight_smile:
Would you consider doing a new point release? I’m stuck at 4.5.0 because of this :slight_smile:

@singmajesty : I am also facing the same problem.

Created a MovieClip named Clip and 'Exported for ActionScript’
var clip = Assets.getMovieClip(“Clip”) works
var clip = new Clip(); doesn’t work … Throwing Error

Read the above post regarding SWF generate fix code solution…
But unable to understand how to apply that fix …

Please Help … Thanks

Try making your <library /> tag look something like <library path="my.swf" preload="true" generate="true" />


I already did that … The preload=“true” does not work

What error is thrown? What version of OpenFL and Lime?


Getting following error :

Source/Main.hx:15: characters 20-21 : Unexpected (
Source/Main.hx:15: characters 21-22 : Unexpected )
Source/Main.hx:15: characters 21-22 : Unexpected )

On line 15 this code is written :
var clip = new red(); – Throws above error
var clip = Assets.getMovieClip(“shapes:red”) – runs smoothly

I am using OpenFL 7,1,2 and Lime 6,2,0

Oh, Haxe classes must start with a capitalized character. I think we might force it to uppercase in our code generation, or you might have to rename it in your SWF.

There’s also a prefix="" option, to help solve problems like this, for example:

<library path="my.swf" preload="true" generate="true" prefix="Awesome_" />
var clip = new Awesome_red ();


Neither of the above solutions are working…

  1. var clip - new Red(); ---- First char capital. Same error

  2. <library path="my.swf" preload="true" generate="true" prefix="Awesome_" />
    var clip = new Awesome_Red(). ---- Fails. Same error

If you add a prefix, try lowercase red, like Awesome_red


Still same error with Awesome_red…

Check your Export folder. I believe there should be an “obj/_generated” directory under your current target platform (which target are you using?)

There should be *.hx files generated in there based on your SWF, you should be able to see what files and class names were generated there