我认为自己是新手,
我已经在闪存菜单中制作按钮来播放动画并点击进入网址,我已经制作了以便网页加载到iframe中。
在Safari上一切正常,但最终会在Firefox的新标签页中加载网页。
如果有人有解决方案,我们将非常感激。非常感谢。
以下是actionscript,iframe名为“myframe”:
present_btn.addEventListener(MouseEvent.CLICK,goPresent);
function goPresent(evt:MouseEvent):void {
// play();
present_btn.gotoAndPlay("present");
var url:String = "http://www.ecuad.ca/~vlo/corelam/blank.html";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "myframe");
} catch (e:Error) {
trace("Error occurred!");
}
}
答案 0 :(得分:0)
我已经使用此代码片段来处理使用as3的打开窗口,这在大多数情况下似乎都有效:
private function getBrowserName():String
{
var browser:String;
//Uses external interface to reach out to browser and grab browser useragent info.
var browserAgent:String = ExternalInterface.call("function getBrowser(){return navigator.userAgent;}");
//Determines brand of browser using a find index. If not found indexOf returns (-1).
if(browserAgent != null && browserAgent.indexOf("Firefox")>= 0)
{
browser = "Firefox";
}
else if(browserAgent != null && browserAgent.indexOf("Safari")>= 0)
{
browser = "Safari";
}
else if(browserAgent != null && browserAgent.indexOf("MSIE")>= 0)
{
browser = "IE";
}
else if(browserAgent != null && browserAgent.indexOf("Opera")>= 0)
{
browser = "Opera";
}
else
{
browser = "Undefined";
}
return (browser);
}
function openWindow(url:String, target:String='_blank', features:String=""):void
{
const WINDOW_OPEN_FUNCTION:String = "window.open";
var myURL:URLRequest = new URLRequest(url);
var browserName:String = getBrowserName();
switch(browserName)
{
//If browser is Firefox, use ExternalInterface to call out to browser
//and launch window via browser's window.open method.
case "Firefox":
ExternalInterface.call(WINDOW_OPEN_FUNCTION, url, target, features);
break;
//If IE,
case "IE":
ExternalInterface.call("function setWMWindow() {window.open('" + url + "', '"+target+"', '"+features+"');}");
break;
// If Safari or Opera or any other
case "Safari":
case "Opera":
default:
navigateToURL(myURL, target);
break;
}
}
private function handleMouseClick(event:MouseEvent):void
{
var sURL:String;
if((sURL = root.loaderInfo.parameters.clickTag))
{
openWindow(sURL);
}
}
最初不是我的代码而且我丢失了链接。它会来自广告横幅网站(如doubleclick),所以如果我找到归因(或有人可以找到相关来源),我会添加它。