Dear Sinious,
I feel faint at the concept of disputing anybody in here who gives solid advice.
Still... I have seen it happen.
I understand the danger of global vars and the mess of having to many lines of code.
But I think it might have something to do with the amount of code/vars.
It sounds extremely noob I know. But read below.
I moved some general data vectors and init routines to the startframe as a way of spreading the startup time before actual level start.
These variables just didnt survive in the second frame and the whole thing stopped working.
(not errors but erratic behaviour of the app).
Also:
There was this basic function that was left unchanged from the start and worked fine.
It got shifted down a lot by adding more and more code above it.
At a certain point it failed at runtime, also not in error but in wrong behaviour of the code.
I then traced it and it showed 0, yet I inititalized it different and didnt touch it in any other function.
The declaration of the vars used was just above the function.
Then all i did was move the var declaration to the top of the framescript and it worked again.
It was not changed or used anywhere else.
This happend more and more when the code got longer.
Especially with vars declared in the first frame. So I just re-reinitialise them at the beginning now.
I ended up moving every declaration to the top.
Now i have to scroll a lot though.
Its a bit of a twilightzone thing but I worked around it and left it at that.
I'm sure it has a reasonable explanation wich, when i learn it, will make me stick my head in the toilet bowl and flush it.
Highest regards,
Mac
Oh, I know exactly your pain. I used AS2 a LOT longer than I should have. I had some apps exceeding 10,000 lines in a single class file and had flash say my file exceeded the max size and I couldn't even export. I also saw it mysteriously lose references to objects or "something else" adjusted or nulled my variables.
But that was AS2 and a long time ago...
I have never seen AS3 have this issue. You have a ton of code so I would completely expect, having known flash for over a decade, that it's failing. Flash isn't perfect, but AS3 losing variable data between frames seems very unlikely. I'm only suggesting that when you get to this much code, it's easy to overlook something that may be resetting your variables. If you trace()d them and they're not "undefined", they do exist, and apparently have been set to 0. That leads me to believe, somewhere, in that vast wilderness of code, "something else" is affecting those variables and it's not flash.
I've had many years of blaming flash under my belt. In AS2 it actually was the case sometimes. In AS3? I've always found the error to be my own..