dcsimg
A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: Named Anchors and site navigation with history

  1. #1
    webdesigner Marek Binkowski's Avatar
    Join Date
    May 2002
    Location
    Poland
    Posts
    142

    Named Anchors and site navigation with history

    One of the big advantages of Flash MX was Named Anchors, which were supposed to allow site navigation with Back and Forward button, history, bookmarking (all with the browser buttons).

    But it doesn't work for me. A made a site with 5 pages, and assigned a named anchor to every page. When i jump from page 1 to page 4 for example, and then I click the browser's back button, the site jumps to page 3 (and not 1, what I expect).

    I searched this forum for solution and found out, that this function is corrupted. Does anybody know how to fix it? Maybe some additional ActionScript programming? Or some JavaScript function in HTML document would help?

    I know theres an alternative solution presented by Robert Penner, but it's not satisfactory, because the HTML page must use frames, additional HTML pages have to be loaded, and there are some audible clicks with some delay, which disturb somewhat a fine Flash project.

    I tried to implement a method similar to Robert's, but using named paragraphs in HTML document. But I couldn't find any method to detect, when the Back button was pressed in the browser. Please, help or suggest any ideas. Inside or outide Flash.
    marek binkowski
    webdesign ::: www.ampo.com.pl


  2. #2
    Senior Member stoc's Avatar
    Join Date
    Nov 2001
    Location
    Romania, Arad
    Posts
    428
    To take advantage of named anchor keyframes in your final Flash movie, select the Flash w/ Named Anchors option in the Template pop-up menu on the HTML tab of the Publish Settings dialog box.

    did u done it !?

  3. #3
    webdesigner Marek Binkowski's Avatar
    Join Date
    May 2002
    Location
    Poland
    Posts
    142
    Shure, otherwise it wouldn't work at all.

    It works, but wrong. The browser's buttons Back and Forward navigate linear, always to the previous or next namedAnchor's keyframe on the timeline, even when the user jumped to/from any other keyframe.

    Like in the example:

    I have 5 pages (5 keyframes with Named Anchors). Let's say they are numbered from 1 to 5.

    When I go from page 2 to page 3, and then press Back, the site goes back to page number 2. That's ok.

    But when i go form page 2 to page 5, and then press Back, the site goes to page 4, which haven't even been displayed yet, so should'n be in history at all...

    That's my problem. The Back button doesnt return to previous displayed named anchor, but always to the previous one existing on timeline.
    marek binkowski
    webdesign ::: www.ampo.com.pl


  4. #4
    webdesigner Marek Binkowski's Avatar
    Join Date
    May 2002
    Location
    Poland
    Posts
    142
    Still need help

    Is there any method to detect in HTML document, when user clicks Back button?
    marek binkowski
    webdesign ::: www.ampo.com.pl


  5. #5
    You can use iframes

  6. #6
    webdesigner Marek Binkowski's Avatar
    Join Date
    May 2002
    Location
    Poland
    Posts
    142
    what are iframes?
    marek binkowski
    webdesign ::: www.ampo.com.pl


  7. #7
    iframes works just like regular frames but they are embedded in the page so your main page doesn't have to change

  8. #8
    also you don't need different pages for the page in the iframe. Just pass all the variables you need along with the url string and use a javascript on that page to parse the url query string.

    (ie. "nav.html?title=pagetitle&flashframe=thisframe ")
    make sure you use *.js for the script so you only have to download it once.

  9. #9
    webdesigner Marek Binkowski's Avatar
    Join Date
    May 2002
    Location
    Poland
    Posts
    142
    thanks a lot
    marek binkowski
    webdesign ::: www.ampo.com.pl


  10. #10
    webdesigner Marek Binkowski's Avatar
    Join Date
    May 2002
    Location
    Poland
    Posts
    142
    I just went to find some details about iframes and i started to wander what a beautiful thing IFRAMES are, and what possibilities they give, but then on http://developer.apple.com/internet/...pt/iframe.html I found this:

    Sadly, referencing the IFRAME's document object is no simple task, since IE5, IE5.5, IE6, and NS6 all provide different ways to access it. IE5, both on the Mac and PC, provides the simplest method: IFRAMEs in this browser show up in the document.frames array and have a document property. In IE5.5, IE6 and NS6, you can retrieve the IFRAME element object with document.getElementByID(), then, in NS6, use the object's contentDocument property, and in IE 5.5+, use the document property of the IFRAME object's contentWindow property [...]

    Man, aren't they stupid? Why they create such a mess?
    Last edited by Marek Binkowski; 07-18-2003 at 07:51 AM.
    marek binkowski
    webdesign ::: www.ampo.com.pl


  11. #11
    They said the iframe logs the pages in the iframes into the browser history, but that is exactly what you want here. As for IE5, IE5.5, IE6, and NS6, I don't know how they work. I think iframes works well in ie, but not in NS. Sometimes in older(or maybe even newer) versions of NS, the back button only acts on the "parent page", not the frames pages (same problem for regular frames or iframes).

  12. #12
    webdesigner Marek Binkowski's Avatar
    Join Date
    May 2002
    Location
    Poland
    Posts
    142
    Yes, the thing with history would be great, because it's exactly what I was looking for and I'd love it. But for every version of IE (just one browser, one producer!) I'm supposed to detect it and make a different script, and I hate it.

    I thing that's why iframes are used so rare and are so unknown, despite of their potential usefullness.

    That's what i love in Flash, that I have just one ActionScript and it just works :-)

    Thanx anyway McFalski :-)
    marek binkowski
    webdesign ::: www.ampo.com.pl


  13. #13
    I think misunderstood the article. It went through all that trouble to PREVENT browser from logging history. To make it log history, you don't have to do that stuff. It'll work just like a regular frame.

  14. #14
    Here is one I made, but it doesn't work offline with IE. IE doesn't let you have query strings in the url of local files. It'll work online. Tested on IE 6 and NS7.1
    Attached Files Attached Files

  15. #15
    webdesigner Marek Binkowski's Avatar
    Join Date
    May 2002
    Location
    Poland
    Posts
    142
    Thanks, man! It really works, and much faster that the old method :-)
    marek binkowski
    webdesign ::: www.ampo.com.pl


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center