1 Reply Latest reply on Oct 4, 2010 11:26 PM by luke3design!!

    Remote Object , call remote method at runtime with .apply() method

    luke3design!!

      Hi!

      I recently discovered the .apply() method that every function offers , which allow to call a function passing the parameters through an array, so you can descide at runtime whose and how many paramters pass. ( functionName.apply(null,paramArray) )

       

      For sure it works with Actionscript declared function, but what if I want to call a method of a remote object?

      I've tried to invoke remoteObject.method.apply(null,myParametersArray) but at runtime Flash returns:

       

      ReferenceError: Error #1069  impossible to find the apply property on mx.rpc.remoting.mxml.Operation

       

      I'm wondering if there's some other way to perform this.

       

      What I'm trying to achieve is:

       

      Define a form inside flex in design mode

      Create a class which , given the id of the form and the id of the remote object , reads all the value inside the form and parse a remote call to a method defined in my remote PHP class (which is already coded for accepting a variable number of parameters)

       

      If this would work, then it could be apply to any forms i design so I would only have to design the form and apply the class to it. ( very nice....)

       

      Have you ever tried to do this?

       

      Any suggestion would be really appreciated.

      Thanks in advance.

       

      Best regards

      Luke