So, I've figured out some issues with my question with the help of Sunil D. The onunload event fires too quickly for my event to be triggered, so I've decided not to include a warning message, but just log the user off all together using the onbeforeunload event:
<script type="text/javascript">
window.onbeforeunload=before;
window.onunload=after;
function before(evt)
{
var flex=document.${application}||window.${application};
flex.unloadMethod(); //calls the flex class containing the "unloadMethod()" which
//calls the logout.jsp that does the actually dropping of credentials
}
function after(evt)
{
}
</script>