# Pass variable to Function

**URL:** <https://forum.kirupa.com/t/pass-variable-to-function/98999>\
**Category:** Uncategorized\
**Created:** [January 13, 2004, 5:39pm UTC](https://forum.kirupa.com/t/pass-variable-to-function/98999 "2004-01-13T17:39:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabe](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@gabe](https://forum.kirupa.com/u/gabe)\
**Post date:** [January 13, 2004, 5:39pm UTC](https://forum.kirupa.com/t/pass-variable-to-function/98999/1 "2004-01-13T17:39:17Z")

</div>

can anyone tell why this wouldn’t work?  
These functions do not properly pass the parameters I need them too.  
Starts at btn.onRelease :::

[AS]  
function buttonPress(btnName, sectionName) {  
if (\_root.section != sectionName) {  
\_root.section = sectionName;  
\_root.transitionContent.gotoAndPlay(“closing”);  
moveFollower(btnName);  
}  
};

function moveFollower(clip) {  
\_root.follower.\_y = clip.\_y;  
};

btnHome.onRelease = buttonPress(“btnHome”, “content\_Home.swf”);  
btnAboutUs.onRelease = buttonPress(“btnAboutUs”, “content\_AboutUs.swf”);  
[/AS]

Note:  
btnHome = instance name of a button  
btnAboutUs = instance name of a button  
follower = instance name of static mc

Thanks :+)
