Method availability could be done like this.
package
{
public class PluginCapable
{
public static function methodAvailable(object:*, methodName:String):Boolean
{
try { object[methodName]; return true; }
catch (error:Error) { }
return false;
}
}
}Say you wanted to check if the user could save locally...
var file:FileReference = new FileReference(); if (PluginCapable.methodAvailable(file, "save")) file["save"](data, "file.txt");or simply hide the save button or something.
No comments:
Post a Comment