actiontad logo white
Using ActionScript Files

ActionScript files have the extension .as.
To make a .as file simply open note pad or your favorite plain text editor and write your packaged ActionScript code
then save the file with the ending .as instead of .txt. (eg. "myfile.as")

the mxmlc compiler
Mxmlc.exe is a command line tool that can be used to compile .as files into .swf files. (shown above)
This file comes with Adobe Flex/Flash Builder and is also part of the Adobe Flex SDK.
The Flex SDK is offered freely, Flex/Flash Builder is an Adobe program for creating rich applications.
A link to a trial of Flex Builder:
The Flex SDK can be found here:

Technically the mxmlc.exe compiler is for making Flex applications
that utilize the mxml language or import from the mx package,
using either is considerd the basis of a Flex application.
(Swfs can also be made from a combination of .mxml and .as files
or one .mxml file that is much like xml with AS3 in its "<mx:Script>" tags)
However, in general terms Flex applications are .swf files.

The reason I stray from the mxml language and the mx package is because swf files
compiled with mx controls are normally larger in size and are best suited as desktop or network applications.
Simply using the mx.controls.Button class costs 100kb or more.
literaly this:
  import mx.controls.Button;

  public class BareButton extends Button


would be about 113kb.
(note that 'Invaders form the darkness...' in the arcade, is only 645kb!)

Flex applications are just that..applications.
For the most part they all have the same general look,
and best of all come with a pre-loader already.
But doing things with just pure ActionScript 3.0 is smaller
and therefore more suited for web pages.

Using the mxmlc Compiler

The mxmlc.exe file (above) does not work by itself, it is linked with different files in the SDK.
Furthuremore, to use the mxmlc compiler you will also need to have Java installed on your computer.
Most people already have Java installed on their computers, however if you do not you can download the latest version from java.sun.com

note: If you are a Windows Vista user and you've downloaded version 6 of Java you may need to copy the
msvcr71.dll file (located in java/jre6/bin/new_plugin) to your windows/system32 folder.

In general do not move the mxmlc.exe file, make shortcuts to it and then files compiled should get saved in the shortcuts' folder,
if not, they will be in the bin folder of where you unzipped the SDK.

If you've unzipped the SDK it will be located in c:\(your folder choice)\bin\
If you have Flex Builder look for the bin folder amongst the installation folder.

To compile swfs in Windows all you have to do is drop a .as on mxmlc.exe (or a shortcut to it).
If the .as is written correctly a .swf file will get created.
If there are errors it will show them to you and not compile,
however from a drag and drop you will not have enough time to see the errors.

In Windows you can use mxmlc.exe from the command prompt to see the errors.
A basic execution would be "start", "run..", (type) cmd.exe (hit enter) then:
(type) cd\   (hit eneter)
(type) cd (folder you unzipped to)\bin  (hit enter)
(type) mxmlc.exe "c:\(the .as file location)\myswf.as"  (hit enter)
On a Mac you will also need to execute mxmlc.exe.

For complete information about the compiler look here:
http://www.adobe.com/go/flex_documentation for the build_deploy_flex3.pdf download.

Using ActionScript files with Flash CS4

In Flash CS4 (and up) .as files can be used to hold Document Classes.
To define a Document Class you simply write the name of the .as file (minus .as) as the Document Class name of your project.
Your .fla file and .as file must both have the same source path.
Your .as file must be written as packaged code.

Instead of using any [Embed...] declarations you could use symbols in the library.
You would also declare stage width, height, frame rate and background color in Flash instead of using [SWF...] in your package.

back to top

actiontad twitter.com/actiontad terms