A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: navigateToURL problem

  1. #1
    Junior Member
    Join Date
    Jun 2008
    Posts
    5

    navigateToURL problem

    I'm trying to get the link to open in the same window instead of a new window, it's currently set to _blank. I tried _top, _self, _parent. When it's set to anything other than _blank the link doesn't work.

    Code:
    import flash.display.*;
    import flash.events.*;
    hyperlinkbutton3.addEventListener(MouseEvent.CLICK, hyperclick3);
    function hyperclick3(event:MouseEvent):void {
        var url:String = "http://google.com";
    var request:URLRequest = new URLRequest(url);
    try {
      navigateToURL(request, '_blank'); // second argument is target
    } catch (e:Error) {
      trace("Error occurred!");

  2. #2
    Member
    Join Date
    Sep 2008
    Posts
    80
    "_self" is the one you need

    if you running the swf in the html file you should be able to see the effect of that

  3. #3
    Junior Member
    Join Date
    Jun 2009
    Posts
    18
    are you sure? I use "_top" in that situation pretty regularly and it works for me.

  4. #4
    Member
    Join Date
    Sep 2008
    Posts
    80
    it works fine with me when i'm using "_self"

  5. #5
    Junior Member
    Join Date
    Jun 2008
    Posts
    5
    Quote Originally Posted by kakashi807 View Post
    "_self" is the one you need

    if you running the swf in the html file you should be able to see the effect of that

    See i've already tried that. I thought maybe my joomla was messing with it somehow but even in a simple html embed it still won't open the link at all with _self. Is there something else I might be doing wrong? Nothing else wrong with the code I provided?

  6. #6
    Member
    Join Date
    Sep 2008
    Posts
    80
    mmm..that's weird, i never got that problem before but then..i never had to use the try and catch for that. try removing the try and catch

  7. #7
    Junior Member
    Join Date
    Jun 2009
    Posts
    18
    If you're actually testing this in a browser, and it's not working according to the livedocs documentation:

    * "_self" specifies the current frame in the current window.
    * "_blank" specifies a new window.
    * "_parent" specifies the parent of the current frame.
    * "_top" specifies the top-level frame in the current window.

    then I'd start by testing in some other browser setups and see if there's something in he browser settings overriding this target request. As I said, you're not doing anything functionally different than I usually do, and _top has always worked fine for me.

    Do the double/single quotes matter? I usually use double. Also, I assume you have a closing brace on your catch{} block?

  8. #8
    Member
    Join Date
    Sep 2008
    Posts
    80
    or try puttin back the http://www.google.com instead of http://google.com, not sure if it's gonna make a difference.

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