“a file found in the source-path must have the same package structure”

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)
{

}
}

Advertisements

4 Responses to ““a file found in the source-path must have the same package structure””

  1. Murali Nagaraj Says:

    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.

  2. jjmcinto Says:

    I solved my own version of this problem: I got “A file found in a source-path must have the same package structure ”, as the definition’s …” and I originally had “package flash.text” at the top of the class. I removed the “flash.text” and now it works. So, whatever comes in the quotes after “structure”, try putting that as your package name.

  3. Nada Says:

    hello,
    i have that same problem
    Do you mean i have to explicitly write the path the line before the package declaration ??
    like:

    H:\stuff\lab\AS3\ EmployeeTestDrive.as
    package test{
    //

    ..
    }

    like this??
    please answer me
    thanks in advance

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: