-
Notifications
You must be signed in to change notification settings - Fork 4
6. SWF to Glory Workflow
SWF assets are a good option for keeping your Glory project organised. This is done by producing one .swf file or .bundle per Glory page. There is a significant difference in how OpenFL handles SWF assets depending on your chosen deployment target, so Glory attempts to hide that away for the sake of having simple syntax in the config.xml file.
The first step is to create your assets in Flash or Adobe Animate. Make them as MovieClips in your library and make sure "Export for ActionScript" is checked in the library item options. Make note of the Class name used, and make sure the first letter is capitalized. Export the .swf file and place it in your project’s /assets folder.
When using App Mode with Flash (more on this here) you can use the .swf file as it is. Simply make sure there is a library node in your project.xml file like so:
<library path="assets/swflibrary.swf" preload="true" id="swflibrary" if="appMode" />
The config.xml file must contain the following:
<page id="swfPage" type="normal" swflibrary="swflibrary">
<actor id="LittleBoy" z="1" type="prop" x="0" y="0" width="962" height="640" src="LittleBoy" ></actor>
</page>
The swflibrary attribute on the page node must match the id of the library in the project.xml file. The src attribute on the actor node must match the class name of the MovieClip contained in the .swf file as noted above.
In this case the library node is not necessary.
In this case one must prepare the .swf. Simply open a terminal and type the following command to create your bundle. Use the name of your swf, and use the full file path if you aren't in the same directory already.
openfl process swflibrary.swf