This is right in Flash Help:
Quote:
Description
Compiler directive: includes the contents of the specified file, as if the commands in the file are part of the calling script. The #include directive is invoked at compile time.
|
Using #include is a 'compiler directive' meaning only the compiler pays attention to #include, so calling #inlcude at runtime probably isn't doing anything. Or if it is doing anything at all I'd hazard to guess that despite having those includes inside a function, they might be getting included anyway right away.
EDIT: I stand corrected. I just wanted to test this whole scenario out for myself to see what it would do. I never thought it would even work.
Nevertheless I'd keep all the code in one file, it'll be easier to deal with. As others have said, it's not because of too much code. It's likely just a code error.
I can't imagine what you could possibly be doing that warrents the need for THAT many .as files.
I know it's a little late, now that you've already written ALL that code, but here's a suggestion for future reference in regards to dynamic filenaming:
Rather than have dozens of if() statements to load a particular file based on a partucular variable's value, you can 'build' that filename using the variable and write only a few lines.
So instead of:
ActionScript Code:
if (counterr==0){
#include "h2_0.as"
}else if (counterr==1){
#include "h2_1.as"
}else if (counterr==2){
#include "h2_2.as"
}else if (counterr==3){
#include "h2_3.as"
}
You end up with:
ActionScript Code:
#include "hs_" + counterr + ".as"
(Note this doesn't work with #inlcudes, I just used it as an example to illustrate dynamic paths):