Flash is mainly known as a program dedicated to producing animations and applications for the web that run in a web browser. This situation has evolved over the past few years with a couple of programs known as SWF wrappers, Flash wrappers or SWFtoEXE programs, that open the door of desktop application development to a lot of Flash developers and Flash designers. In this article I will mention five of these programs : Zinc from MDM, SWF studio from Northcode, Screenweaver (a now open source project), Jugglor from Flashjester and SWFKit from TopCMM Technologies.
When you create a projector or stand alone application from an SWF, there isn't much you can do to interact with the outside world, local file systems, external databases, server side applications..etc. You are just left with a few fscommand like fullscreen, quit, allowscale and a few others but not much to get excited about really. This is where our Flash wrappers come in handy.
So how does it work ? Basically and to simplify, when you develop your Flash application you incorporate some extra code in your actionscript that is going to be talking to the wrapper in some specific circumstances. For example after pressing a button you would like to be able to change the screen resolution or send an email directly from the application itself or event insert some data into a distant database. The wrapper application is listening for those specific commands coming from the embedded SWF and execute them synchronously("ready" as soon as it's called) using a callback function or asynchronously if the syntax is using fscommand. The first versions of SWFtoEXE programs started by extending the number of fscommand's available. The problem with the fscommand is that every call to the wrapper was asynchronous therefore a lot of coding tricks were necessary to glue everything together.
Most SWFtoEXE applications have now mostly given up the fscommand asynchronous syntax coupled with callbacks and work in a more synchronous way.
A tiny desktop application
To give you a more precise idea of what these SWFtoEXE applications are and can do let's have a look at a simple example application. I created a Flash file and incorporated some commands in the actionscript that will talk to the wrapper and allow the user to select any file from their system. The path to the file is then sent back to the embedded SWF and displayed in the text field above the button. (fig1)
fig1 |
|
In MDM Zinc v2.5 you would write:
| myButton.onRelease = function(){ var myFile = mdm.Dialogs.BrowseFile.show(); filePath.text = myFile; } |
In Screenweaver 3 open source you would write:
swInterface.init(); |
In Jugglor 2.2 you would write :
function EncodeForJugglor(x) { Result = ""; myButton.onRelease = function(){ |
In SWFKit 3.0 you would write :
import SWFKit.*; myButton.onRelease = function(){ |
In SWF studio 3.0 You would write it
myButton.onRelease = function(){ function onOpenFile(myFile){ |
You will notice that if you are writing code for Screenweaver and SWFKit you need to initialize explicitly the communication between the SWF and the wrapper using respectively swInterface.init and import SWFKit this just needs to be done once.
Continue to next page...