开发者

imports and package structure in as3/flex

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开发者_JS百科 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!!!


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.


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜