When compiling an ActionScript file, the source path needs to be clearly defined or otherwise the compiler will complain with the following message:
"A file found in the source-path must have the same package structure..."
This can be fixed by adding the “source-path” definition in the command line, like this:
“H:\stuff\lab\AS3\test>c:\flex_sdk_2\bin\mxmlc -source-path=H:\stuff\lab\AS3\ EmployeeTestDrive.as“
when compiling the following .as file which resides in “H:\stuff\lab\AS3\test” folder:
package test
{
import flash.display.Sprite;
import flash.text.TextField;
public class EmployeeTestDrive extends Sprite
{
private var _foo:TextField;
public function EmployeeTestDrive()
{
_foo = new TextField();
_foo.text = "hello world!";
addChild(_foo);
var employee:Employee = new Employee("sdk_dev222");
}
}
}
////
class Employee
{
function Employee(id:String)
{
}
}
July 20, 2009 at 6:21 am |
looking at the cryptic adobe flex docs, it requires a “DIRECTORY” not a file called ‘xxxxx’ (where xxxxx is your package name) and you place your
action script files in there.