2

Although I am using Flash CS3 for development, my project is virtually pure AS3; My .FLA file is nothing more than a movie of 640x480 , no classes, no controls or libraries and my Action window has a single line of code

  include 'myscript.as'

which is one big as3 file of about 10,000 lines....

The swf file generated is only around 18k in size, but a lot is happening within the app....

My question/problem is , how do I compile my 'myscript.as' with flex instead of cs3? ( I want to make use of the newer as3 functions , and want to compile via the command line )

I should mention, I've noticed in a lot of AS3 code there is something like the following

    public class someapp extends sprite
    {
    ....
    }

I have no classes whatsoever in the code because everything runs inside my own state machine, will this be a problem with flex ? or can flex compile anything cs3 can compile ??

the swf (it's a video chat,airtime type app) is at http://www.mebeam.net/chat_SO_demo

  • `I want to make use of the newer as3 functions`: do you mean it's currently written in AS2? And `I have no classes whatsoever in the code`: like only functions then? – RIAstar Jun 29 '12 at 20:57
  • the new as3 functions like p2p , echo cancel ,, which is not supported in cs3 ) or is it ?? –  Jun 29 '12 at 22:38
  • yes, no classes,, just functions, and a finite state machine which is called apx 50 times per second –  Jun 29 '12 at 22:39
  • Those new functions are in fact in the new versions of the Flash Player. I suppose CS3 doesn't let you target anything higher than FP8 or so? – RIAstar Jun 29 '12 at 23:25

1 Answers1

0

First download a Flex SDK from http://sourceforge.net/adobe/flexsdk/wiki/Downloads/

Unzip it; in the unzipped folder, you'll find a directory called bin. In there are all the Flex compilers and tools. The one you'll need to compile Flex or ActionScript application is called mxmlc.

You will have to provide it with at least these three pieces of information:

  • the root path of all your ActionScript source files
  • the path of the file you want as an output file: this should of course have a .swf extension
  • the path to the main ActionScript class; the entrypoint of your application

Now you can compile your application on the command line like this:

mxmlc -source-path+=/path/to/myproject/src -output=/path/to/myApp.swf /path/to/myproject/src/Main.as

As far as I know this entrypoint (the Main.as file in the example) must be a class, though I must admit I never tested it otherwise. So you will have to create at least this one class that extends Sprite and initiate your functional program from there.

public class Main extends Sprite {
    public Main() {
        firstGlobalFunction();
    }
}
RIAstar
  • 11,912
  • 20
  • 37