2010-06-22 24 views
1

的iframe,我會認爲我是一個新手,針對存在的問題在Flash鏈接到Firefox的

我在一個Flash菜單進行按鈕播放動畫和去上點擊的網址,而我所做的這樣就可以將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!"); 
    } 
} 

回答

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),所以如果我找到屬性(或某人可以找到相關源),我會添加它。

+0

http://www.codeweblog.com/flex-open-ie-window-and-call-the-javascript/我想。 – phwd 2010-06-23 02:08:35