Flython?

Graham Fawcett graham__fawcett at hotmail.com
Tue Aug 17 12:34:51 EDT 2004


Peter Hansen <peter at engcorp.com> wrote in message news:<BeudnTybEKkXXIbcRVn-hQ at powergate.ca>...
> Just been looking at Flash and ActionScript...
> 
> In the vein of Jython, I wonder what it would take to build
> a Flython?  (Lousy name, I know.)  That would take Python
> source, presumably a subset since some things couldn't be supported,
> and compile it into ActionScript bytecode (aka the bytecode compiled
> from ECMAScript source for the Macromedia Flash player environment).

I've written some code (twice, I think) to generate SWF from Python.
Didn't include ActionScript, but it's all there in the SWF spec, so it
shouldn't be *too* hard to implement. My code was less than fast, and
was highly specialized to do a few things that I was interested in
(and ignored the rest). If there's interest, I'll dig it out, though
it's far from project-grade code and is possibly broken. The toughest
part was just grokking the SWF spec, and building some Pythonic
primitives that can output SWF tags. Simply put, writing SWF from
Python isn't rocket science. But of course, you want more than just
that...

> With that, it would be pretty easy to write applications which
> have a Flash front end, but with pretty much all the logic
> on front and back implemented in Python.

A neat idea, definitely begging for a proof-of-concept. I look forward
to testing it. ;-)

There will be times when you want to make a GUI "flashier" than your
framework will allow (unless you're planning to reimplement all of
Flash). Perhaps you might want to use the framework to prototype
something, and then knock the real thing out using Flash (perhaps
importing the ActionScript from your framework). I'd encourage you to
leave room in the design for the inclusion of non-native SWF
components (i.e. ones built using something other than your framework)
that could interact with your back-end (and, through it, with other
client components).

Dave Kuhlmann has done some interesting writing on generating Web
applications from declarations (google for him, Quixote, and REST, and
it should turn up). This might be useful, since your framework spans
the client/server boundary (and perhaps you'd like to obscure that
boundary just a little bit) and would be well suited to a declarative
style (except for the scripting). Quixote suits REST quite well, it
seems, and might be worth consideration as part of your back-end
design.

The last random snippet that comes to mind is that, on Win32, it's not
hard to build a SWF viewer using wxPython (and the SWF plugin, of
course). That might help with deployment where a browser really isn't
suitable.

I know I've said "your framework" half a dozen times, and there's no
such animal, but I do hope that you or someone else picks up the trail
on this and gives it a college try. It would be fun to use, I think.

-- Graham <fawcett at uwindsor.ca>



More information about the Python-list mailing list