Tuesday, October 28, 2008

AS3 01 - Hello World

Ok.. here goes.. for those who can script and understands what eventListeners are... skip this article NOW!

For those who can draw on Flash CS4 or CS3 but with a little.. subtle... knowledge of know how on ActionScript 3... read on. and cry because you are not gonna end up any better!

AS2 gave way to AS3 as the scripting language for Flash. Release concurrently with CS3 (but was actually released announced in 2006 and released with Flex 2), this joker pack speed boost and a nightmare change of structure. They did good... good they did. The original AS was back in 1996 so after 20 years, they came up with version 3. I wouldn't say the same with certain 3D studio software which spawns almost 10 versions... I started with 3d studio for DOS.

Now I would assume that most that read this article have at least a basic understanding of simple scripting language like errr... loop? if else... stuff like that? What was it you say? No? Great.... because I am about to go through this very quickly.

Let's start with 'Hello World'.

Here are the crappy steps...

1. Launch your Flash CS4/3 ... whichever you prefer. (Tips... CS4 crawls on my PC :(... but I still need it thanks to the bones feature... which reminds me of Animatoion Master, Anime Studio... why am I saying these things here...)

2. Create a new Flash Action Script 3 file.

3. You will be faced with a blank screen. Unlike other blank screen, if you look at it carefully you can faintly see Mona Lisa.... There is a 'Layer1' in your timeline created by default. Move your mouse over to the first cell/node/'that thing' and right click to bring up a floating menu. Select 'Action' to enable importing your action figures and you will bring up the ActionScript editor.

4. Type in "trace('Hello World');"

5. Now hold down 'Ctrl' and 'Enter' together to test the movie.

6. That's it! Your first action script in action... this is a waste of time... dammit why do I even bother writing this article.... Wha? You mean that's it? If you don't know where to look for the 'Hello World', just close your AS editor and test the movie again. The 'Hello World' is in the OUTPUT tap.

Now for those who do not understand what 'trace()' does, just go back to the AS editor, highlight the word 'trace' and hit 'F1'. The help file should explain what it does.

So in this article you know how to bring up the AS Editor, type in a simple AS, test the script and view it's output in the OUTPUT tab. Now that was very informative...

.... not really.

No comments: