how to distribute a Flash component for use with MTASC?

425 views Asked by At

I have a Flash component that's just a library of compiled code with some exposed API calls. Normally we distribute this as a SWC or MXP, and it works just fine. Recently I had a client express interest in using my component, but they do all their development in MTASC only. MTASC doesn't support SWC files, so ss there a good way to send precompiled code that would work in MTASC? I'm not able to send them the original source code, but if there's some other method I'd appreciate it. I do have access to the source, so I can recompile it however necessary. Thanks!

1

There are 1 answers

0
nerdabilly On BEST ANSWER

I did find an answer, and I'm not 100% sure if this is exactly the process since I'm no longer at that job and don't have the computer/process in front of me anymore. It was a bit of a hack.

What it involved basically was unzipping the SWC file and getting a .swf and a bunch of .asi files out.

The .asi files are really just ActionScript files, but they contain intrinsic definitions, or just prototypes or footprints of whats actually there. The real meat of it is still in the .swf.

So you rename all those .asi files to .as and then put them into your MTASC classpath. Since they contain definitions, you shouldn't be getting any more "undefined variable" or "undefined function" errors at compile time. Now you just need to pull in the SWF, where the actual function bodies are defined, using loadMovie. once the loadMovie is complete, you should be able to use all of the functions.

The only caveat of course is that you have to wait for that SWF to load before calling of any of the functions from the SWC.

so step-by-step, it looks like this:

1.) unzip the SWC file. this can be done using WinZip or OS X terminal unzip command 2.) Rename .asi files to .as 3.) add new .as files to MTASC classpath 4.) add AS code to load the .swf in and make sure none of the SWC functions are called before the SWF is loaded 5.) compile

I'm pretty sure this is what we did, but i'm not in a spot to try it out right now.,

Hope this helps, let me know if you have any other questions and I'll see if I can help figure it out any more.