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
This commit is contained in:
Ray Greenwell
2008-05-12 23:38:53 +00:00
parent 714ab29a88
commit 8abc76a5fc
+10 -14
View File
@@ -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!