# Function apply

**URL:** https://forum.kirupa.com/t/function-apply/238726
**Category:** Uncategorized
**Created:** [September 14, 2007, 9:27am UTC](https://forum.kirupa.com/t/function-apply/238726 "2007-09-14T09:27:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![swinberg](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@swinberg](https://forum.kirupa.com/u/swinberg)
#### Post date: [September 14, 2007, 9:27am UTC](https://forum.kirupa.com/t/function-apply/238726/1 "2007-09-14T09:27:18Z")

</div>

I ran into a problem with apply. I’ve always used delegate and delegate plus, and havent had to deal with apply directly.

The problem is when i try to add parameters to the function.

```auto
// adding one function to the que, with random parameters as an array
_aQueue.push({func:initMask, args:[_mcSummary]}, {func:tweenAll, args:["2", "3", "432"]}); 

trace(typeof(_aQueue[0].args)) // outputs ARRAY
trace(_aQueue[0].args) // outputs content of array 

// apply the function 
_aQueue[0].func.apply(this, _aQueue[4].args);

function initMask(whatever:Array):Void {

  trace(whatever) // outputs the FIRST element that was in the array
  trace(typeof(whatever)) outputs STRING if the first element is a string, outputs mc if the first element is an mc

}

```

Why do the parameter get \*\*\*\*ed up? I’ve checked the docs, and as far as i understod its supposed to be an ARRAY of parameters.

Any help appreciated!
