R – Compiling ActionScript 3 Files from the Command Prompt


I have a file Employee.as with the following source code. I am unable to compile it from the command prompt.

package Office{
    public class Employee{
        private var _firstName:String = "";

        public function get FirstName():String{
            return _firstName;

        public function set FirstName(value:String):String{
            _firstName = value;

The error which I get is:

Error: A file found in a source- path must have the same package structure
'', as the definition's package, 'Office'.

Also, I want to know how to compile multiple files in a folder from the command line. I am planning to create a package with multiple files to form a library which I can use in my flex projects.

Best Solution

I was actually using the wrong command line options. I was earlier using mxmlc but on googling I found that for compiling libraries we have to use compc.

compc -source-path . c:/flexdeploy/comps/mypackage/ 
    -output c:/jrun4/servers/flex2/flex/WEB-INF/flex/user_classes/MyButtonComp.swc 
    -include-classes mypackage.MyButton

This solved my purpose.

Related Question