If you do not get a direct answer, a solution would be an if() conditional.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: [email protected] [mailto:[email protected]] On
Behalf Of Sebastien ARBOGAST
Sent: Tuesday, April 21, 2009 8:04 AM
To: [email protected]
Subject: [flexcoders] Dereferencing an array in ActionScript

 






I would like to call RemoteObject operations in a generic way.

So I have a function that takes an Operation arguments and the arguments to
send in an array:

 

public function
run(action:Operation,arguments:Array,resultHandler:Function,faultHandler:Fun
ction = null):void{

            action.addEventListener(ResultEvent.RESULT, resultHandler);

 

        if(faultHandler != null){

                action.addEventListener(FaultEvent.FAULT, faultHandler);

        }

 

            action.send(arguments);

}

 

Now the problem is that Operation.send() takes only a rest array parameter.
So if I call my run function for arguments=null or arguments=[], send() sees
it as one parameter anyway and my call doesn't go through. Is there a way to
dereference an array in ActionScript like it's possible in Python for
example? Is it possible to call Operation.send() without knowing arguments
at compile-time?

 

Best regards,
Sébastien Arbogast

http://sebastien- <http://sebastien-arbogast.com> arbogast.com
http://mooplan. <http://mooplan.com> com



Reply via email to