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.
No comments:
Post a Comment