Skip to main content
DanEdmonds
Known Participant
May 26, 2009
Answered

GetUrl won't open in same window?

  • May 26, 2009
  • 3 replies
  • 3289 views

Hello,

I am creating a website with a flash menu on each page. I am using getUrl code to target each page but I can't seem to get the pages to open in the same window. If I use '_new' or '_blank' the pages open in a new window as they should but if I use '_self' or '_top' nothing happens.

Any help is much appreciated. Thanks!

Code: AS3

aboutBtn.buttonMode = true;
aboutBtn.addEventListener(MouseEvent.CLICK, callAbout);
function callAbout(e:MouseEvent):void{
  var url:String = "about.html";
  var request:URLRequest = new URLRequest(url);
  try {
    navigateToURL(request, '_self');
  } catch (e:Error) {
    trace("Error occurred!");
  }
}

This topic has been closed for replies.
Correct answer Ned Murphy

Are you testing it locally or online?

3 replies

DanEdmonds
Known Participant
May 28, 2009

I think I have the right code this time but it's still not working. I tried it on a Mac and it works fine but it is no working on PC (Windows). Any idea why?

Thanks,

Dan

aboutBtn.buttonMode = true;

aboutBtn.addEventListener(MouseEvent.CLICK, callAbout);

function callAbout(e:MouseEvent):void{

    var link:URLRequest = new URLRequest("about.html");

    navigateToURL(link, '_self');

}

Ned Murphy
Ned MurphyCorrect answer
Legend
May 28, 2009

Are you testing it locally or online?

DanEdmonds
Known Participant
May 28, 2009

Alright, I just tested it online and it worked. I thought it should work locally but whatever it works. Thanks!

One thing though. When I navigate to another page there is like a flash I guess because flash is in there. Is there a way to update just the content and not the flash menu?

May 26, 2009

I used the code pasted by you and it is working fine at my end for both '_self'  and '_blank'.

If you use '_Self' instead of '_self' it will open in a new window always. I think you should check once and let me know if the issue still persists.

DanEdmonds
Known Participant
May 26, 2009

Thanks for your reply.

No, actually neither '_self' or '_Self' worked. They work when I test but not when I publish, like accessing straight from the page with the embedded .swf file. I did try using an external page instead of my about.html and it gives me a a "Flash Player Security" pop up and I follow the link and restart the browser and it just keeps doing it but that's not my concern. I would still think it should get about.html.

kglad
Community Expert
Community Expert
May 26, 2009

there's nothing wrong with your code.  but it doesn't match your description of what you think you are doing.

DanEdmonds
Known Participant
May 26, 2009

what should I be doing differently with the code?