Is it possible to specify output scale for images in swf assets?
For example I have original image in fla 500x500px, but in output I would like exported images to be 250x250px (50% scale). Idealy, that images will scale automatically also, so sprites will remain the same size.
This would certainly be possible in the tools – but is not currently supported, but happy to work with anyone interested in adding features like this
I’m working on a new SWF format that uses a zipped single file, uses JSON instead of Haxe serialization (in order to improve backward compatibility) and which can work on Flash as well other targets
If you want to try, use type="animate" on your library and eventually I expect this will be the default. I’ve also tried to make it simpler to understand where to work on it…
The code handling the output (requires openfl rebuild tools to recompile changes) is here:
Can you please tell, where should I use flag type="animate"? In project.xml?
I do not use swf directly. For html5 I preload bundle. Do I need to process swf with some extra parameters?
I think on dev openfl process always uses the animate format, where <library /> tags do not yet, so type is for <library path="library.swf" type="animate" /> but openfl process library.swf works too
Hi. I’ve managed to find some time.
So i’ve picked the develop branch and rebuilt tools. openf process still generates binary swflite.bin.
Isn’t it implemented yet or I need to add extra parameter to process?
Found interesting thing: var scripts = FrameScriptParser.convertToJS(swfData, swfSymbol.name);
Works fine for html5 target. Are there problems to support other targets?
@singmajesty zip library, that I created at with openfl process cannot be loaded at runtime:
Assets.loadLibrary("assets/assets.zip").onComplete(lib -> {
var mc:MovieClip = Assets.getMovieClip("swf:container");
addChild(mc);
});
Error:
(index):1 Uncaught SyntaxError: Unexpected token P in JSON at position 0
at JSON.parse (<anonymous>)
at Function.lime_utils_AssetManifest.parse (OpenflDev.js:24250)
at Function.lime_utils_AssetManifest.fromBytes (OpenflDev.js:24220)
at OpenflDev.js:24243
at OpenflDev.js:12717
at lime_app_Promise.complete (OpenflDev.js:12772)
at OpenflDev.js:21315
at lime_app_Promise.complete (OpenflDev.js:12772)
at XMLHttpRequest.readyStateChange (OpenflDev.js:7490)
Are you using the develop version of Lime as well?
The Animate library code is exported in this class:
You can search for “BitmapType.” and find the five places where images are exported. Each should have a byteArray with the output data but you could try doing something like BitmapData.fromBytes(), resize, then bitmapData.encode again. It would be inefficient but worth testing?