# Filling function arguments with array items, function.call()

**URL:** <https://forum.kirupa.com/t/filling-function-arguments-with-array-items-function-call/253240>\
**Category:** Uncategorized\
**Created:** [February 28, 2008, 1:38pm UTC](https://forum.kirupa.com/t/filling-function-arguments-with-array-items-function-call/253240 "2008-02-28T13:38:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![darth](https://avatars.discourse-cdn.com/v4/letter/d/71c47a/32.png) [@darth](https://forum.kirupa.com/u/darth)\
**Post date:** [February 28, 2008, 1:38pm UTC](https://forum.kirupa.com/t/filling-function-arguments-with-array-items-function-call/253240/1 "2008-02-28T13:38:32Z")

</div>

HI!

I have this code but I cannot work out how to fill in function parameters based on an array and it’s length, see line 7  
[AS]  
import com.robertpenner.easing.Cubic;  
MovieClip.prototype.framesTimeout = function(func:Function, frames:Number, args:Array) {  
var t:Number = 0;  
var mc:MovieClip = this.createEmptyMovieClip(String(new Date().getTime()), this.getNextHighestDepth());  
mc.onEnterFrame = function() {  
if (t == frames) {  
func.call(this.\_parent,args);  
delete this.onEnterFrame;  
this.removeMovieClip();  
} else {  
t++;  
}  
};  
};  
MovieClip.prototype.movex = function(x:Number, frames:Number) {  
trace(x+" “+frames)  
delete this.movex.onEnterFrame;  
this.movex.removeMovieClip();  
if (!frames) {  
frames = 20;  
}  
var t:Number = 0;  
var sx:Number = this.\_x;  
var ax:Number = x-this.\_x;  
var mc:MovieClip = this.createEmptyMovieClip(“movex”, this.getNextHighestDepth());  
mc.onEnterFrame = function() {  
if (t == frames) {  
delete this.onEnterFrame;  
this.removeMovieClip();  
} else {  
t++;  
this.\_parent.\_x = Cubic.easeOut(t, sx, ax, frames);  
}  
};  
};  
MovieClip.prototype.otherfunction = function(param1, param2, param3, param4){  
trace(param1+” “+param2+” “+param3+” "+param4)  
}  
mc.framesTimeout(movex, 50, [100, 50])  
mc.framesTimeout(otherfunction, 200, [“asd”, 1, 2, 55])  
[/AS]  
Is it possible to call a function and fill in the parameters based on an array and it’s lenth?
