Copy link to clipboard
Copied
Hi I am getting an error message for navogateToUrl, ExternalInterface in browsers IE, Chrome, FF.
SecurityError: Error 2060
Everything works fine in Flash CS6 IDE but after embedding in html, but publishing the flash movie.. nothing works for me.
Please check the code attached.
Waiting for the solution.
HTML CODE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>testing</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
html, body { height:100%; background-color: #ffffff;}
body { margin:0; padding:0; overflow:hidden; }
#flashContent { width:100%; height:100%; }
</style>
</head>
<body>
<div id="flashContent">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" id="testing" align="middle">
<param name="movie" value="testing.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="always" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="testing.swf" width="550" height="400">
<param name="movie" value="testing.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="always" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflash">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
</html>
AS3 CODE:
var WINDOW_OPEN_FUNCTION:String = "window.open";
/**
* Open a new browser window and prevent browser from blocking it.
*
* @Param url url to be opened
* @Param window window target
* @Param features additional features for window.open function
*/
function openWindow(url:String, window:String = "_blank", features:String = ""):void {
var browserName:String = getBrowserName();
if(getBrowserName() == "Firefox")
{
ExternalInterface.call(WINDOW_OPEN_FUNCTION, url, window, features);
}
//If IE,
else if(browserName == "IE")
{
ExternalInterface.call("function setWMWindow() {window.open('" + url + "');}");
}
//If Safari
else if(browserName == "Safari")
{
navigateToURL(new URLRequest(url), window);
}
//If Opera
else if(browserName == "Opera")
{
navigateToURL(new URLRequest(url), window);
}
//Otherwise, use Flash's native 'navigateToURL()' function to pop-window.
//This is necessary because Safari 3 no longer works with the above ExternalInterface work-a-round.
else
{
navigateToURL(new URLRequest(url), window);
}
}
/**
* return current browser name.
*/
function getBrowserName():String
{
try {
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";
}
bname.appendText(browser);
} catch (err:Error) {
bname.text = "Error: "+err;
}
return (browser);
}
//bname is a dynamic text field on stage
bname.text = "welcome!!!!!!";
openWindow("http://www.yahoo.com");
Many Thanks in Advance..
Maani
Copy link to clipboard
Copied
1. test online or
2. adjust your local security settings, http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
if that does not solve your 2060, post the url to your embedding html.
you also have other errors that you'll need to fix including defining all your functions and using embedding code compatible with externalinterface.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now