I’m not clear on what you’re trying to do.

Given a variable of an array arr = [1,2,3]:

If you call the function directly (i.e. fn_fooBisarr)), the full array will be 
the first argument of the function, so you’ll get fn_fooBis([1,2,3]);
If you call the function using. fn_fooBis.apply(thisArg,arr), that’s the same 
as calling: fn_fooBis(1,2,3) (thisArg can be the this context you want or null 
if you don’t care about the “this" context)

Harbs

> On Dec 1, 2024, at 4:56 PM, Maria Jose Esteve <mjest...@iest.com> wrote:
> 
> When I have to pass the "args" to a function without super, it doesn't allow 
> me to use .apply(this,args) in all cases and if I pass them directly the 
> recursive increment occurs again... Aaaaaaaaaaaaaaahhhhhhhhhhhhh
> 
> I've looked at the SDK code and it's not clear to me how I can do it.
> For example:
> protected function fn_foo( ... args){
>       // fn_fooBis.apply(this, args) // not working
>       fn_fooBis(args);
> }
> Private function fn_fooBis(... args):void{
>       trace( args); // two nestings.
> }
> 
> Hiedra
> 
> -----Mensaje original-----
> De: Maria Jose Esteve <mjest...@iest.com> 
> Enviado el: domingo, 1 de diciembre de 2024 15:12
> Para: dev@royale.apache.org
> Asunto: RE: Parameters of type paramArray
> 
> Perfect Josh, thanks.
> 
> When the paramArray is, for example, the second parameter, what would that 
> look like?
> For example:
> override protected function fn_hello(index:int, ... args){
>       // These are the tests I have done but none of them work for me
>       super.fn_hello.apply(index,args); 
>       super.fn_hello.apply(index,[this].concat(args)); // Add "this" and, for 
> example, index 0 is not the first parameter of args but "this" (as expected)} 
> ,,,
> 
> Hiedra
> 
> -----Mensaje original-----
> De: Josh Tynjala <joshtynj...@bowlerhat.dev> Enviado el: viernes, 29 de 
> noviembre de 2024 18:14
> Para: dev@royale.apache.org
> Asunto: Re: Parameters of type paramArray
> 
> I think that this should do what you want:
> 
> super.reevalAccesControl.apply(this, args);
> 
> 
> --
> Josh Tynjala
> Bowler Hat LLC <https://bowlerhat.dev>
> 
> 
> On Thu, Nov 28, 2024 at 7:26 AM Maria Jose Esteve <mjest...@iest.com> wrote:
> 
>> Hi, I've always faced this problem, but I don't know how to give a 
>> definitive solution.
>> Parameters of type paramarray increase their nesting from one call to 
>> another, for example:
>> 
>> Public class ControllerFirst extends ControllerBase {
>>                ...
>>                private function fnmove():void{
>>                               var foo:String = "hello";
>>                                reevalAccessControl(foo);
>>                }
>>                ...
>> override protected function reevalAccessControl(... args):void{
>>                // In the first call, from fnmove "arguments" you have 
>> an element [0] with a value "hello"
>>                super.reevalAccesControl(args);
>>                ...
>> }
>> }
>> 
>> Public class ControllerBase
>> {
>> ...
>> protected function reevalAccessControl(... args):void{
>>                // When this function is called from ControllerFirst 
>> arguments has an element [0] but this element in turn is an array of 1 
>> element and the value "hello" is found in args[0][0] on a second level
>>                ...
>> }
>> ...
>> }
>> 
>> I don't know if I have explained myself... I understand why it happens 
>> but I wonder if there is a way to pass this type of arguments so that 
>> the nesting level 0 is respected and a level is not added for each call.
>> 
>> Thx.
>> Hiedra
>> 
>> 

Reply via email to