hijack the back button?
- Started
- Last post
- 15 Responses
- skel
i just thought of something... the age-old problem with flash... inexperienced web users will hit the back button and end up going to the last .htm instead of the beginning of the flash movie...
but what if you used javascript to hijack the back button... say set document.back to a variable which passed to the flash movie a gotoAndPlay to whatever timeframe you wanted it to be?
i'm thinking out loud cuz my javascript isn't the best and i'm wondering if someone else could finish the idea. is it possible?
- monNom0
flash MX has solved that problem.
but no, I think javascript can't grab the back button action...only the "document.unLoad" so you'd just end up reloading the flash movie...
I guess you could add a variable to you URL which the script captured and set the flash movie's keyframe with... but then you'd run into issues with the load time of the movie, vs the load time of the script, and so on and so forth... and it probably wouldn't work in netscape or on mac or something...
like I say, flash MX
- majman0
robert penner also solved this a couple of years ago.
have a look, it's pretty smooth:
http://www.robertpenner.com/inde…how has MX solved the problem monNom?
- monNom0
mx allows you to set keyframes which act as anchors.
hit back and it jumps to a previous anchor, which the flashplayer then interprets as a different frame...
this also alows you to bookmark pages in a flash site...
it's pretty cool, try it out (and they realize the limitations)
=.(this site takes advantage of it (seems to be down at the moment... maybe try later)
- protoculture0
hehe, he said ".htm"
- majman0
sounds pretty cool monNom, i'll have to check it out.
- skel0
wow, im impressed!
a discovery like this should've been declared a friggon international holiday.
can't believe i hadn't heard of this.
the problems being that users must have Flash 6 player installed i assume?
- skel0
friend of mine said the robertpenner.com example didn't work on his Safari Beta
:(
- lifeinsodium0
are those safari people ever going to come out with a proper version? i am tired of stuff not working on this beta crappola that they have going.
or do they already have a proper version out?
*hides under the table*
- skel0
safari's still beta... pretty popular though.
btw... for the lazy, here's the MM tutorial on MX back buttoning:
- skel0
disregard that link... thats for making back button within the swf... grr
- lifeinsodium0
doh!
- preston0
Robert Penner's trick didn't work on my Mac IE
yay MX!
- preston0
can you detect the back button in actionscript? frame anchors are fine if you're tweening everything, but my navigation is often all scripted.
- skel0
found the method in the actionscript dicitonary: index / k / keyframes / named anchors
it appears to work 80% well for my site, but appears to have problems because i have loadMovie putting an .swf into level1 and its not processing the unload command i have on the script it retuns to when going back... loadmovie causes more problems... grr
- beagle0
still on flash5