Daniel,
Yes it is the browser window closing that fires the save code. The below code is triggered from the index.html. So one of the first things to do is look for this line in the index.html that you are putting on the server. As far as which files need to be moved to the server I would think just the index.swf and index.html, but I normally just grab them all.
window.onbeforeunload = clean_up;
I confirmed that my indexl.html does have that line:<html lang="en">
<!--
////////////////////////////////////////////////////////////////////////////////
//
// Copyright © 2008 - 2009 ESRI
//
// All rights reserved under the copyright laws of the United States.
// You may freely redistribute and use this software, with or
// without modification, provided you include the original copyright
// and use restrictions. See use restrictions in the file:
// <install location>/FlexViewer/License.txt
//
////////////////////////////////////////////////////////////////////////////////
// -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="ESRI, ArcGIS, Flex, Flex SDK, Viewer, GeoWeb"/>
<meta name="description" content="Flex Viewer to demonstrate the best practice to develop GeoWeb application by leveraging the power of spatial technologies"/>
<meta name="revised" content="version 1.0, Nov 14, 2008" />
<title>Viewer</title>
<script src="AC_OETags.js" language="javascript"></script>
<style>
body { margin: 0px; overflow:hidden }
</style>
</head>
<body scroll='no'>
<script language="JavaScript" type="text/javascript">
<!--
AC_FL_RunContent(
"src", "index",
"width", "100%",
"height", "100%",
"align", "middle",
"id", "index",
"quality", "high",
"bgcolor", "#6e6e6e",
"name", "index",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
// -->
</script>
<!--New JavaScript function for State-->
<script language="JavaScript" type="text/javascript">
window.onbeforeunload = clean_up;
function clean_up()
{
var flex = document.${application} || window.${application};
flex.savesettings();
}
</SCRIPT>
<!--End New JavaScript function for State-->
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="index" width="100%" height="100%"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="index.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#6e6e6e" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="index.swf" quality="high" bgcolor="#6e6e6e"
width="100%" height="100%" name="index" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</noscript>
</body>
</html>
And, I've double-checked to make sure that all of the changes you listed in your files are in mine.