13 Replies Latest reply on Jul 19, 2009 2:05 AM by shintashi

    compiler error too many lines of code?

    shintashi Level 1

      I'm working on a project that apparently has too much going on at once (images, commands, etc). I've pinpointed it down to a single command (which is identical in function to several others right next to it with different variables) and as long as I /* comment */ it out, the program works fine.

       

      It doesn't seem to matter which lines I choose to comment out, as long as some of the code is turned off.

       

      What are some techniques I can use to make the thing compile?

      here's some of the ideas I've come up with, but if they won't work, I want to save some time asking first:

       

      creation of more multivariable functions to reduce overall file size of action script

      shrinking some of the "trace bitmap" images before importing and converting them for the Flash

      splitting up the document into a group of small files with a compile program for later (no idea how to do this)

      setting up a preloader (never done this before and not sure it would work).

       

       

      FYI, the as file is about 2200 lines of code 5700 kb as a flash doc and about 201k as a flash movie.

        • 1. Re: compiler error too many lines of code?
          kglad Adobe Community Professional & MVP

          what's the compiler error?

          • 2. Re: compiler error too many lines of code?
            shintashi Level 1

            it loads the first frame of the movie clip. The timeline controls are non functional. The keylistening is non functional. The objects in the first frame are visible but do not respond to the mouse. The navigation keys do not respond. It's as if the actionscript were non existent.

            • 3. Re: compiler error too many lines of code?
              shintashi Level 1

              changing the file size by resising the images didn't stop the compiler error. It is clearly linked to the actionscript. I may have exceeded the maximum amount of data/variables or some other unit available on a single layer.

              • 4. Re: compiler error too many lines of code?
                Ned Murphy Adobe Community Professional & MVP

                What is the code that you pinpointed?  It sounds like you may have something amiss in that code that is causing the program to stall out.  I know you say it's identical to other code, but maybe a second set of eyes or two can notice something you aren't catching.

                • 5. Re: compiler error too many lines of code?
                  kglad Adobe Community Professional & MVP

                  that's possible but unlikely.

                  • 6. Re: compiler error too many lines of code?
                    shintashi Level 1

                    stuff that caused it to crash... (lines 1711 - 1720)

                    /*
                    navigation.tableu8.cB.feather1.onPress = function(){
                        navigation.tableu8.cB.specialization.text = aSpec[0];}
                       
                    navigation.tableu8.cB.feather2.onPress = function(){
                        navigation.tableu8.cB.specialization.text = aSpec[1];}
                       
                    navigation.tableu8.cB.feather3.onPress = function(){
                        navigation.tableu8.cB.specialization.text = aSpec[2];}
                        */

                     

                    stuff that works fine (lines 1722-1726)

                     

                    navigation.tableu8.cB.feather4.onPress = function(){
                        navigation.tableu8.cB.specialization.text = aSpec[3];}
                       
                    navigation.tableu8.cB.feather5.onPress = function(){
                        navigation.tableu8.cB.specialization.text = aSpec[4];}

                    • 7. Re: compiler error too many lines of code?
                      kglad Adobe Community Professional & MVP

                      if that's an indication of your code, you can compress it quite a bit.

                      • 8. Re: compiler error too many lines of code?
                        shintashi Level 1

                        how about:

                         

                        ----

                        navigation.tableu8.cB.feather5.onPress = function(){
                            navigation.tableu8.cB.specialization.text = aSpec[4];}

                         

                        becomes:

                        function chkbx(m:String, special){

                        navigation.tableu8.cB["feather"+m].onPress = function(){
                            navigation.tableu8.cB.specialization.text = special;}

                        }

                         

                        called : chkbx(5, aSpec[4]);

                         

                        ----

                         

                        I don't think the above will work (I tried something similar earlier today and it failed), I've got this feeling something's missing though, and it doesn't seem as compressed as it should be.

                         

                        edit: the value called was a "mismatch error", whatever that is. I think I failed to parse it correctly. Is there a good site for polishing up on functions?

                        • 9. Re: compiler error too many lines of code?
                          kglad Adobe Community Professional & MVP

                          :

                           


                          for(var i=0;i<5;i++){

                          navigation.tableu8.cB["feather"+(i+1)].ivar=i

                          navigation.tableu8.cB["feather"+(i+1)].onPress = function(){
                              navigation.tableu8.cB.specialization.text = aSpec[this.ivar];

                          }

                          }

                          1 person found this helpful
                          • 10. Re: compiler error too many lines of code?
                            shintashi Level 1

                            ok, I've since used kglads for loop and used the technique for some other parts, and it worked sufficiently for about 20 more lines of code (page loaded normally) until I added the radio button actionscript, and it froze up again. When I commented out some other sections of the code, the radio button code worked normally. The AS file is simply too big. Would having multiple actionscript files break it down, and how would I do that? I've still got a good 3000 lines of code to do.

                             

                            edit: I've created an external AS file using #include. Like everything else in the main AS file, by commenting out some random part of my program, it works, by commenting out the include line, everything else works. It is definitely a boundary that multiple AS files will not fix.

                            • 11. Re: compiler error too many lines of code?
                              shintashi Level 1

                              I've now tried just about everything short of making multiple SWF files. I tried splitting the main navigation into two movie clips (tabs 1-6 & tabs 7-12). I treid addressing completely different aspects of the program, and even tried something that seemed completely ridiculous - repeating cumulative rotate codes for a movie clip. At this point I was certain it really didn't matter WHAT my actionscript content was, but HOW MUCH actionscript I had running.

                               

                              Lo and behold, I pinpointed it down to a single line. Add a line, program crashes, delete the line, program fails. I had 40 dummy lines to test this with, it didn't matter which one was deleted, or what they did.

                               

                              105654 bytes works

                               

                              105774 bytes doesn't work

                               

                              No matter how amazing my compression will be, the simple fact is, when I get to X number of lines, the program will freeze 100% of the time. How do I get beyond this code limit? Is it only possible with a server, lots of money, and multiple SWF files?

                              • 12. Re: compiler error too many lines of code?
                                kglad Adobe Community Professional & MVP

                                what number of lines is that?

                                 

                                i've had as many as 5700 lines of code in one swf (http://www.shoremaster.com/  - design your dock) and had no such problems.

                                • 13. Re: compiler error too many lines of code?
                                  shintashi Level 1

                                  I think the amount of lines do not determine if flash will crash. The amount of unique tasks the code asks flash to perform determines whether or not it will crash.