Created
January 10, 2017 09:26
-
-
Save xiaobin83/183d3c5fd65cf7ad5d89048fc0264042 to your computer and use it in GitHub Desktop.
batched exporting fla 2 swf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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