Command
Defines and registers javascript command.
Allow runtime js method creation and call using the ExternalInterface
feature.
If ExternalInterface.available is false commands are not
executed.
2 ways to use :
All commands are registred in the JSLocator to easily retreives them using their JSMethodName
As we want to control and keep the method name, we don't have to define the
function name in javascript code.
Example of JSCommand instanciation.
var name : JSMethodName = new JSMethodName( "setTitle" ); var command : JSCommand = new JSCommand( name, "( newtitle ){\tdocument.title = newtitle; }" ); //result or param to pass command.call( "newTitle" );
function "name_function" is automatically added during
registration process.
Another way is to use the JSLocator
var name : JSMethodName = new JSMethodName( "setTitle" ); var b : Boolean = JSLocator.register( name, "( newtitle ){\tdocument.title = newtitle; }" ); if( b ) JSLocator.getCommand( name ).call( "newtitle" );