From flashticle import swf

During the reading of one of the articles at osflash I’ve got inspiration (and portion of the code) from flashticle project to start with a little project by myself (called pyswf).
That’s not *really* a project, also because there are so many decrypers, disassemblers, optimizators etc around here, but more an exercize for better understand both python and the SWF file format…
BTW, currently it can read quite almost all swf tags and actions, writing them in a pseudo-code (later i will try to create the original actionscript code), and also extract some of the swf embedded multimedia objects (such as flv, mp3, wav, and images)
for example:
main -e "test.swf"
it will print all the swf code in the output buffer and also extract all the multimedia files embedded into test.swf
you can download the source code (with also a win32 binary) from here

SE|PY ActionScript editor

I’ve just uploaded a new version ( of SEPY ActionScript Editor.
In this version:

  • Minor graphical changes
  • fixed: [ 994202 ] Cancel New project Error
  • fixed: [ 994203 ] Missing tooltip (minor bug)
  • Removed “;” after closing bracket “}” in the autoformat code.
  • Added option for use the auto-indent feature
  • Switched to wxPython
  • Changes in the Flash Help window.

Download the Windows installer
Download the source code

As always, thanks to all the people who help me with bugs reporting. It’s essential for the project development.
P.S. I’ve noticed that python group just released the first alpha of python 2.4. Once released the final release I will switch to the new version.

Flash remoting for python

Yesterday I received an email form Vsevolod ILyushchenko announcing me the alpha version of Flash remoting for python! There are also many examples here:

Second update: Serializer Class 2.1
There is a bug fixing with in special chars lenght, thanks to Rainer Becker. The new mxp file is available on the sourceforge site.

Last thing. I’ve just uploaded an example which Daniel Tavelli send me.
An example of Xpath usage in flash mx 2004 using the xfactorstudio xpath class for ActionScript

wxPython and Flash, first test

Today I make the first test integrating a Flash movie into a python application and using a communication between the two applications using FSCommand and the flashvars.
The result (surprendent easy) it’s a simple movie which enables text files saving in the local computer (through a prompt dialog window), but it has already opened my mind to future real cool applications 😉

This is the python code, the core part it’s the “wx.lib.flashwin” import, which enable to use Flash ActiveX in a python frame

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import wx, sys, os
import string, codecs
from wx.lib.flashwin import FlashWindow
from wx.lib.flashwin import EVT_FSCommand

class TestPanel(wx.Panel):
    def __init__(self, parent, base, swf):
        wx.Panel.__init__(self, parent, -1)
        self.base = base
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.flash = FlashWindow(self, style=wx.SUNKEN_BORDER)   
        dlg = wx.MessageDialog(self, "This will work only under Windows!","Warning!",wx.OK | wx.ICON_INFORMATION)
            self.flash.LoadMovie(0, swf)
            wx.MessageDialog(self, "could not load the swf file","Error",wx.OK | wx.ICON_ERROR).ShowModal()
        # sizer
        sizer.Add(self.flash, 1, wx.EXPAND)
        self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
        self.Bind(EVT_FSCommand, self.CallMethod)
    def SetFlashOptions(self): = False
        self.flash._set_FlashVars("data=Server started on " + sys.platform)
    def OnDestroy(self, evt):
        if self.flash:
            self.flash = None

    # Called from Flash FSCommand
    def CallMethod(self, evt):
            arguments = string.split(evt.args,"###")
            filename = arguments[0]
            body = arguments[1]
            if filename == "" or body == "":
                wx.MessageDialog(self, "Please check data inserted", "An Error occurred", wx.OK | wx.ICON_INFORMATION).ShowModal()
                dlg = wx.FileDialog(self, "Save as..." , os.getcwd(), filename, "*.*", wx.SAVE | wx.OVERWRITE_PROMPT )
                if dlg.ShowModal() == wx.ID_OK:
                        f =, "w", "utf-8", "ignore")
                        self.flash._set_FlashVars("data=Succesfully saved text file")
                        wx.MessageDialog(self, "%s %s %s" % sys.exc_info(), "An Error occurred", wx.OK | wx.ICON_ERROR).ShowModal()
                        self.flash._set_FlashVars("data=%s %s %s" % sys.exc_info())
            wx.MessageDialog(self, "Please check data inserted","An Error occurred",wx.OK | wx.ICON_INFORMATION).ShowModal()
            self.flash._set_FlashVars("data=%s %s %s" % sys.exc_info())
if __name__ == '__main__':
    class TestFrame(wx.Frame):
        def __init__(self):
            wx.Frame.__init__(self, None, -1, "ActiveX -- Flash", size=(640, 480), style=wx.DEFAULT_FRAME_STYLE )
            base = os.path.normpath(os.path.abspath(os.path.dirname(sys.argv[0])))
            swf = os.path.normpath(os.path.join(base, "movie.swf"))
   = TestPanel(self, base, swf)
    app = wx.PySimpleApp()
    frame = TestFrame()

the flash part is really easy. Two text field, one button and one line of code!:

on (click) {	fscommand("saveFile", this._parent.fnome.text + "###" + this._parent.ftesto.text)}

P.S. Moreover today I read in wxPython mailing list a coming new version of wxPython. I hope this will begin to fix varoius problems with Mac installation of SE|PY