-
Notifications
You must be signed in to change notification settings - Fork 4
3. Using App Mode and the OpenFL “project.xml” file with Glory
The “project.xml” is used to configure your project in many ways. The OpenFL site has lengthy documentation for that. Detailed here are the important parts for using it with Glory Framework. Please review the example code to see a complete working example.
<define name="appMode" />
This is a single configuration option but has important, powerful effects throughout the framework when enabled. When enabled, it causes your assets to be embedded in the app (Flash) or completely loaded at startup (HTML5). When disabled, Glory Framework will load the assets for each page on an as-needed basis, i.e. whenever a page change is requested.
In the example project.xml file you can see that there are XML tags which use if and unless attributes which refer to the appMode flag. These can of course be included/omitted according to your needs if you only intend to use one mode or the other.
When NOT in App Mode, all assets are simply deployed along with the application, and they are controlled solely by the config.xml file.
When using App Mode you will need to add special tags for allowing swf and sound assets:
For SWF:
<library path="assets/swflibrary.swf" preload="true" id="swflibrary" if="appMode" />
For Sounds:
<assets path="assets" if="appMode">
<sound path="p1/limerickPCM.ogg" id="s_limerickPage" />
<sound path="p1/limerickPCM.wav" id="s_limerickPage" />
<sound path="p1/limerickPCM.mp3" id="s_limerickPage" />
</assets>
The id attributes in the sound and library nodes must match the references used in the config.xml.
For example, in the config.xml there may be a sound node like so:
<sound id="s_limerickPage" src="p1/limerickPCM.mp3,p1/limerickPCM.ogg,p1/limerickPCM.wav" autoPlay="false" ></sound>
Glory will use the id of this node when preparing the sounds for a page. The project.xml controls how it is embedded, whereas the config.xml controls how Glory makes it available in the page build procedure.
In a similar way, a page node containing a swflibrary attribute (in config.xml) must have a corresponding library with an id of the same value in project.xml if using app mode. Please read SWF to Glory Workflow for complete information.