Working with External Assets, Libraries and Fonts
From Frontal Wiki
Contents |
Introduction
Frontal provides a demand-based asset queue for the loading of external assets. As the Frontal elements are parsed and rendered, the populate this load queue based on their order in the document. Then, as the elements are selected and displayed (say as part of a 'manager' tag), their assets are moved to the top of this load queue bypassing other pending assets. (For the 'manager' tag, all of its managed elements will move their assets to the top of the load queue in anticipation of being selected soon.) In this way, a Frontal document is always loading assets to minimize the time a user's waiting time but in a way that adapts to the user's requests.
We use the asset manager in may different ways that we will outline below.
Loading Assets
We load images and graphical SWFs (as opposed to resources SWFs we'll describe below) with the 'img' tag. (See that tag's reference for details.) In this way, we can bring those assets into the Frontal document just where the associated 'img' tag is laid out.
Loading Resource SWFs
A resource SWF isn't designed for immediate presentation but rather has compiled ActionScript classes, exported fonts and movies embedded in it that may be used by whatever other SWF loads it. In Frontal, we bring these resource SWFs into our document using the 'include' tag.
Code Libraries
See the section on [Include#Including External Resource SWFs|including external resource SWFs]] for how we can load SWFs that contains compiled ActionScript classes that we can then use in our own 'script' tags. And see Building an External ActionScript Library SWF for details about that process.
Movie Symbol Libraries
Getting movie symbols from an external SWF is made very simple with the 'img' tag. This is because when we use this tag to load a symbol, it will look for it in the local library and then in any externally loaded libraries. (We can limit which external libraries it will look in with the "externalAssetSrc" attribute.) If it doesn't find the symbol, it will then listen as external resource SWFs are loaded and see if they include the symbol. Here is an example that loads an external resource SWF then displays a symbol from it named "MyMovie". In the onLoad interaction, it also sets the loaded movie's alpha to 0.5:
<include rel="assets" type="application/x-shockwave-flash" src="http://www.frontalcode.com/assets/swfs/assets.swf" /> <style><![CDATA[ #test { @onLoad { image.alpha = 0.5; } } ]]></style> <img id="test" symbol="MyMovie" style="scale: 4;" />
Loading Fonts
External resource SWFs may also include fonts for use in your Frontal document. See System and Embedded Fonts for details.
Affecting the Load Queue
To do.
| This page is incomplete |