Skip to main content
Known Participant
May 11, 2011
Question

Have link open in same page

  • May 11, 2011
  • 2 replies
  • 537 views

I inherited some code from a previous programer.  The idea is that a user clicks on the player and that opens the page at a new url.  It works if it opens in a new page but it doesn't work trying to open the url in the same page.  It just closes the player.  Here is the code:

function gotoLink(event:MouseEvent) {
ns.pause();
if (openwin=="_blank") {
  ExternalInterface.call("window.open('"+vidlink+"')");
}
  else {
   ExternalInterface.call("window.location.href=('"+vidlink+"')");
  }
ExternalInterface.call("hideDiv()");
}

Can someone help me out?

This topic has been closed for replies.

2 replies

leoserra
Inspiring
May 12, 2011

Hi,

In this code you have "_blank" as a condition for the IF. I don't know were openwin is defined, but "_blank" is a reserved word used in the navigateToURL method in AS3. Take a look at livedocs:

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/package.html#navigateToURL()

You can see what these different word mean.

What happens here is that openwin variable has the "_blank" value, so it calls "window.open", which will open a new window. If it was any other thing, like "_self", then it would call "window.location" that opens the new URL in the same window.

Hope this helps.

Known Participant
May 11, 2011

I have also tried

function gotoLink(event:MouseEvent) {
ns.pause();
  {
  navigateToURL( new URLRequest(vidlink), openwin);
  }
ExternalInterface.call("hideDiv()");
}

Problem is that when you click on the player in IE it just closes the player, doesn't open the link any window.

Any suggestions?