5 Replies Latest reply on Apr 26, 2006 12:44 PM by derelttil

    7000+ lines of code causes erratic behaviour

    derelttil
      I've been having problem with a game I'm writing, I've got nearly 7000 lines of code now (over 5000 in 1 frame), and flash has started producing some strange behaviours. I've post on flashkit (link here) and another user has an identical problem.
      Sometimes, a published swf will do a range of odd behaviours - it will do exactly the same thing for each published swf, but then making completely minimal code changes (even changing the content of a text string which is never refered to) will then cause the swf to perform correctly.
      Sometimes the swf just freezes, sometimes it gets caught in a loop switching between high quality and low quality, sometimes it tries to load a location made up of garbled letters, or on one occassion opened up over a dozen new browser windows.
      This is always triggered whenever a swf is loaded into the main swf.
      I could only think that they was too much code and some of it was being ignored, I tried using external as files, but this didn't fix it, and other users on Flashkit have twice the code I have and no problems.
      Is this a known issue? is there a work around?
      (I'm using Flash 8 professional)
        • 1. Re: 7000+ lines of code causes erratic behaviour
          Level 7
          My guesses aside from a logic problem are that it could be something you
          stumbled on that the compiler is not getting (what are your publish movie
          and AS settings?) or a corrupted movie.

          Here are some items I might try. Make backups of course.

          Try publishing with a different computer and copy of Flash.

          Try Save and Compact.

          Try Save As.

          Try rebuilding from a brand new movie. Will require quite a bit of cut and
          pastes.

          Try loading code in smaller units from external swfs. Although I do not see
          why it cannot be in one Flash movie unless there is a known limit I never
          hit and I am sure I have had Flash movies with at least that much code.

          --
          Lon Hosford
          www.lonhosford.com
          May many happy bits flow your way!
          "derelttil" <webforumsuser@macromedia.com> wrote in message
          news:e2gsmt$6ia$1@forums.macromedia.com...
          I've been having problem with a game I'm writing, I've got nearly 7000 lines
          of
          code now (over 5000 in 1 frame), and flash has started producing some
          strange
          behaviours. I've post on flashkit
          http://www.flashkit.com/board/showthread.php?t=683922 and another user has
          an
          identical problem.
          Sometimes, a published swf will do a range of odd behaviours - it will do
          exactly the same thing for each published swf, but then making completely
          minimal code changes (even changing the content of a text string which is
          never
          refered to) will then cause the swf to perform correctly.
          Sometimes the swf just freezes, sometimes it gets caught in a loop
          switching
          between high quality and low quality, sometimes it tries to load a location
          made up of garbled letters, or on one occassion opened up over a dozen new
          browser windows.
          This is always triggered whenever a swf is loaded into the main swf.
          I could only think that they was too much code and some of it was being
          ignored, I tried using external as files, but this didn't fix it, and other
          users on Flashkit have twice the code I have and no problems.
          Is this a known issue? is there a work around?
          (I'm using Flash 8 professional)


          • 2. Re: 7000+ lines of code causes erratic behaviour
            Level 7
            There is a limit in compiled SWF code for how far you can jump (eg how much
            you can have inside and if/loop etc) .. this is due to script using a 16-bit
            offset ie +=32767 bytes. There are other similar limitations in script, and
            Flash does not complain about it .. it just produces bad code. If your
            script is very big, you could be running into those limitations.
            --
            Jeckyl


            • 3. Re: 7000+ lines of code causes erratic behaviour
              derelttil Level 1
              thanks for your replies - I've tried starting from a blank fla and completely re-importing everything - the problem still occurs.
              I'll try compiling it on another machine.
              Jeckyl - so I can have a maximum of 32767 bytes within a single if statement? but, why would it then start working when I add more code to the statement?
              • 5. Re: 7000+ lines of code causes erratic behaviour
                derelttil Level 1
                Jeckyl - thanks, I think you may have it there - I've removed some chunks of code into their own function, and it's stopped behaving erratically. thanks to everyone who replied!