10 Replies Latest reply on Jun 11, 2012 8:24 AM by hamlen

    compc inserts unwanted Sprite script

    hamlen

      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.

        • 1. Re: compc inserts unwanted Sprite script
          Flex harUI Adobe Employee

          It might be put in there in case the SWC is used as an RSL.  Why does it affect you?

          • 2. Re: compc inserts unwanted Sprite script
            hamlen Level 1

            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.

            • 3. Re: compc inserts unwanted Sprite script
              Flex harUI Adobe Employee

              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.

              • 4. Re: compc inserts unwanted Sprite script
                hamlen Level 1

                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).

                • 5. Re: compc inserts unwanted Sprite script
                  Flex harUI Adobe Employee

                  Do you need the catalog.xml in the SWC?  Otherwise, just use MXMLC instead of COMPC.

                  • 6. Re: compc inserts unwanted Sprite script
                    hamlen Level 1

                    MXMLC only compiles a single .as source file into a single .swf binary file.  I need to compile multiple .as source files into a single library.swf file.  As far as I know, MXMLC cannot do this.

                    • 7. Re: compc inserts unwanted Sprite script
                      Flex harUI Adobe Employee

                      You can try the –includes option, or have a single class that references sthe others.

                      • 8. Re: compc inserts unwanted Sprite script
                        hamlen Level 1

                        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.

                        • 9. Re: compc inserts unwanted Sprite script
                          Flex harUI Adobe Employee

                          The includes option for MXMLC allows specification of a single class.

                          • 10. Re: compc inserts unwanted Sprite script
                            hamlen Level 1

                            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:

                             

                            <includes>

                              <symbol>mynamespace.myclass</symbol>

                              <symbol>mynamespace.myclass</symbol>

                              ...

                            </includes>

                             

                            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.