The compc component compiler always inserts a script named
"_<large hex string>_flash_display_Sprite"
into every project I compile---even completely blank projects with no no source files at all. How do I stop it from inserting this script?
To duplicate the problem, run compc on any project (even an empty project with a minimal config file) and add the command-line options "-directory=true -output=outdir". Read the resulting outdir/catalog.xml file and you should see an entry for the above script near the bottom.
I am using compc version 4.6.0 build 23201.
I need the resulting swf to be as small as possible, and it must not run any code unless its library methods are explicitly called. Otherwise it disrupts some of the swfs that import it. The script that compc is adding violates both these requirements.
I'll note that limiting my project to only one file and running mxmlc on it instead of compc fixes the problem. The resulting swf does not include the unwanted script and runs perfectly when included into other projects. However, this limits me to only one source file, so is not a viable solution. Somehow I need to get mxmlc's slimmer treatment but with multiple source files.
Compc only builds a library. When using MXMLC to build the final app, any classes not referenced will not be linked in, and any not actually used at runtime will not be initialized. Check the link-report of the final app to see if those Sprites are in there and who referenced them if they are.
If I were to use MXMLC to build a final app, then yes, it would strip unused classes during linking. However, I am not building a final app. For my application, the library.swf is deployed directly. I therefore need it to contain only the code in my sources, not this extra class.
I'm not sure whether this is helpful, but I have discovered that when I add the "-keep" option to the command-line, it produces a source version of the unwanted class in a file named "generated/_<large hex string>_flash_display_Sprite-generated.as". However, I still don't know how to prevent compc from including it into libraries that have no references to Sprite (and no references to anything, for that matter).
I have thought of both these ideas but neither works:
(1) The -includes options for COMPC only let you include extra things, which obviously isn't helpful here. The only -includes option for MXMLC includes an entire SWC library, which returns me to the same problem: How do I make my SWC not include this unwanted Sprite object?
(2) If I create a single class that references the others and compile it with MXMLC, I now have a new unwanted class that I can't get rid of (the one I just created to reference the others). If I use command-line options to exclude that new class, suddenly everything goes away because nothing references the other classes anymore.
This solves my problem! Thank you!
For those who may not want to follow the whole discussion above, the solution is to use MXMLC with a config file that contains the following:
This makes MXMLC act like COMPC, forcibly including all the listed symbols (and any of their subcomponents) into the compiled binary, but creating an otherwise slim SWF instead of a SWC bloated with unwanted scripts.