# Passing variables through a function of a function

**URL:** <https://forum.kirupa.com/t/passing-variables-through-a-function-of-a-function/63327>\
**Category:** flash\
**Created:** [September 5, 2004, 2:36pm UTC](https://forum.kirupa.com/t/passing-variables-through-a-function-of-a-function/63327 "2004-09-05T14:36:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marc0047](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@marc0047](https://forum.kirupa.com/u/marc0047)\
**Post date:** [September 5, 2004, 2:36pm UTC](https://forum.kirupa.com/t/passing-variables-through-a-function-of-a-function/63327/1 "2004-09-05T14:36:17Z")

</div>

I have been able to find documentation on calling a function through a function like thus:

step1(step2);

step1(func) {  
func();  
}

step2() {  
trace(“done”);  
}

However, I have had very little luck on finding information on enclosing parameters in functions that I want to call inside another function. Using the above example, what I would like to do instead is use step1() to call the step2() plus enclose paramaters.

Something like this: step1( step2(“done”) );

But obviously this doesn’t work. I am unsure if this is possible, and if there is a better method to complete this?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 5, 2004, 3:04pm UTC](https://forum.kirupa.com/t/passing-variables-through-a-function-of-a-function/63327/2 "2004-09-05T15:04:09Z")

</div>

How about something like this?

```auto
function step1(fcn, arg) {
	fcn(arg);
}
function step2(arg) {
	trace(arg);
}
step1(step2, "hello!");

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 5, 2004, 3:31pm UTC](https://forum.kirupa.com/t/passing-variables-through-a-function-of-a-function/63327/3 "2004-09-05T15:31:55Z")

</div>

Excellent. Thank you!

> [@kode](#):
>
> How about something like this?
> 
> ```auto
> function step1(fcn, arg) {
> fcn(arg);
> }
> function step2(arg) {
> trace(arg);
> }
> step1(step2, "hello!");
> 
> ```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 5, 2004, 3:35pm UTC](https://forum.kirupa.com/t/passing-variables-through-a-function-of-a-function/63327/4 "2004-09-05T15:35:36Z")

</div>

You’re welcome, marc. 😉
