# setTimeout and function perameter problems

**URL:** <https://forum.kirupa.com/t/settimeout-and-function-perameter-problems/162875>\
**Category:** web dev\
**Created:** [September 17, 2005, 3:44am UTC](https://forum.kirupa.com/t/settimeout-and-function-perameter-problems/162875 "2005-09-17T03:44:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![graphixboy](https://avatars.discourse-cdn.com/v4/letter/g/a8b319/32.png) [@graphixboy](https://forum.kirupa.com/u/graphixboy)\
**Post date:** [September 17, 2005, 3:44am UTC](https://forum.kirupa.com/t/settimeout-and-function-perameter-problems/162875/1 "2005-09-17T03:44:29Z")

</div>

I have used the setTimeout command within an enclosing function to call a second function. I need to pass one of the enclosing function’s parameters through the setTimeout to the second function as a parameter for that function.

It doesn’t seem to work to pass that parameter through the setTimeout(‘dofunction(parameter)’,time

My code is below. Any help or a better way to do this would be much appreciated.

----------- My code (used to set a variable in a flash movie. Has to use the timeout to give flash time to finish loading before the variable is sent) -------

function SendDataToFlashMovie(sayThis){ // Sends variable to flash movie  
var flashMovie=getFlashMovieObject(“movieHeader”);  
flashMovie.SetVariable("/:message", sayThis);  
}  
function linkRequest(header,content,mylocation){  
var whereToGo = mylocation;  
hidediv(‘mainFlash’);  
showdiv(‘flashTop1’);  
document.getElementById(‘flashTop2’).src = header;  
showdiv(‘contentBottom1’);  
document.getElementById(‘contentBottom2’).src = content;  
alert (whereToGo); // alert works with location passed to function  
window.setTimeout(‘SendDataToFlashMovie(mylocation)’,500);  
// tried both mylocation and whereToGo here neither passes to other function. However, hard coding a parameter to pass works fine  
}
