views:

99

answers:

1

I am currently in the process of porting game code from PC to flash, and it was done in C. There are many extern variables and functions, and they are all spanned across multiple files.

Is there an easy way to keep the filenames as it is (just replacing .C with .as), but putting them all into a single class called Externals?

If I put all these code into a single Externals.as, its going to be very large, and hard to maintain from a programmer's point of view. I would like to know if it can be split into the below

Externals1.as

Externals2.as

and still be able to be called from other locations as Externals::Function(...)

Assuming the class is called Externals.

+2  A: 

You could do a single class and then have it have include statements in it (those still work, even inline).

Another option you may want to look at it is Adobe Alchemy. It's a tool chain that let's you compile C/C++ into SWCs. I worked with it prior to release and it's pretty damn powerful. You do have some overhead (approx 250k built-in, since it needs to emulate a bunch of different POSIX libraries and doesn't yet cull out what it doesn't need), but it runs very fast and if you're familiar with the standard Unix C/C++ toolchain, pretty easy to work with as well.

Branden Hall