views:

44

answers:

2

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.

A: 

This is telling you that the file needs to be in a directory named Office. The package structure and the file structure (i.e. directories) must match).

James Keesey
I have a directory Office and the Employee.as is in that directory. It is still giving that error.
Hemanshu Bhojak
A: 

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.

Hemanshu Bhojak