PDA

View Full Version : back button


flyByNite
04-05-2005, 03:51 PM
Is there a "back" action available in Flash that would take the user back to the previous frame?

How about if an external movie was loaded. is there a back button that could take user back to the movie that called this movie?

thanks again.

sfhazel
04-05-2005, 07:03 PM
gotoAndPlay(_currentframe - 1);

flyByNite
04-05-2005, 07:50 PM
This will not work if file is an external movie file and I want to back to movie clip that called it.

s2shost
04-07-2005, 11:04 PM
Hello I have been reading and trying all day on the back button until I searched in the forum. So you are saying this tutorial is not necessary?

http://www.actionscript.org/tutorials/intermediate/Enabling_a_back_button_within_flash/index.shtml

All I need to do is us this script?

gotoAndPlay(_currentframe - 1);

Were do I list this code if that is the case, in Frame 1 line 1? I'm so confused and would love to have the back button enable in flash for my website?

sfhazel
04-08-2005, 04:50 AM
flyByNite, you could try the unloadMovie() function if you want to go back to the movie that loaded it.

s2shost, just add this script to your button, and it will take you backwards one frame. gotoAndStop(_currentframe - 1);

s2shost
04-11-2005, 01:08 AM
thanks sfhazel, but I do not have a back button on my template. I'm trying to customize the template to work with the browser back button. I have followed the instructions the best of my ability and is not a success.

If anyone view this, can you tell me which codes are wrong? I have been at this for 2 weeks now with no success..

index:


<frameset rows="*,0" frameborder="NO" border="0" framespacing="0">
<frame src="flashpage.html" name="flashframe" frameborder="NO" scrolling="AUTO" marginwidth="0" marginheight="0" noresize>
<frame src="send.php" name="historyframe" frameborder="NO"></frameset>
<noframes><body bgcolor="#999999">
YOU NEED A 4.0 BROWSER
</body></noframes>

The flashpage.html

<script language="JavaScript">
<!--
function spawnWindow(URL,Name,features) {
window.open(URL,Name,features);
}
//-->
</script>
<script type="text/javascript" src="MLAB_flash_setvariables.js"></script>
</HEAD>
<BODY bgcolor="#242928">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td align="CENTER">
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
WIDTH="766" HEIGHT="660" id="s2shost" ALIGN="center">
<PARAM NAME="movie" VALUE="s2shost.swf"> <PARAM NAME="quality" VALUE="high"> <PARAM NAME=scale VALUE=exactfit> <PARAM NAME=bgcolor VALUE=#242928><PARAM NAME = "FlashVars" VALUE = "movieid=s2shost" />
<EMBED src="s2shost.swf" quality=high scale=exactfit bgcolor=#242928 WIDTH="766" HEIGHT="660" swLiveConnect=true NAME="s2shost.swf"
ALIGN="center"
TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" FlashVars="movieid=s2shost"></EMBED>
</OBJECT>

the Js.as page

// -----------------------------------------------------------
// Univeral method for javascript->flash setvariable
// -----------------------------------------------------------
if(!_level0.$jslisten_init){
Stage.$jsvarlistener = new LocalConnection();
Stage.$jsvarlistener.setVariables = function(query) {
var i, values;
var chunk = query.split("&");
for (i in chunk) {
values = chunk[i].split("=");
_root[values[0]] = values[1];
}
};
Stage.$jsvarlistener.connect(_level0.movieid);
_level0.$jslisten_init = true;

The .js page


// -----------------------------------------------------------
// Detection snippet from http://www.dithered.com/javascript/browser_detect/index.html
// -----------------------------------------------------------
var ua = navigator.userAgent.toLowerCase();
var is_pc_ie = ( (ua.indexOf('msie') != -1 ) && ( ua.indexOf('win') != -1 ) && ( ua.indexOf('opera') == -1 ) && ( ua.indexOf('webtv') == -1 ) );



/* -----------------------------------------------------------
function setFlashVariables(movieid, flashquery)

movieid: id of object tag, name of movieid passed in through FlashVars
flashquery: querystring of values to set. example( var1=foo&var2=bar )
----------------------------------------------------------- */
function setFlashVariables(s2shost, flashquery){
var i,values;
if(is_pc_ie){
var chunk = flashquery.split("&");
for(i in chunk){
values = chunk[i].split("=");
document[s2shost].SetVariable(values[0],values[1]);
}
}else{
var divcontainer = "flash_setvariables_"+s2shost;
if(!document.getElementById(divcontainer)){
var divholder = document.createElement("div");
divholder.id = divcontainer;
document.body.appendChild(divholder);
}
document.getElementById(divcontainer).innerHTML = "";
var divinfo = "<embed src='gateway.swf' FlashVars='lc="+s2shost+"&fq="+escape(flashquery)+"' width='0' height='0' type='application/x-shockwave-flash'></embed>";
document.getElementById(divcontainer).innerHTML = divinfo;
}
}

send.php file

<!--url's used in the movie-->
<!--text used in the movie-->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="10" height="10" id="send" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="send.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<param name="FlashVars" value="&page=<?php echo $_GET['page']; ?>" />
<embed src="send.swf" FlashVars="&page=<?php echo $_GET['page']; ?>" quality="high" bgcolor="#000000" width="10" height="10" name="send" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<p>Page 1</p>

xzone9
03-07-2006, 08:06 PM
YOU need to putput the Flash SWF as AS 1.0