Related Posts Plugin for WordPress, Blogger...
This form does not yet contain any fields.

    Follow Me on Pinterest

    Our products are on iTunes!

     Nanaimo Studio

    Find us on Google+ 

     

    We are listed on: Dmegs Link Directory

    Blog Index
    404 page

    Entries in gaia (1)

    Monday
    Feb012010

    Minor fix to Gaia Flash Framework

    We recently started using Gaia Flash Framework on a microsite project.  In case you don't know what Gaia is, it's a very well-written navigation framework for Flash microsites, though not so much for games since game's interaction flow is usually highly customized.

    The nice thing with Gaia is it doesn't take much to get up to speed and running with it.  While playing around with the Gaia demo code, there was one minor hiccup I ran into:

    If you compile the individual page fla that makes any Gaia API calls (such as Gaia.api.getPage), you will get a runtime error.  This makes sense since Gaia API is not available at this point, but it's nevertheless annoying because in the course of developing a site using Gaia, you will be compiling individual pages a lot.  Getting these errors when testing the page individually can be a bit of a distraction.

    The solution to this problem turned out to be quite straightforward.  A quick browse at the framework code shows that Gaia API uses GaiaImpl and GaiaImpl is instantiated in GaiaMain class (via the ungodly name GaiaImpl.birth()).  Since GaiaImpl is being used as a singleton and it has no dependencies with any other classes, there is really no need for it to be instantiated inside GaiaMain.  So I commented out the GaiaImpl.birth call in GaiaMain and instantiated GaiaImpl via static initializer instead.  With this single change, the page will now compile properly by itself even though it doesn't go through GaiaMain.

    public class GaiaImpl implements IGaia
    {
      private static var _instance:GaiaImpl;

      // static initializer

       {

          birth();   

      }
      ...

    }