AS3 Gaia FrameWork Guide

Today, I’m gonna talk more in general about my experience in Gaia Framework. Here are some of the details I’ll cover in this post.

  • The Index – using the index effectively.
  • Assets Management – some example, on how to hook up an xml and graphical asset.

Gaiapanel

The Index

For me, index is best used for :-

  1. Positioning a generic background for all your flash pages because, index appears the lowest depth. All you need to do is to just place the asset on stage. Be it image or just as color background. Just remember to remove Scalffold code inside the indexPage.as
  2. Index is useful for global asset which you think, may be reused in all other pages. An example, will be a global xml for language. If you have decided to go multilingual site, placing your xml here is a good choice.
  3. In order to access assets shared in Index, simply use the GAIA api method below :-
//Where globalxml is my xml asset, text1 is the first child tag.
//Picture1 is the picture asset which retrieves the src.
var textData = Gaia.api.getPage("index").assets.globalxml.xml.text1;
var imageData = Gaia.api.getPage("index").assets.picture1;

Asset Management

Asset Management is one of GAIA’s greatest strength in this framework. You can set your asset to preload with the page or use load on demand – based on the site.xml. See example code below, it shows how asset is set preload=false to use load on demand. Once, you have enable load on demand, you can either load yourself the asset using a loader class. Pass in the URLRequest which is the assets.picture1.src, addChild to a MovieClip Container once loaded and you are done.