views:

21

answers:

1

Hi,

I am playing with a Flex 4 / Air 2 project, that loads Modules at runtime. I can include intrinsic MX classes in my module and all works fine (eg: import mx.controls.Alert).

I can also include my own classes - however, only if the class is in the same folder as the module.

eg:

<?xml version="1.0"?> 
<mx:Module> 
    <mx:Script> 
        <![CDATA[ 
        import mx.controls.Alert; // works
        //import MyTestClass;       // works if MyTestClass.as is in same folder as module
        //import Classes.MyTestClass; // throws compiler error


    ]]> 
    </mx:Script> 
</mx:Module> 

Folder structure:

.
|-- Classes
    |-- MyTestClass.as
|-- Modules
    |-- MyModule.mxml
`-- application.mxml

So When I attempt to compile my Module, when importing "Classes.MyTestClass", the compiler throws the following error:

"Error: Definition Classes:MyClass could not be found"

I know that the path to the Class is correct, and if I compile the project as an application, rather than a module, all is AOK.

Additionally, if I import "Classes.MyTestClass" in the parent application, all is fine. So I guess I am missing a compiler option to include these classes in the module, but have no idea what! This is how I am compiling the module:

mxmlc -static-link-runtime-shared-libraries=true -load-externs=../obj/exclude.xml -isolate-styles=false ../src/Modules/MyModule.mxml

"../obj/exclude.xml" is the link report from the "Parent" application.

Can anyone help as to what I am missing?

A: 

You need to include you classes folder as a source path so the compiler can find that class.

Append this command to mxmlc:

-source-path /src/Classes
grapefrukt
You hero... Thanks!
bob