# Functions in a certain order

**URL:** https://forum.kirupa.com/t/functions-in-a-certain-order/117262
**Category:** Uncategorized
**Created:** [July 26, 2004, 9:22am UTC](https://forum.kirupa.com/t/functions-in-a-certain-order/117262 "2004-07-26T09:22:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mattiaswargren](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mattiaswargren/32/631_2.png) [@mattiaswargren](https://forum.kirupa.com/u/mattiaswargren)
#### Post date: [July 26, 2004, 9:22am UTC](https://forum.kirupa.com/t/functions-in-a-certain-order/117262/1 "2004-07-26T09:22:48Z")

</div>

Problem:  
I want to be able to run functions in a certain order from an array. The code below is a non-fat version of what I want to accomplish. The problem appears when the function(scream\_name) runs. Flash makes the passed variables into one variabel; sname = “John”, “Doe” and lname = undefined.

Anyone?

```auto

 
function run_func(func,vars){
  func_ready = func(vars);
}
 
function scream_name(sname,lname){
  trace(sname add " " add lname);
  return true;
}
 
functions_ = new Array(
 [scream_name, ["John","Doe"] ]
)
 
run_func(functions_[0][0],functions_[0][1]);
 

```

---

<div class="post-metadata">

### Author: ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)
#### Post date: [July 26, 2004, 11:12pm UTC](https://forum.kirupa.com/t/functions-in-a-certain-order/117262/2 "2004-07-26T23:12:05Z")

</div>

> [@Mattias\_\_\_](#):
>
> Problem:  
> I want to be able to run functions in a certain order from an array. The code below is a non-fat version of what I want to accomplish. The problem appears when the function(scream\_name) runs. Flash makes the passed variables into one variabel; sname = “John”, “Doe” and lname = undefined.
> 
> Anyone?
> 
> ```auto
> 
>  
> function run_func(func,vars){
> func_ready = func(vars);
> }
>  
> function scream_name(sname,lname){
> trace(sname add " " add lname);
> return true;
> }
>  
> functions_ = new Array(
> [scream_name, ["John","Doe"] ]
> )
>  
> run_func(functions_[0][0],functions_[0][1]);
>  
> 
> ```

but waht you have already is useful, just a different trace  
function run\_func(func, vars) {  
func\_ready = func(vars);  
}  
function scream\_name(name) {  
trace(name[0] add " " add name[1]);  
return true;  
}  
functions\_ = new Array([scream\_name, [“John”, “Doe”]]);  
run\_func(functions\_[0][0], functions\_[0][1]);

maybe you could incluse the timeline as well  
function run\_func(func, vars, obj) {  
func\_ready = objfunc;  
}  
function scream\_name(name) {  
trace(name[0] add " " add name[1]);  
return true;  
}  
functions\_ = new Array([“scream\_name”, [“John”, “Doe”], _root]);  
run\_func(functions_[0][0], functions\_[0][1], functions\_[0][2]);

---

<div class="post-metadata">

### Author: ![mattiaswargren](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mattiaswargren/32/631_2.png) [@mattiaswargren](https://forum.kirupa.com/u/mattiaswargren)
#### Post date: [July 27, 2004, 7:33am UTC](https://forum.kirupa.com/t/functions-in-a-certain-order/117262/3 "2004-07-27T07:33:42Z")

</div>

Hmm, that is how I have my code now. I’ll do it like that, even if I really wanted a script wich only passed the correct number of variables needed.

thanks
