Hello,

I have found the below javascript, which does what I want but when I place this code into my flash movie>> getURL("javascript:var xgo = 'false'");

the javascrip stills shows a message the first time. Then after poping up the message that first time the message does not pop up again . What i am trying to do is at a point in my flash movie I want to pass a variable to the javascript letting it know that the message does not need to show if the browser is closed, but I do not what the message to show when passing the variable.



<script language="JavaScript">

var needToConfirm = true;
var xgo = 'true'
window.onbeforeunload = confirmExit;
function confirmExit(){
if (needToConfirm) {
// check to see if any changes to the data entry fields have been made


if (xgo == 'true' ){
return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?";
}

// no changes - return nothing
}
}

</script>