Today we continue to explore the SWC problem. There has been no authoritative guidance on how SWC is used, so every time I have a question I always test myself. Today I have another question: what is the relationship between SWC and SwF volume in a Flex project? Knowing this can make it better for us to do the project. So I made the following three assumptions about the introduction of SWC:
1. Assuming 1:1 but the project contains SWC (i.e., SWC under the Lib folder), the resources in the SWC are all embedded in the SWF and the SWF file increases
2. If you refer to a resource in a SWC, all the resources of this SWC are embedded in the SWF file. Do not embed when not in use
3. Suppose three: referencing a resource in a SWC will only embed this resource in the SWF file, and the other useless will not embed
So I started to do the verification. into a inside containing two MP3 (each 3M or so) file SWC, placed in the Lib directory. Because the Lib directory has been set up to reference SWC, the project has included the SWC. Then look at the generated SWF, only 50 more than the K comparison, So suppose that one is not correct
I am new in the main file to see the generated SWF size is more than 2M, the new two sound generated SWF is more than 5M. This proves the assumption that the third is correct.
Conclusion: Referencing a resource in a SWC will only embed this resource in the SWF file, and the rest will not be embedded. Therefore, we can safely and boldly put the material and resources of each module into the SWC, without having to generate a SWC per module (if you feel it is necessary to separate and separate), Flex will only embed the resources you use into the SWF file.
In addition, only import a class of resources, Flex does not embed it, only you import and Var a:sound will be embedded after
SWC Embedding problems