We need to generate around 8,000 nearly identical SWF files with slightly different text. I know about flashvars, but unfortunately, we don’t have control over the publishing of these files and can’t have flashvars passed in. Ideally what I’m looking for is that we have a flash designer come up with a nice looking template for us with a placeholder text or element in the file. We can then call a command line utility many times to generate 8,000 copies of this with slightly modified text.
I’ve searched for an entire day now and haven’t found anything to help us out. Granted, I’m not a flash developer, but it seems like this would be pretty straight-forward.
Why won’t MXMLC work?
What is the target SWF format? If it’s 8 and below, you could try MTASC in combination with SWFMill (it takes text source files for code and graphics).
SWF spec is open, there are several parsers that can analyze the SWF file to different degree. If it’s only a matter of replacing the content of a text field, then probably, it would take only as much as rewriting one tag that contains the text field and updating the total file size in the file header.
If you need to do that in real time, this will really depend on amount of code your SWF contains and how much of it needs to be recompiled, but generally Haxe compiler is much faster then MXMLC, and for small files it can be feasible to compile them upon request, rather then pre-compile all of them and serve on demand (depends on what is more expensive, the time it takes to compile, or the space on the server).
EDIT: say, you wanted to use MXMLC, you could have something like this:
NOTE: you wouldn’t probably be able to get mxmlc globally accessible because it has some hardcoded paths, so, you’d use an absolute path to the compiler, but the idea should be the same.
Then, say, you had this text in the ClassWithText.template file:
it would be transformed into:
and then compiled, “counter1”, and then compiled and so on.