Assets
Assets are external resources that are loaded at runtime. modular supports the following Assets; Text, XML, CSS, Library.
Usage
Assets are always associated with a page. To load for example an external xml file a page in your boot.xml would look like;
<Page> <Assets> <!-- here we add our asset files. the id specified is for later retrieval --> <XML path="path/to/your/xml/file" id="myXML" /> <CSS path="path/to/your/css/file" id="myCSS" /> <Library path="path/to/your/swf/file" /> <Text path="path/to/any/string/content" id="myString" /> </Assets> </Page>
To access the asset in AS3 you simply call:
var xml:XML = Modular.getXML( "myXML" ); var css:StyleSheet = Modular.getStyleSheet( "myCSS" ); var text:String = Modular.getText( "myString" );
modular searches for the asset through your whole application. It doesnt matter if they are in nested page or in the main page.
In modular you look at a swf file as a storage of classes instead of
the old loadMovie( .. ) command that actually displays the swf file. Its more like a library that stores the classes inside the swf. So we use the Library asset to load external swf files that stores your modules or runtime shared fonts.
modular searches through all your libraries to get the class you specified in the <Module class="myClass" /> class attribute.
Comments