Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 12-19-2005, 12:32 PM   #1
Registered User
Join Date: Feb 2005
Posts: 221
Default a lot of code and included files

I have a movieclip named ready, that onRelease I want some files to be included.
If the included files have a lot of code it doesn´t work, the button becomes inactive.
if the first included file has a lot of code and the counter=2 it doesn´t work. I assumed that the included files could have a lot of code because only one option is possible at time. I mean if counter=2, the option counter=1 is of no interest and it shouldn´t matter how much code counter1.as has.
ready.onRelease = function(){
if (counter==1 ){
#include "counter1.as"
}else if (counter==2 ){
#include "counter2.as"
First I tried to have all code in one frame without any included files but when that didn´t work I tried with the included files, now when that doesn´t work either, what to do if you have much code???
I have worked with this for a week now.
fiona is offline   Reply With Quote
Old 12-19-2005, 12:38 PM   #2
forever learning
lelales's Avatar
Join Date: Aug 2004
Location: New Olreans
Posts: 1,261
Send a message via AIM to lelales Send a message via Yahoo to lelales
Default how many lines of code do you have?

I haven't heard of this problem before. How many lines of code do you have? Maybe the code you are including or placing in the timeline isn't all correct and is causing the problems.

Last edited by lelales; 12-19-2005 at 12:53 PM.
lelales is offline   Reply With Quote
Old 12-19-2005, 12:59 PM   #3
Registered User
Join Date: Feb 2005
Posts: 221
Default included files have included files

if (counterr==0){
#include "holder1_0.as"
}else if (counterr==1){
#include "h1_1.as"
}else if (counterr==2){
#include "h1_2.as"
}else if (counterr==3){
#include "h1_3.as"
}else if (counterr==4){
#include "h1_4.as"
}else if (counterr==5){
#include "h1_5.as"
}else if (counterr==6){
#include "h1_6.as"
}else if (counterr==7){
#include "h1_7.as"
}else if (counterr==8){
#include "h1_8.as"
}else if (counterr==9){
#include "h1_9.as"
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"
}else if (counterr==4){
#include "h2_4.as"
}else if (counterr==5){
#include "h2_5.as"
}else if (counterr==6){
#include "h2_6.as"
}else if (counterr==7){
#include "h2_7.as"
}else if (counterr==8){
#include "h2_8.as"
}else if (counterr==9){
#include "h2_9.as"
for example h1_9 , one of the included included files, has over 400 lines
The file is to long to place here but i place the beginning of the file.

kvadrat.createEmptyMovieClip ("h1_9_1",1);
kvadrat.h1_9_1. lineStyle (1,0,100);
kvadrat.h1_9_1. beginFill (0xABCDEF, 105);

kvadrat.h1_9_1.moveTo (1,1)
kvadrat.h1_9_1.lineTo (kvadrat.col1._x-2,1);
kvadrat.h1_9_1.lineTo (kvadrat.col1._x-2,kvadrat.row1._y-2);
kvadrat.h1_9_1.lineTo (1, kvadrat.row1._y-2);
kvadrat.h1_9_1.endFill() ;
kvadrat.h1_9_1.onRelease = function(){
if (kvadrat.h1_9_1._alpha==0){
}else if (kvadrat.h1_9_1._alpha==100){


kvadrat.createEmptyMovieClip ("h1_9_2",2);
kvadrat.h1_9_2. lineStyle (1,0,100);
kvadrat.h1_9_2. beginFill (0xABCDEF, 105);

//----------------and so on ------------------------
fiona is offline   Reply With Quote
Old 01-09-2006, 11:46 AM   #4
FormerSwinger's Avatar
Join Date: May 2005
Location: Finland
Posts: 382

I've never used the include but I'm working on project with tens of thousands of line of code. So i seriously doubt that the amount of code is the issue here. Check your code for typos and infite loops (could be caused by methods calling each others as well as actual loops).
Just that it hasn't been done before doesn't mean it's impossible.
FormerSwinger is offline   Reply With Quote
Old 01-09-2006, 01:03 PM   #5
Joeri Sebrechts
Join Date: Apr 2005
Location: Antwerp, Belgium
Posts: 1,465

I've only had one problem with too much code. If classes get bigger than 32KB byte code, they no longer work correctly (mx 2004). You get a very specific error in that case though, so I seriously doubt you've run into that.
jsebrech is offline   Reply With Quote
Old 01-09-2006, 04:18 PM   #6
Join Date: Feb 2005
Location: Toronto, ON
Posts: 1,420

This is right in Flash Help:
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):

Last edited by flashead; 01-09-2006 at 04:43 PM.
flashead is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
My sprite platformer (code included) Flash_Masta ActionScript 2.0 38 07-07-2005 01:43 AM
Can't get remoting working (CFMX), code and URL included. jrmcintosh Flash Remoting 1 06-08-2005 10:01 PM
Preloading XML and CSS files nytyme ActionScript 2.0 2 11-02-2004 06:39 PM
ASP form mailer for anybody who needs it... I included instructions as well... SCHIMKE ActionScript 1.0 (and below) 2 05-25-2003 03:55 AM

All times are GMT. The time now is 04:34 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.