问题
I am coming from flash to flashbuilder.
I have a directory, AS3_classes_dir, on my computer that stores all of my classes, including my greensock and papervision packages. In every flash app that I make I include that directory in the Source Path, so that I can import whatever I may need. Compiling in flash (using ctrl/enter) takes very little time; only the classes that are specifically imported are compiled.
So today I did that in flashbuilder, included AS3_classes_dir via Flex Build Path/Source Path ... but now the compile time are a couple of minutes, even though I am not even importing ANY of the classes from within.
I do not have any other projects open.
回答1:
The big difference between FlashBuilder and Flash Pro is that the former will load all the referenced classes into memory. This is necessary for the code hinting (or intellisense), the automatic imports and the warning/error messages in the IDE to work (and probably some other functionalities that I'm not thinking of right now. If you make FB always load all classes you possibly have, then you're bound to hit a memory wall.
Therefor having one big project with all your classes is simply not a good approach. It also isn't from a maintainability point of view (in a team it would be a nightmare), but that's a different discussion. So I think you should reconsider it. Note that I understand your reluctance to do so, but in the long run it'll pay off to keep your dependencies more organized.
So the first thing you should do, is cutting that huge project into smaller pieces (library projects) that can stand on their own and then link only the dependencies you need into the main project. There are two main ways to link other projects in your main project. In the project properties, go to 'Flex library build path' and select the tab 'Library path'.
- 'Add project...' lets you add another project from your FlashBuilder workspace. Use this option if you're going to make a lot of changes to the dependency project while working on the main project. Note that this is slower than the other option, because the dependency project gets compiled every time the main project is compiled.
- 'Add SWC folder...' and 'Add SWC...' lets you add already compiled libraries. Use this option if the dependency project is relatively stable and will hardly ever change.
I hope this is enough info to get you started organizing your projects. I have also written another answer on a similar question with some performance and organizational tips that might be helpful to you: Flex 4.5 - to long build process
回答2:
If you are referencing the Library Path:
Make sure you look carefully at the linkage type. In most cases it defaults to 'merge', this is the same with Flash (and how it deals with library.swc's).
You have a couple options
- Merge everything - this is probably what is taking awhile now.
- Link as an RSL - meaning you'll load this at runtime
If you feel adventurous you have a lot more options using a build config, like library-path - which merges only used assets.
If you are referencing the Source Path:
This might be an issue with resource linking with eclipse - this is a big tool meant to deal with a lot of different development platforms.
You might try adding a linkage identifier in: Resource > Linked Resources: This will add a pointer directly to the source path in question - assuming this is outside the project scope and default spaces (outside of doucments, and workspace).
来源:https://stackoverflow.com/questions/9999625/i-added-class-directory-via-flex-build-path-source-path-and-now-building-works