Export to GitHub

splinkresource - Configuration.wiki


splinkresource is configured through a xml file which is based on resourcebundles.dtd. The xml contains resourcebundle nodes which define the assets and fonts which are associated with a locale. Each resourcebundle has a defaultLocale attribute which defines the locale to which the resourcebundle contents belong. A locale usually is defined in the format * language_COUNTRY.

Often various locales need the same configuration, so there is an optional locales node to associate additional locales with a resourcebundle. This can save a lot of typing:

<resourcebundle locale="de_DE"> <locales> <locale value="at_DE" /> <locale value="ch_DE" /> </locales>

Next there is an assets node within a resourcebundle. The asset node contains a path attribute which defines the base path for all assets which are referenced within the assets node. This base path is relative to the swf which loads the xml. How to create asset swfs

<assets path="assets/"> <asset id="sample" src="assets.swf" filesize="0" /> </assets>

Each of the asset nodes inside assets has the following attributes: * an id * a src which references the swf file which contains the assets * a filesize which can be left empty for the time beeing. The SizeInjectorTask takes care of injecting the filesize

The fonts node works just as the assets node. How to create font swfs <fonts path="fonts/"> <font id="Arial" type="normal" src="arial.swf" filesize="0" /> <font id="Verdana" type="system" isSystemFont="true" xOffset="0" yOffset="0" sizeOffset="0" filesize="0" /> </fonts>

Each font node has the following attributes: * id defines the name of the font * type is the identifier used to access a font from within the application. Having a seperate type attribute enables to change fonts without having to touch the application code * src references the swf file which contains the font (optional) * isSystemFont defines whether the font is a system font or a embedded font. System fonts don't need a src as embedded fonts do. * the optional xOffset, yOffset and sizeOffset attributes specify offsets which is useful in multilanguage applications where different resourcebundles contain different fonts for the same type If, say a font defined for the russian locale is a bit smaller then the font for the other locales one could easily use sizeOffset to enlarge the russian font a bit. Of course this requires some kind of TextField which applies these offsets and is used throughout the application. * filesize which can be left empty for the time beeing. The SizeInjectorTask takes care of injecting the filesize

splinkresource 1.6.0+ supports a new files node which can be used to include text or binary files in a resourcebundle. A typical use case are localized xml files.

<files path="files/"> <file filesize="1267" src="localized.xml" id="localized" fileType="text" /> <file filesize="71523" src="test.swf" id="some-binary" fileType="binary" /> </files>

Lastly there is the libraries node which is independent from the resourcebundles as different locales almost never depend on different code libraries.

<libraries path="library/"> <library id="de.polygonal.as3ds" src="as3ds.swf" filesize="0" /> </libraries>

library nodes have the following attributes: * id which can be used later to add the library to the displaylist * src references the swf file which contains the code * filesize which can be left empty for the time beeing. The SizeInjectorTask takes care of injecting the filesize

Here the complete configuration: ```

<resourcebundle locale="de_DE">
    <locales>
        <locale value="at_DE" />
        <locale value="ch_DE" />
    </locales>

    <assets path="assets/">
        <asset id="sample" src="assets.swf" filesize="16472" />
    </assets>

    <fonts path="fonts/">
        <font id="Arial" type="text" src="arial.swf" filesize="21857" />
        <font id="Verdana" type="system" isSystemFont="true" filesize="0" />
    </fonts>
</resourcebundle>

<resourcebundle locale="en_US">
    <assets path="assets/">
        <asset id="sample" src="assets.swf" filesize="16472" />
    </assets>
    <fonts path="fonts/">
        <font id="Arial" type="text" src="arial.swf" xOffset="1" yOffset="1" sizeOffset="-1" filesize="21857" />
        <font id="Verdana" type="system" isSystemFont="true" filesize="0" />
    </fonts>
</resourcebundle>

<libraries path="library/">
    <library id="de.polygonal.as3ds" src="as3ds.swf" filesize="43654" />
</libraries>

```