AARON SMITH’S CODE ENDEAVOR

JSFL Proxy Class - Alleviate MMExecute Pain

Those of you who have written JSFL know the pain of MMExecute - with having to wrap quotes, inside of double quotes, which could have more quotes or slashes. I’ve been writing a number of WindowSWF tools - which use a lot of JSFL. This JSFL Proxy class will help alleviate all the work.

The JSFLProxy class alleviates calling JSFL scripts, or methods inside of a JSFL script. It also adds support for escaping parameters, unescaping the responses, and allowing you to specify a return type from JSFL - which, amazingly (or not so) enough, allows me to cast the JSFL response before it’s returned to you.

Here’s a demonstration:

var jp:JSFLProxy=JSFLProxy.gi();
var functionLib:String="file://XXX/myFunctionLibrary.jsfl";
var dir:String = jp.runScript(functionLib,{method:"getSomeDirectory",params:[theDirectory],responseWasEscaped:true});
var dirContents:Array = jp.runScript(functionLib,{method:"getDirContents",escapeParams:true,responseFormat:"array",parameters:[dir],responseWasEscaped:true});

There are a few other methods available, and support for a few other response formats. JSFLProxy is available in Guttershark. Here’s a direct link to the JSFLProxy documentation.

  

No comments yet. Be the first.

Leave a reply