Flex: Unused mxml and .as files in a flex project
I am trying to make the project build light by removing all the unused (mxml,xml and image ) files. Currently I am manually searching for each image and then removing the unused file. But is there a way such that we can get list of unused files automatically 开发者_如何学编程. I was trying to use the swfDump.jar from 4.0 sdk . But that dint work as it is working with projects that are build using flex sdk 4.0. I am currently using 3.2 . Please advice the best possible solution to this.
Assuming this is a SWF project, (not a swc), then the unused .mxml and .as classes are excluded by default.
The flex compiler only links classes that are required by your application.
The same therefore goes for images, assuming that you're Embedding them in an mxml or as file. (Ie., if the file isn't being linked, then neither are it's embedded assets).
One way to check this is to enable the link-report
option, which will tell you exactly what is being compiled into the swf. For more details, see this answer.
What IDE do you use? In IntelliJ IDEA you can use code inspection to see unused variables, methods, classes.
See this script I wrote a while ago. It's been very useful to date:
https://github.com/lonepalm/findOrphans
It uses swfdump to rip out strings from the bytecode that represent namespaces and class names. It does a comparison of the classes in your source to what is actually in the compiled swf. The difference will tell you what isn't used.
精彩评论