Browser Back button solution in Flash.
Browser back-button problem in Flash solved with Actionscript, Javascript and ASP.
Page variable gets set on every page. A setInterval constantly checks for a change in this variable. Every
time you switch pages, a hidden asp page gets loaded into a hidden browser frame. This page carries the
value of the page variable that gets then sent back to Flash through Javascript. Nothing new sofar.
Now, the browser keeps a history of every page loaded in the hidden frame. If you click on the browser back button,
it will load the same asp page, but with the previous variable. The asp page then calls a javascript function
that sets the variable into Flash. Voila, Flash recognizes the change and forces the playhead to move to the
framenumber just passed.
Try it out: click the image above to open the new window. Click on the squares in any order and then use your browser's back button to see if it remembers the order.
This window has two frames: one which holds the Flash movie and one (hidden) frame with
a width of 0 that keeps track of the browser history and passes the values back to the Flash movie in the other frame.
javascrip/vbscript code
<%
Dim pagevar
if Len(request.querystring("pagevar")) > 0 then
pagevar=request.querystring("pagevar")
else
pagevar=1
end if
response.write pagevar
%>
<html>
<body>
<script language="JavaScript">
parent.flashframe.setPage(<%=pagevar%>);
</script>
</body>
</html>
html code on default.aspx
<frameset rows="*,0" border="0" framespacing="0">
<frame src="UserInterface_flash.asp" name="flashframe" >
<frame src="back_onepage.asp?pagevar=1" name="historyframe" >
</frameset>
<noframes></noframes>