ActionScript 3 AS3:弹出窗口拦截器解决方法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 AS3:弹出窗口拦截器解决方法相关的知识,希望对你有一定的参考价值。

/**
* Flash AS3 Page Change Utility
* @author Jordan Ambra
* @version 1.2
* http://www.zorked.com
* http://www.zorked.com/flash/flash-and-navigatetourl-popup-blocking/
*/

package com.zorked {
	import flash.external.ExternalInterface;
	import flash.net.*;
	
	public class URLNavigator {
		
		/**
		 * Utility function to wrap up changing pages. Avoids over-aggressive popup blockers.
		 * @param url		The URL to change to. Either a String or a URLRequest
		 * @param window	The target browser window/tab, generally _self, _top, or _blank
		 * @usage URLNavigator.ChangePage("http://www.google.com", "_blank");
		 */
		public static function ChangePage(url:*, window:String = "_self"):void {
			var req:URLRequest = url is String ? new URLRequest(url) : url;
			if (!ExternalInterface.available) {
				navigateToURL(req, window);
			} else {
				var strUserAgent:String = String(ExternalInterface.call("function() {return navigator.userAgent;}")).toLowerCase();
				if (strUserAgent.indexOf("firefox") != -1 || (strUserAgent.indexOf("msie") != -1 && uint(strUserAgent.substr(strUserAgent.indexOf("msie") + 5, 3)) >= 7)) {
					ExternalInterface.call("window.open", req.url, window);
				} else {
					navigateToURL(req, window);
				}
			}
		}
		
	}
	
}

以上是关于ActionScript 3 AS3:弹出窗口拦截器解决方法的主要内容,如果未能解决你的问题,请参考以下文章

ActionScript 3 AS3下拉/弹出菜单

ActionScript 3 AS3启动没有工具栏等的新浏览器窗口

Actionscript 3 - 如何删除菜单栏、滚动条以仅显示空白弹出窗口?

ActionScript 3 导航到URL。调用可选的javascript弹出窗口

ActionScript 3 AS3 SWFtrospection(as3swf)

ActionScript 3 AS3 TextField和StyleSheet示例(在ActionScript中创建)