There’s a tools
folder inside the latest version of OpenFL, which contains format.SWF
and related classes which I need for my project.
Up until recently I was still on OpenFL 3.6, and this stuff was separate in the openfl/swf
repository, but according to this issue I raised, that repo has been silently deprecated?
So now this stuff is in openfl/openfl
repo in the folder tools
. But it’s not packaged as tools.format.SWF
. I don’t get it. There is a tools.hxml
script which looks like it’s supposed to be used here, but it doesn’t seem to do anything that helps me here.
So what’s the intended way to get the tools working?
The tools included with OpenFL are executed automatically if you include a SWF asset (such as <library path="Assets/library.swf" />
)
This will be processed into serialized SWF data, as well as exported bitmap images of any JPEG or PNG assets from the SWF. At runtime, you can use either new NameOfYourExportedForFlashSymbol ()
(if you enable generate="true"
for your library) or Assets.getMovieClip
to get a MovieClip
instance of your content. There is no special base class for SWF content now – it is built into openfl.display.MovieClip
I’ve just updated the SWF asset tutorial, here:
http://www.openfl.org/learn/tutorials/using-swf-assets/ (you may need to refresh)
I appreciate the help, but I don’t think any of this fits my use case. I can’t use a <library>
tag since I don’t know what the swf path will be until runtime. I was previously using the SWF
class in the swf repo myself, like so:
var bytes = File.getBytes(filename);
var swf: format.SWF = new SWF(bytes);
var classNames = [ for (k in swf.symbols.keys()) k ];
I think I’ve been boxed off from doing this, and I can’t find anything that works as a workaround.
edit: Actually I do have a workaround – I can add the tools
folder as a separate <source>
path for my OpenFL project, and then everything works. So I’m not completely stuck. But hopefully there is a better way.