From 8abc76a5fc715bbe1681304800610e503ec9e113 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Mon, 12 May 2008 23:38:53 +0000 Subject: [PATCH] Changed preferredWindowOrTab parameter to be a String which is the target window/tab name. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5086 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/util/NetUtil.as | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/as/com/threerings/util/NetUtil.as b/src/as/com/threerings/util/NetUtil.as index c98fafef7..c7af99b91 100644 --- a/src/as/com/threerings/util/NetUtil.as +++ b/src/as/com/threerings/util/NetUtil.as @@ -32,26 +32,22 @@ public class NetUtil * * @return true if the url was able to be loaded. */ - public static function navigateToURL ( - url :String, preferSameWindowOrTab :Boolean = true) :Boolean + public static function navigateToURL (url :String, preferredWindow :String = "_self") :Boolean { var ureq :URLRequest = new URLRequest(url); - if (preferSameWindowOrTab) { + while (true) { try { - flash.net.navigateToURL(ureq, "_self"); + flash.net.navigateToURL(ureq, preferredWindow); return true; } catch (err :SecurityError) { - // ignore; fall back to using a blank window, below... - } - } + if (preferredWindow != null) { + preferredWindow = null; // try again with no preferred window - // open in a blank window - try { - flash.net.navigateToURL(ureq); - return true; - } catch (err :SecurityError) { - Log.getLog(NetUtil).warning( - "Unable to navigate to URL [e=" + err + "]."); + } else { + Log.getLog(NetUtil).warning("Unable to navigate to URL [e=" + err + "]."); + break; + } + } } return false; // failure!