When I run the example here: https://haxe.org/manual/target-flash-resources.html
Then process the output swf using http://www.swftools.org the png file is being embedded with the "DEFINEBITSJPEG2" tag
How do I tell Haxe to embed the png file with the "DEFINEBITSLOSSLESS2" tag?
It would seem the compiler detects PNG based on header (so it's best to doublecheck that the file is actually an PNG) and if it does, it tries to store it as BitsLossless2
(no idea if that tag is any different from BitsLossless
), but there seems to be an exception for 24bit PNGs exceeding a certain size, which indeed falls back to BitsJPEG2
(for reasons I don't quite understand). You should be seeing a warning telling you to add an alpha channel. I would suggest trying that.
If all else fails, you can use resources instead, which are embedded as BinaryData
. With haxe.Resource.getBytes(nameOfTheResource).getData()
you get a flash.utils.ByteArray
and you can stick that into a flash.display.Loader
via loadBytes
.