action.send.apply(this, arguments)

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of Sebastien ARBOGAST
Sent: Tuesday, April 21, 2009 5: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:Function
 = 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-arbogast.com
http://mooplan.com

Reply via email to