将 Flash 中的链接定位到 Firefox 的 iframe 时出现问题

发布于 2024-09-06 05:14:02 字数 612 浏览 3 评论 0原文

我认为自己是一个新手,

我在 Flash 菜单中制作了按钮来播放动画并在单击时转到 url,并且我已经做到了,以便 url 页面加载到 iframe 中。

在 Safari 上一切正常,但最终会在 Firefox 的新选项卡中加载 url 页面。

如果有人有解决方案,我们将不胜感激。非常感谢。

这是动作脚本,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!");
  }
}

I'll consider myself a newbie,

I've made buttons in a flash menu to play animation and go to a url on click, and I've made it so that the url page loads in an iframe.

Everything works fine on Safari, but it ends up loading the url page in a new tab for Firefox.

If anyone has a solution, it'll be really appreciated. Thanks so much.

Here is the actionscript and the iframe is named "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!");
  }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷鸟归林 2024-09-13 05:14:02

我有这个代码片段来处理使用 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),因此如果我找到归属(或者有人可以找到相关来源),我会添加它。

I've had this code snippet to handle opening windows using as3 that seems to work in most cases:

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);
    }
}

It isn't my code originally and I've lost the link. It would have come from an ad banner website (like doubleclick) so if I find the attribution (or someone can find the relevant source) I'll add it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文