PDA

View Full Version : Execute seperate JSFL from AS


Boersnoes
04-10-2006, 09:28 AM
Is there a way to execute a seperate JSFL file from actionscript?
I want to execute a script file from within an actionscript class that will be used from within an swf as a panel (so in the IDE).

So in this style:
public function getProjectList():Array{
return(MMExecute("./jsfl/getDirlist.jsfl"));
}

but something more .. working off course.

androo_animator
04-10-2006, 03:34 PM
You'll need to use fl.runScript() (http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00004650.html)

hangalot
04-10-2006, 06:10 PM
http://www.lennel.org/blog/2006/02/26/handy-jsfl-functions/

Boersnoes
05-04-2006, 09:31 AM
Thx, I allready wrote one myself though ;)
public function execJSFL(jsflLoc:String, jsflFile:String, methodName:String, args:Array):String{
var execString:String = 'fl.runScript(';
switch(jsflLoc.toLowerCase()){
case "windowswf":
execString += 'fl.configURI+"WindowSWF/';
break;
case "commands":
execString += 'fl.configURI+"Commands/';
break;
default:
execString += jsflLoc;
break;
}
execString += jsflFile+'"';
if (methodName != undefined){
execString += ', "'+methodName+'"';
for (var i=0; i<=args.length-1; i++){
execString += ", ";
if (typeof (args[i]) =="string"){
execString += '"'+args[i]+'"';
}else{
execString += args[i];
}
}
}
execString += ');';
//trace("execJSFL: "+execString);
//return (null);
return(MMExecute(execString));
}

hangalot
05-10-2006, 08:51 AM
dis cool. maar een hele section van jou code, waar jy die argumente join kan uitgesny word met 'n splice en join.