Multiple #includes

[font=Arial]My issue isn’t with including several different .as files, but rather, having to include one .as file more than once. Here’s the situation:

functions.as - has some functions that are used commonly
myClass.as - has class definition whose member functions require some procedures from functions.as
myFlash.fla - Flash application which has instances of myClass and also requires use of functions.as

However, myClass.as doesn’t like to include functions.as…
ActionScript 2.0 class scripts may only define class or interface constructs. (no matter where I place #include)
although myFlash.fla can include it and will work without error.

Is there some convention I’m not aware of where I can use #include in a class definition file? And if so, will it create a problem with multiple declaration of the functions in functions.as? As far as I know, there is no equivalent to C++'s #define and #ifndef preprocessor directives in Actionscript 2.0… a possibility for future development? [/font]

if as 2.0, use extends and import - very similar to java and .net/c# inherit
/*
import functions
class myClass extends functions{
}
*/

Thanks, but no cigar.

The file functions.as isn’t a class, so Flash goes ape on that code with similar errors as when #include’s used:[indent]Syntax error. import functions

ActionScript 2.0 class scripts may only define class or interface constructs. class myClass extends functions

[/indent]Which doesn’t actually bother me that much when it doesn’t work. BECAUSE,logistically, myClass doesn’t extend functions because functions is not an object, it’s simply a collection of procedures. Therefore, myClass can’t inherit any attributes from it.

Any other ideas?

#include cannot be used in AS 2.0 class files. You would either want to have that class inherit from a super class that implements those functions (thereby giving your class access to them), #include functions in .fla outside of the class file (which creates dependancies you will need to document), or create the class in AS 1.0 syntax.

import really offers nothing other than a method of shortening names/paths. It will not include outside scripts into another.

@kbuff-
all i can say is that was pseudo code. im not trying to write/declare your classes for you- i was simply providing a template for you to use your own logic and work off of. you will also find no #include in my example, hence i left it out because it wont work. if its a collection of procedures only and you have no desire to make it a standalone class, create a new as file and make it an intrinsic class.

intrinsic class functions{
//wrap your vars/declarations in an as2.0 interface here-
var whatever:String;

//write an as2.0 interface for each function in your as1.0 class - this give you access and requires a hell of a lot less code.

function myas10functionname(allow:Boolean):Void;
function myas10functionname2(easyStuff:Object):Void;

}

as long as functions (as1.0 file you wanted to include) is used in your movie, the intrinic class will act as a wrapper/interface.

Yeah, I picked up on that. As the filenames/classes I provided were all renamed and simplified to explain my situation more clearly.

Thanks for the suggestions. My problem really however is that I’m trying to do create something that sways from the concept of OOP. As I Computer Scientist, I can’t bring myself to declare the procedures collectively as an object (in one way or the other) because it would theoretically violate my practices of modularity and polymorphism.

In this case, it isn’t much of a problem because I can just redefine the (short) function I need as a private member of the class. I really just began this thread for future reference in cases where the functions may be longer or there may be the possibility to avoid replicating huge chunks of code.

Thanks anyways.