In case if anyone needs to use openfl process SWF_NAME.swf
, here’s my solution:
Basically you can use project.xml
's <library/>
tag, but it often breaks auto-completion for FlashDevelop and you generally have to compile once first to generate the files in the binary output folder.
So use something like openfl process path/to/project/root/_generated
to create a _generated
folder within your project’s root folder. Then add the generated source path in your project.xml
file with following command:
<source path="_generated"/>
You can add it right below your original source, so it might looks something like this:
<?xml version="1.0" encoding="utf-8"?>
<project>
<!-- NMML reference: https://gist.github.com/1763850 -->
<!-- metadata, make sure 'package' is at least 3 segments (ie. com.mycompany.myproject) -->
<meta title="Generated Code" package="GeneratedCode" version="1.0.0" company="Creative Magic" />
<!-- output -->
<app main="Main" file="GeneratedCode" path="bin" />
<window background="#000000" fps="60" />
<window width="800" height="480" unless="mobile" />
<window orientation="landscape" vsync="false" antialiasing="0" if="cpp" />
<!-- classpath, haxe libs -->
<source path="src" />
<source path="_generated"/>
<haxelib name="openfl" />
<!-- assets -->
<icon path="assets/openfl.svg" />
<!-- optimize output
<haxeflag name="-dce full" /> -->
</project>
This will allow you to use auto-completion within your project, but it won’t compile, because the processed files aren’t being pre-loaded.
To fix this, just create a copy of the project.xml
file and call it something like build.xml
. Remove the added <source path="_generated"/>
line add instead define your SWF as a library with a line like this: <library path="assets/SWF_FILE.swf" preload="true" generate="true"/>
.
Your build.xml file might look something like this:
<?xml version="1.0" encoding="utf-8"?>
<project>
<!-- NMML reference: https://gist.github.com/1763850 -->
<!-- metadata, make sure 'package' is at least 3 segments (ie. com.mycompany.myproject) -->
<meta title="Generated Code" package="GeneratedCode" version="1.0.0" company="Creative Magic" />
<!-- output -->
<app main="Main" file="GeneratedCode" path="bin" />
<window background="#000000" fps="60" />
<window width="800" height="480" unless="mobile" />
<window orientation="landscape" vsync="false" antialiasing="0" if="cpp" />
<!-- classpath, haxe libs -->
<source path="src" />
<haxelib name="openfl" />
<!-- assets -->
<icon path="assets/openfl.svg" />
<library path="assets/obj.swf" preload="true" generate="true"/>
<!-- optimize output
<haxeflag name="-dce full" /> -->
</project>
When you want to develop your app, just use your project.xml
for references to the generated classes. When building, use command line to build. Your command might looks something like this:
lime build build.xml android
That fixed my problem.
Happy coding!