tags:

views:

434

answers:

4

Is it possible to make the flash content go back to some previous frame when the user clicks on the back button in the browser? Similarly, can the the refresh button be used to refresh to the same frame and not go back to the starting frame?

A: 

The browser buttons work on web file documents, like html, htm, php, cfm, jsp, etc. When your browser a flash page, your remaining on the same, and the content changes based on how it is programmed and how the user is interacting with the document. So no, those buttons don't work as you'd like to for a flash document.

Jay
That's not strictly accurate - if you implement something like SWFAddress you can totally get the browser back and forward buttons working. See my comment - it works by passing anchor tags into and out of Flash.
Myk
I sit corrected ... thanks
Jay
+2  A: 

It depends on how you build it. First of all, you need to import something called SWFAddress. In order to use SWFAddress you need to make sure you're embedding your Flash using SWFObject, not just object/embed tags.

SWFAddress lets you append anchor tags to your url. What this allows you to do is change the URL in a way that the browser can understand without forcing a refresh of the page.

So for instance, if my app is at www.mypage.com/flash.html and I install SWFAddress I can set it up so that when I press a button to go to page 2 the following happens:

  1. SWFAddress changes my URL to www.mypage.com/flash.html#page2
  2. The JavaScript SWFAddress files notice this change and inform Flash.
  3. Flash says "Oh look there's been a URL change and someone is passing me the value "page2" - what should I do with that?
  4. You can set up a switch statement that will allow flash to respond to these events in intelligent, predictable ways - for instance, you can say "if the url changes to 'page2' then gotoAndStop(2)" if that's how you're running things.

I wouldn't necessarily be doing it with Frames, though - what you really want are functions to control the way Flash behaves. So instead of sticking all of your page two content into frame 2, you'd create function gotoPage(2) and put your logic there.

As far as refreshing a frame, again that's going to depend on how you code it - but if someone hits refresh in the browser it will always refresh the browser window. With SWFAddress, though, if you have it set up right it will always take them to the destination that you've linked to the anchor tag.

Does that help? Any questions?

Myk
Kedar Soparkar
It's not as simple as adding markers - your best bet is going to be to follow the link to the video tutorial in George Profenza's comment and that will get you started. It's not hard, but you have to know how AS3 works for it to make sense.
Myk
A: 

http://www.asual.com/swfaddress/

CodeJoust
A: 

Try using SWFAddress. Here is simple demo. Lee has a nice video tutorial to get you started.

George Profenza