Skip to content

Instantly share code, notes, and snippets.

@xiaobin83
Created January 10, 2017 09:26
Show Gist options
  • Save xiaobin83/183d3c5fd65cf7ad5d89048fc0264042 to your computer and use it in GitHub Desktop.
Save xiaobin83/183d3c5fd65cf7ad5d89048fc0264042 to your computer and use it in GitHub Desktop.
batched exporting fla 2 swf
import os
import sys
import fnmatch
FlashExe= r'"D:\opt\FlashCS6\Adobe Flash CS6\Flash.exe"'
def collectAllFla(fla, dirname, names):
for n in names:
p = os.path.join(dirname, n)
if fnmatch.fnmatch(p, '*.fla'):
fla.append(p)
fla = []
os.path.walk('flash', collectAllFla, fla)
def getExportJsfl(f):
f = os.path.join(os.getcwd(), f)
f = f.replace('\\', '/')
f = 'file:///' + f
script = 'fl.publishDocument("'+f+'")\n'
return script
s = open('tmp.jsfl', 'w+')
for f in fla:
script = getExportJsfl(f)
s.write(script)
s.write('fl.quit(true)\n')
s.flush()
s.close()
os.system(FlashExe + ' tmp.jsfl')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment