So I've been working on a way to automate a conversion process from FLA to SVG so that I don't have to manually do each one. I've had some progress so far, but it's been a bit of a struggle, so I thought I'd detail the issues here in case some other poor sod has a giant pile of FLA files they need to convert to SVG and happens to find this blog entry.
For this process, you will need Adobe Flash Professional and Adobe Illustrator. This is not an endorsement of Adobe, their unstable products, their annoying and unnecessary proprietary formats, or their horrendously bad customer support; rather, I haven't been able to find a way to convert these files to SVG without using their software. The reason I'm doing this at all is so that people can get at the files in a vector format without depending on Adobe's products.
For the record, I'm using Adobe CS5.5, which I purchased back when it was possible to buy their software in a way that doesn't involve paying them every month for the privilege of continuing to use it.
So, here we go.
First, I opened Flash Professional and used jsfl scripting to make a script that loads all of the FLA files in a directory and converts them to an intermediate format called FXG. FXG is a file format created (and subsequently abandoned) by Adobe that is like SVG, but not SVG, so almost nothing can read it, except a couple of Adobe products, and even those sometimes barf on it (more on this later). I would paste my jsfl script code somewhere that people could get it, but I'm unsure of adobe's wonky licensing, so I'm not sure if I'm actually allowed to or not. Suffice it to say, I crawl through a selected directory, load each FLA file, save it to FXG with an undocumented function (way to go, adobe!), then close the file. It's really fairly simple code.
Next, having converted an entire directory of FLA files to FXG, I fire up Adobe Illustrator and run another script. This script loads all of the FXG files from a selected directory one by one and then either saves each file as SVG or crashes Illustrator. Once it crashed so hard that Firefox crashed too (no idea how that happened). After each crash, I move all of the successfully processed files to a different directory (plus the file that crashed it) and run the script again. This is in no way annoying or tedious, and I am in no way being sarcastic.
Then, I 7zip up the successfully converted files and upload them to OGA.
Thus far, I'm not sure how I'm going to handle exporting animation frames. I'll have to cross that bridge when I come to it.
An interesting side note: In my quest to find better ways to conver FXG to SVG, I discovered the most worthless web page ever made.
At any rate, if anyone else knows of a better way to convert an FXG file to SVG, I'd love to know. There's a little python script on github that tries to do it, but it's just not there yet and the converted files are useless.
A and a final note, to the Inkscape folks, if you're reading this: A couple of years ago, someone requested an FXG import/export function. It was determined that no one would ever want to use an FXG import function, so only export was implemented. I'd just like to point that at this point, there is no way to convert FXG->SVG without using expensive and crash-prone Adobe products. I realize time and developer resources are limited, so I'm not demanding that this be done; I'm just pointing out that it would be really helpful in some situations. :)
Bart
P.S. This should in no way be construed to be bashing the fine folks from Glitch who released all of these excellent assets into the public domain. You guys are awesome. :)
FAQ
Q: But Bart, why don't you just call Adobe tech support?
A: I did that once. It took me four hours to get to a real person, and then they told me that I'd called the wrong line. I waited another several hours and finally gave up and posted an angry message on their forum, then received a reply for people who can't get through to their tech support line and post angry messages on their forum, saying that apparently I'd been forwarded to level 2 tech support. They eventually got back to me several days later during non business hours. I would rather stab my spleen with a rusty spork than deal with Adobe tech support again.
Q: Did you know there's a plugin for Adobe Flash that converts FLA directly to SVG?
A: I tried it. The results weren't usable.
Comments
I've noticed that most of the time when Adobe crashes its because its run out of memory and can't figure out how to deal with it. It's kind of like Windows that way, needing a restart for no good reason if you've been doing a lot with it. Those files it crashed on would probably convert if you tried again. I do not blame you if you don't want to try though, dealing with Adobe's garbage isn't how I'd want to spend my free time either.
My experiences have generally been similar to yours along those lines. I actually tried several times to get the offending files to load, even restarting the application and doing it manually. It didn't make a difference, so in this case, I suspect that there's an actual bug somewhere that's causing the issue.
I cant speak for FXG formate but I had a little luck with PDf work around and irfan view (got to love irfan there also a few plugins )and was able to import some stuff into inkscape plus I export some stuff from blender into inkscape but that was a uv view and it was only wire frames (but still cool) ( may want to look at the python script)
Got to love the poor interconnectivity between two products of the same company...
If I get it right, the sole problem is getting fla/fxg into AI which should have been fairly straight forward.
this was suggested by someone. if true it exports to svg from flash.
https://github.com/davebelais/Extensible
website: http://www.dissentgraphics.com/tools/flash2svg/
nice work! I was thinking of doing the same thing but couldn't get my hands on an old enough version of adobe. I could only get the trial version of creative cloud which has removed the option to export to fxg :(
I'm doing something very similar to export them to .png. Does your script close the file after it exports it? I originally had an issue with running out of memory and crashing because I wasn't closing the document after exporting.
Well at least that last step doesn't sound too hard.
Good luck trying to get this all to work! I hope this is a lesson to everyone out there that proprietary formats don't do anyone any good.
Reminds me of the kind of fun we had deciphering and converting the images for Abuse. That's one advantage of an art community full of programmers, we'll find a way.
@vk: That's the thing I mentioned at the end. The output isn't usable.
I know in the past that some user have been able to get SVGs from SWFs using PySWF, if that helps.
http://pypi.python.org/pypi/pyswf
I'm mostly done now, except for uploading the rest, which I'll do today. There were some items that didn't convert properly, though, so I'll try it on those.
Wow sounds like Adobe's support is as good as EA's ...
Having a product which sells itself by its name, you can easily turn down the support ...
When do they see that proprietary formats do not necessarily sell a product? For instance more and more university professors in my sourroundings won't accept .doc formats anymore but demand .odt or at least .pdf (proprietary but at least 90% compatible)
Wow... that page is useless. whats funnier is that all the linked pages are exactly the same, just the extension changed.
@Nimja
Yeah, I didn't check out the other pages, but I suspected it was generated by a bot. That pretty much confirms it. :)
I found this other converter that might help, it's written only in actionscript: https://github.com/grapefrukt/grapefrukt-export
Looks like it's time to bring this thread back from the dead. I'm also looking to convert a lot of FLAs to SVG for upload to this site. I've also concluded that (like it or not) my copy of Adobe Flash CS5.5 is the only thing able to do it. Unfortunately for me, I will be exporting a lot of animation frames. This is gonna be lots of fun. :(
I don't want to say right now what I'm converting, but I think it will be very useful to the community.
EDIT: I was requesting Bart's scripts before this edit, but I don't need them any more. I'm past the point of a recursive file search and basic export. I'd like to take this opportunity to say just how much I hate JSFL and Adobe Flash in general. Also, I'll be sharing this script when it's finished; in the hope that no one else will have to create such an ugly hack for what should be a simple file format conversion.