August 25, 2007

One thing I was surprised to learn is how easy it is to program in ActionScript. It’s pretty much just like a compiled version of JavaScript, with a few slight improvements. One thing to keep in mind, however, is the output is a SWF file rather than an EXE, and the “application” is very graphically oriented: I’m not even sure if you can make an ActionScript application that has no GUI. So, our basic HelloWorld application is as follows:

package {
import flash.display.Sprite;
public class HelloWorld extends Sprite {
public function HelloWorld( ) {
graphics.beginFill( 0xFFCC00 );
graphics.drawCircle( 40, 40, 40 );

Save that into a file named “HelloWorld.as”, and then run “mxmlc.exe HelloWorld.as”. It’ll spit out HelloWorld.swf. Drag that into a FireFox window (or run SAFlashPlayer.exe HelloWorld.as — it’s supplied with the Flex SDK) and Tah Dah! Your very first Flash component, compiled from scratch.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: