Added export to SWF

This commit is contained in:
Skyler Lehmkuhl 2013-01-18 20:28:58 -05:00
parent 1e4fc31bf9
commit 6cb2d1ea4c
2 changed files with 26 additions and 1 deletions

View File

@ -825,6 +825,29 @@ def convert_to_symbol(widget=None):
svlgui.ConvertToSymbolWindow(root, onMouseDownMC) svlgui.ConvertToSymbolWindow(root, onMouseDownMC)
MainWindow.stage.draw() MainWindow.stage.draw()
def export_svg(widget=None):
pass
def export_swf(widget=None):
global root
root.descendItem().activelayer.frames[root.descendItem().activelayer.currentframe].actions = MainWindow.scriptwindow.text
f = svlgui.file_dialog("save", name="untitled.swf")
if not f:
return
open(f.path+".sc",'w').write(create_sc(root))
# svlgui.execute("swfc/swfc_"+svlgui.PLATFORM+" "+os.getenv('HOME')+"/test.sc -o "+os.getenv('HOME')+"/test.swf")
x = os.system("swfc/swfc_"+svlgui.PLATFORM+" "+f.path+".sc -o "+f.path)
if sys.version_info < (2, 6):
if x==5: # which is the error value returned when linking libjpeg fails
if svlgui.alert("You appear to be missing libjpeg. Install it?", confirm=True):
os.system("""osascript -e 'do shell script "mkdir -p /usr/local/lib; cp swfc/libjpeg.8.dylib /usr/local/lib" with administrator privileges'""")
x = os.system("swfc/swfc_"+svlgui.PLATFORM+" "+f.path+".sc -o "+f.path)
if x==5:
svlgui.alert("Sorry, something has gone terribly wrong.")
else:
return
def about(widget=None): def about(widget=None):
svlgui.alert("Lightningbeam v1.0-alpha1\nLast Updated: "+update_date()+ svlgui.alert("Lightningbeam v1.0-alpha1\nLast Updated: "+update_date()+
"\nCreated by: Skyler Lehmkuhl\nBased on SWIFT") "\nCreated by: Skyler Lehmkuhl\nBased on SWIFT")
@ -858,10 +881,11 @@ svlgui.menufuncs([["File",
("Import to Stage",import_to_stage,"/I"), ("Import to Stage",import_to_stage,"/I"),
("Import to Library",import_to_library)], ("Import to Library",import_to_library)],
["Export", ["Export",
"Export .swf", ("Export .swf",export_swf,""),
"Export HTML5", "Export HTML5",
"Export Native Application", "Export Native Application",
"Export .sc", "Export .sc",
("Export SVG",export_svg,""),
"Export Image", "Export Image",
"Export Video", "Export Video",
"Export .pdf", "Export .pdf",

View File

@ -352,6 +352,7 @@ if SYSTEM=="osx":
m.send_to_back.enabled = 1 m.send_to_back.enabled = 1
m.import_to_stage.enabled = 1 m.import_to_stage.enabled = 1
m.import_to_library.enabled = 1 m.import_to_library.enabled = 1
m.export_swf.enabled = 1
m.convert_to_symbol.enabled = 1 m.convert_to_symbol.enabled = 1
m.preferences_cmd.enabled = 1 m.preferences_cmd.enabled = 1