-
Senior Member
something for the most l33t
how would you take a back button in an html doc, and point it to a certain keyframe in a flash project??
Xero Patience Studios
Web Design
Software Development
Graphic/Logo Design
-
OOP is one letter from OOPS
You can do it with an active page. The following is from a script that I used to vary the video playing in a window opened with javascript. Using this script I reuse the same window and SWF so that I did not have to create an SWF for each FLV. This example is ASP, but could be done in PHP.
ASP:
<%="<script language='javascript'>function setMovie(){window.document.flvPlayer.SetVariable(' fileName', "& Request.QueryString("playFile") & ")}</script>"%>
ActionScript:
var fileName
function getMovie(){
trace("checking for variable value")
if(fileName){
clearInterval (fileCheck)
_root.main.setMedia (fileName, FLV)
}else{
}
}
var fileCheck = setInterval(getMovie, 1000)
I am sure you can adapt this to do what you want.
-
OOP is one letter from OOPS
-
can do it in javascript too, onload use location.replace to pass a querystring with ?redirect=32 appended, then document.open/write to send to new page that's same as the page we just left, minus that onload, and on the swf object put a flashvars that's populated by location.search.split("?").pop() - then in the swiff at the top of frame 1 just put gotoAndPlay(redirect||2);
-
Total Universe Mod
moagrius, would you say your method is better than the link Kortex just posted? By 'better' I mean does it fix the known issues with Kenny Bunch's class?
If so I'd be very interested in a longer explanation and sample files if possible. The back button problem has plagued me from day one and I'm tired of people getting angry at my pages because they innocently hit Back.
I've tried Penners solution before but it just seemed like it should be simpler.
My flash movies only have one frame and all navigation is handled with functions and moviecliploaders so I need something that can intergrate with that fairly easy. I'd be so stoked if I could retro-fit my last two sites with browser history.
Thanks for any advice you may have.
-
OOP is one letter from OOPS
Should also mention that SharedObject is also a possibility.
-
long answer: i cant make the claim it's better - its just not dependant on server side script - truth is, i've never tried either way. i have, however, found success with location.replace in arenas others often describe as difficult - it's basically a splice into the browsers history object, and can circumvent a lot of the issues commonly experienced when dealing with the sinister back button. you probably know this already, but for the edication of anyone who doesnt - each page a browser serves "pushes" a copy of that page (a very good copy, including window scroll position, rendering of active content, etc) onto an array-ish object called "history". location.replace deletes an entry, and replaces it with the value - so say you go to mainpage, contactspage, affiliatespage, vendorspage, phonenumbers - then go back twice, landing you on affiliatespage - which has a button on it with location.replace("elsewhere.html"); you click that button, and youre now at elsewhere.html. if you hit the back button, you'll go back to contactspage, NOT affiliates page. if from there you hit forward, you'll go back to elsehwere.html, NOT affiliates.
short answer: i dunno.
-
hmm i just looked more thoroughly at kortex's first solution - taht's not ASP at all really - its javascript inside ASP tags with a call to the querystring that can be easily emulated with pure js. here's a modification:
Code:
<script>
function setMovie(){
document.flvPlayer.SetVariable("fileName",location.search.substr(1).split("playBack=").pop())}</script>
Last edited by moagrius; 06-17-2006 at 12:36 AM.
-
OOP is one letter from OOPS
moagrius is correct. It is javascript that is written by ASP. The reason for this is so that you can get the GET variable (via the ASP) passed by a link to the page as passing variables from page to page with javascript can be tricky. So if you are not passing variables from page to page, the whole thing can be done in a single page (the setting a variable in flash) and calling javascript.
-
Total Universe Mod
Thanks for the explanation. It looks like I'll just have to pick a method and continue to tweek it until it does what I want.
-
kortex: you don't need ASP to retrieve GET variables, only POST. just pull everything off the url after "?", split it by "&", then split each of those by "=", stick the shift on an object as a key and the pop as a value, e.g.,code: function setquery(a){
var b=[],c;
for(c in a)b.push(escape(c)+"="+escape(a[c]));
return "?"+b.join("&");}
function getquery(a){
a=a.split("?").pop().split("&"),b=a.length,c={};
while(b){
var d=a[--b].split("=");
c[d.shift()]=d.pop();}
return c;}
var querystring="http://www.yoursite.com/somepage.php?somevar=someval&do=1&color=blue&gende r=male";
var GET=getquery(querystring);
trace(GET.gender);
trace(GET.color);
trace(setquery(GET));
-
OOP is one letter from OOPS
moagrius
Thanks, was not aware you could do that with strait javascript. That sould make my life a bit easier in the future.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|