Very weird, frustrating issue. (onEnterFrame not working)

Alright, so I’ve ran into an issue with Flash that has been a hell work out. I Google’d the crap out of this one and couldn’t find any information. Basically when I run my game under certain, unspecific conditions, the main loop doesn’t work. The quality variable changes rapidly for no reason. Nothing in the game works, all the MCs play through their frames as if there wasn’t any code. None of it really seems to work.

Sorry in advance for the long winded post, but I feel just telling the story of what I’ve been through would be best for describing this thing.

I’ve been working on this game for what feels like 6 months now. Recently Flash has been acting up when I publish it, it acts like it’s ignoring huge chunks of code in the main onEnterFrame = function() loop. At first I thought it was totally ignoring the loop for what ever reason, turns out it wasn’t as it’ll still follow simple Trace functions.

Taking out chunks of code by commenting it out seems to fix it. So I thought I might be at a code limit or something, no way was that the issue because I had only around 2K of code (and I’m not even sure a limit exists).

Intentionally off-by-oneing a for loop seemed to help as well, but the code in the loop itself is fine so it’s seems strange that off-by-oneing would fix such an issue, except if it had to do with the amount of code ran at once.

Around a month back I turned to Newgrounds for help. Didn’t really get anywhere (not trying to insult NG, love that site). What I *thought *happened at that point was that the amount of code was causing the game to try to access something that wasn’t loaded yet and caused the loop to freak out. Changing the the order of the code seemed to fix it for now. As it turns out, that was only a band-aid.

The bug came back to haunt me after adding another MC and it’s code to main loop.

Obviously, I have no idea what’s going on. I ran one experiment with tracing to see how far the loop was being ran until it gave up, turns out the whole thing runs once then it just repeats the first line infinitely. The only thing in my loop aside from 20 or so #includes are about 4 concat functions for my object arrays. Commenting out these gave different results for each. It was weird. Commenting out all four seems to make the thing work again except that collision detection was screwy for obvious reasons.

Playing with it, I discovered that publishing it with “omit trace actions” checked on makes it work perfectly. Trying to use the Debugger causes it to break again no matter what. So basically I can get to work, but the two easiest methods of debugging can’t be used, making work extremely hard.

So this is where I’m at now. writing this while trying not to lose my ****ing mind. Anyone ran into such an issue or know any remedies? Any help would be extremely, well, helpful.

I’m using Flash 8. AS2 for obvious reasons. I’m working on an ancient eMac G4 with one gb of RAM.

My loop is structured as:
onEnterFrame = function (){[INDENT]if (GamePause == false){[/INDENT]
[INDENT=2]#include "stuff.as
#include “more stuff.as”
[/INDENT]
[INDENT]}
#include “etcetera.as”

TPlats = (long concat function)
TWalls = (long concat function)

(Test NG medal)
(debug trace functions that are commented out)
[/INDENT]
}