AS3 on the Command Line
Category: general
As anyone who knows me would tell you, I live by the command line, so I thought I would share my newest trick to compile as3 applications from bash.
The trick here is to use the Flex SDK compiler which is available free from Adobe. It also requires having installed java, which is so common on most machines that I won't talk about installation.
- Grab Flex SDK:http://www.adobe.com/products/flex/
- Unzip to: ~/.flex
- chmod +x ~/.flex/bin/compc ~/.flex/bin/mxmlc
- Added ~/.flex/bin to path in .bashrc
Then simply to compile an as3 file:
mxmlc main-app-file.as -o output.swf
Additionally I compile my libraries to my-libs.swc by doing the following:
compc -source-path . -include-sources . -output my-libs.swc
Since this is a flex compile you can also use flex syntax in your actionscript to embed resources in the code. Most commonly I use the swf definition line below to simply definite the frame rate and dimensions of the compiled output.
1 [SWF(width='990',height='680',backgroundColor='0x000000', frameRate='30')]
Now to use Flash CS3's V3 Components see this post: moock.org
Additionally there are Eclipse tools for actionscript: the rasx() context