Search code examples
apache-flexactionscript-3adoberemoteobject

How to transform a string in function and concatenate with an object?


I have the following code in actionscript 3:

var async:AsyncToken;

async = bridge.retornamenu();

The bridge is a remote object, instantiated. The retornamenu() is the function that I want the remote object open in amfphp.

However the retornamenu() is a dynamic function, which turns another function, but I can not run it at runtime,

example

var stringfunction:String = "retornamenu()" // this name is dynamic.

var async:AsyncToken;

async = bridge.stringfunction;

But this way does not work, not perform the function retornamenu();

someone could help me? I am a few days behind the solution, my project stopped,

Thanks in advance


Solution

  • Use getOperation() and send() it.

    var stringfunction:String = "retornamenu" // this name is dynamic.    
    var async:AsyncToken;
    async = bridge.getOperation(stringfunction).send();
    

    If there are arguments to the function, you can pass it through send(args)