Archive for the 'ActionScript 2' Category

Gaia: A Front-end Framework for Adobe Flash

Gaia Framework for Adobe Flash

Roughly about 6 months ago, my then colleague Arul blogged about Gaia (pronounced “guy-uh”), and that marked the changes in me ever since. :D

Authored by Steven Sacks, “Gaia is a front-end Flash Framework designed to dramatically reduce development time”. What I love about it is that it provides common solutions to repeated tasks that we, as front-end developers, have to face in almost every project, such as:

  • Navigation
  • Transitions
  • Preloading
  • Asset management
  • Site structure
  • Deep linking

From my own experiences of using it in a recent project, Gaia has indeed proven itself in the following areas:

  1. The Scaffolding engine creates a click through version of my site in less than 10 minutes! I was able to have a basic run through thereafter with my designer and setting things right the first time saves us a huge amount of time changing later on.
  2. I used to hear about swfobject and the goodness of deep linking that swfaddress brings, but I never had an idea of how to implement them. With Gaia, they’re already done for me! No pain, all gain! :P
  3. I am able to do things the way I like, without restricting my coding style by the way Gaia is implemented. This is absolutely a plus, because I don’t have to conform to it, and it still works!

These are just some of the key points actually. The extent of the convenience and time that I saved allowed me to even blog about this right now. :D To fully understand it’s capabilities, there’s no other better way than to use it in your next project. ;)

You can download the latest framework here, find the documentation here, and if happen to have a few minutes to spare, watch how you can build your very first Gaia project here!

VERY IMPORTANT NOTE:

The long awaited AS3 Gaia Framework is nearly upon us! Find out how to participate in the beta release on January 22nd! *w00t*

Sphere: Related Content

AddThis Social Bookmark Button

Learning Papervision3D

Been procrastinating for the longest time, but finally committed time since the beginning of this week to look at this marvelous 3D rendering engine for Flash. :D

Papervision3D, or PV3D in short, is a high performance 3D engine which you can use in your Flash 8, Flash CS3 and Flex projects. It is available in both AS2 and AS3 for development.

Here’s a quick list of resources to get started! ;)

Sphere: Related Content

AddThis Social Bookmark Button

Loading Text From XML

Made a silly mistake while loading text from an external XML file and I really really don’t want anybody to follow in my footsteps. :P

<strings>
    <string id="someString">
        <![CDATA[Sentence one\nSentence two]]>
    </string>
</strings>

Does the above code looks flawed to you? Take a moment and look it through. :)


When you do the below AS2 codes in flash, what the \n does in the string is basically creating a newline, and thus "Sentence two" will appear below "Sentence one".

var txt:TextField = createTextField( "txt", _root.getNextHighestDepth(), 100, 100, 200, 200 );
 
txt.text = "Sentence one\nSentence two";

Happily, I ported all these original strings into an XML and got it loaded. What puzzled me was that, when these text were actually loaded, the \n didn’t work! The textfield simply displayed "Sentence one\nSentence two" without the newline. I sought help from a fellow colleague, Arul, and together, we still could not see what’s wrong with it. We left office without solving that "bug".

That night, Arul called to say, "Hey, with CDATA, we don’t need the \n! We simply just need to hit <enter>!" Immediately it struck me, oh ya! That’s the whole idea of using CDATA isn’t it? We got too engrossed with the wrong problem! :D

The next day, I changed all the \n to <enter> key, and expected things to work. Unfortunately though, the text did not turn out as expected. Flash had interpreted my <enter> in XML as double <enter>s when it’s being displayed on the textfield!

I sought Arul’s advice again and this is what I got. Flash interprets <enter> in external text sources as "\r\n", which explains the double <enter>s being rendered. So, what I actually had to do is to run through the string, strips off the "\r", and change it to "" (empty string).

Here’s the code that solves the above issue.

function processString ( s:String ):String
{
    return s.split("\r").join("");
}

Hope this helps! ;)

Sphere: Related Content

AddThis Social Bookmark Button