0
votes

I've got a problem how to organise files and packages in AS3/Flex project. A short intro to the problem:

The files structure in the project is (and should stay) like this:

libs/Class1/src/<files>
libs/Class2/src/<files>
libs/Class3/src/<files>

The amxmlc compiler source-path variable points to:

libs/

I need it because I have to subclass Class1 in Class3. That pushes me to put all the classes into packages that look as weird as this:

package ClassX.src { /* ... */ }

So in practice it looks like that:

package Class3.src
{
    import Class1.src.Class1; // I prefer direct imports

    public class Class3 extends Class1 { /* ... */ }
}

Is there a way to keep the files/folders structure and get rid of src in the package name. Changing the files structure or direct pointing compiler into base-class directory in not an option.
It's really confusing for new programmers who join the project and we really want to avoid that.

Great thanks for ANY help!!!

2
I agree that this is very confusing and unusual. But I don't understand why the structure has been set up like this in the first place? Why do you put src folders in the lib folder? If you want to provide libraries create SWCs and drop them in there. - ilikeorangutans
It's a svn project that includes more then five different programming languages and the dirs structure has to be like that for the whole project. The libs/ is a misleading name a bit. There is a swc lib inside, but the classes i mentioned before are sth like plugins for the main app. Each ClassX is one plugin, so they are not standard libs to be closed in swc, but each is instantiated itself and some of them should be open for subclassing. Simplified import statement would be really the BEST option. I don't know how to force it. The * doesn't go deeper in the dirs structure unfortunately. - trzewiczek

2 Answers

1
votes

So there's two things here. The first is the way those "plugins" are included in the project and the other is the import statement.

About the plugins: you should really consider making them SWCs. You can subclass classes that are in SWCs, so there's no need to have code in there. Just my gut feeling tells me this might cause lots of confusion.

About the import: I don't think there's a way around that unless you change your package structure. As you've notice the '*' will only import packages on one level so you have to import every package/class.

1
votes

The only way to get rid of the src package is to change the file structure.

As for the plugins, I would create a separate "Flex Library Project". You could then either put the plugin packages directly into the root directory of that new project or because you don't want to change the file structure, you could add the folders in the properties for the plugin Flex Library Project in the Source Path tab under Flex Library Build Path.

To import the plugins in a different project you would have to add the Flex Library Project to the Library Path of the importing project (also a tab in the project properties under the Build Path option)