jacobmake

I have creative ADD

jacobmake header image 2

Anchor Links w/ Flash in Safari

February 18th, 2009 · 1 Comment · Things I've Learned

boring helpful code stuff…

Did you ever notice that if you try to navigateToURL() from inside Flash in Safari it will refresh the Flash on the page? Here is a quick work around

You need to setup a JavaScript function that uses the DOM to fidget w/ the window.location.hash. It looks something like this;


function mapAnchor(anchor)
{
window.location.hash = anchor;
}

Then from ActionScript setup a navigateToURL() like this;

var _anchorlink:URLRequest = new URLRequest("javascript:mapAnchor('"+anchorname+"')");

where anchorname is your anchor.

Tags: ·····

1 response so far ↓

  • 1 Chris // Sep 2, 2009 at 2:45 pm

    Thanks for the “helpful code stuff”! It truly was helpful.

    One thing I ran into:
    var _anchorlink:URLRequest = new URLRequest(“javascript:mapAnchor(‘”+anchorname+”‘)”);

    should be

    var _anchorlink:URLRequest = new URLRequest(“javascript:mapAnchor(‘+anchorname+’)”);

Leave a Comment