FSCommand Proxy for Flash Studio
Friday 18 June 2004 – Filed under: Flash – No Comments
I don’t like fscommands. I guess everyone creating Windows applications using Flash and third party wrapper software will understand what I mean. But as I’m working on a standalone app, I created a generic fscommand proxy class that gives me callback / listener functionality in software such as Flash Studio Pro and SWF Studio.
When it comes to creating Windows applications using Flash, I’ve always relied on Screenweaver. Not only because I was one of the people who created it (although I left Rubberduck over a year ago), but also because it is the only Flash wrapper application that offers an event-driven model, instead of the cumbersome fscommand frameloops / setIntervals other software uses.
Unfortunately, Screenweaver doesn’t support Flash MX 2004 yet. So, I’ve been playing around with my license for Flash Studio Pro which was kindly provided to me by the people of MDM software. Thanks!
I quickly found out how frustrating fscommands can be, especially if you need to pass a lot of parameters to it. Example:
fscommand("flashstudio.checkconnection_ping", "\"www.martijndevisser.com\",\"2000\",connected");
This would ping my site and return a Boolean indicating success or not. Definitely not coder friendly. The escaping sequences needed to construct the arguments to pass to the fscommand are very prone to bugs and typos. So I wrote myself a class to help me out and dubbed it FSCProxy.
Using FSCProxy, the code above would translate to:
var myProxy:FSCProxy = new FSCProxy(this);
myProxy.execute("flashstudio.checkconnection_ping", ["www.martijndevisser.com","2000"]);
I like it better this way. A clean array with the arguments to pass. Once you instantiate FSCProxy, you can use it for all fscommands you need to execute. Just add more .execute() calls. You can also easily add listeners to receive the result of the fscommand. A complete example:
var myProxy:FSCProxy = new FSCProxy(this);
var myListenerObject:Object = new Object();
myListenerObject.handleEvent = function( inEvent:Object ) {
// your code here
}
myProxy.addEventListener("fscommandReady",myListenerObject);
myProxy.execute("flashstudio.checkconnection_ping", ["www.martijndevisser.com","2000"]);
The class itself is pretty straightforward and can surely be improved and extended. I wrote some documentation for it and the source (including example and docs) can be found here. Mind you, I haven’t had much time to test this yet. Please let me know if you encounter any errors.
For now, have fun using callbacks instead of fscommands!
« previously: ASDoc, continued… next: VisDoc: another ActionScript doc tool »
Leave a Reply
Recent Articles
- New bike
- FLV Player 2.0.25 released
- No custom headers for Flash file upload. Why?
- Building AIR with FDT
- Adobe MAX 2007
- FLV Player 2.0 released
- The new Photoshop logo
- mProjector WindowResizer class
Advertisement
Categories
- Art & Design (4)
- Flash (37)
- FLV Player (9)
- Software (16)
- User Experience Design (3)
- Various (8)
- Work (6)