how to migrate from Cs3 to Flex

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


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();
        }
    }
    
    链接地址: http://www.djcxy.com/p/35436.html

    上一篇: 如何使用defaults.css?

    下一篇: 如何从Cs3迁移到Flex