Swf assets in custom folder


#1

from this definition of including .swf assets

<library path="to/my.swf" />

seems that compiler always put .swf assets in root/lib folder.
Is it any way to put it in a custom folder for example: root/my_custom_folder/lib?

Thanks


#2

If you openfl process path/to.swf first, it should be possible to load it at runtime using AssetLibrary.loadFromFile.

This is an area where the tools could be improved a bit, you can’t rename like normal assets, because libraries have a single string ID that’s different from where it puts the files in the output directory, it’s likely hard-coded right now :sweat:


#3

Yes, I saw it’s hard-coded in swf lib

var swf = new Asset (library.sourcePath, "lib/" + library.name + "/" + library.name + ".swf", AssetType.BINARY);

Generally, it’s OK for me but sometimes clients wants everything in custom folder like-index.html+customfolder.


#4

You could put all your assets in a custom folder in production, then use the rootPath attribute in your embed code. This works similar to the “base” property from Flash embedding. Instead of looking for “lib/library/manifest.json” it will look for rootPath + "/lib/library/manifest.json" instead (and that applies to all assets)