<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>FoxLing - 前端开发 &#187; AllowScriptAccess</title>
	<atom:link href="http://foxling.org/tag/allowscriptaccess/feed/" rel="self" type="application/rss+xml" />
	<link>http://foxling.org</link>
	<description>不积跬步 无以至千里</description>
	<lastBuildDate>Sat, 19 Nov 2011 16:29:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>allowNetworking控制 SWF 文件对网络功能的访问</title>
		<link>http://foxling.org/as-flex-air/allownetworking-allowscriptaccess-allowfullscreen/</link>
		<comments>http://foxling.org/as-flex-air/allownetworking-allowscriptaccess-allowfullscreen/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 08:19:20 +0000</pubDate>
		<dc:creator>FoxLing</dc:creator>
				<category><![CDATA[AS/Flex/AIR]]></category>
		<category><![CDATA[allowFullScreen]]></category>
		<category><![CDATA[allowNetworking]]></category>
		<category><![CDATA[AllowScriptAccess]]></category>
		<category><![CDATA[FlashPlayer]]></category>
		<category><![CDATA[安全控制]]></category>

		<guid isPermaLink="false">http://wp.foxling.cn/as-flex-air/allownetworking-allowscriptaccess-allowfullscreen/</guid>
		<description><![CDATA[有同事说某个Flash的插件，放到Qzone，新浪等网站，Flash里的链接点击都不生效了，打开一看，果然。 然后用FireFox打开，点击链接，FlashPlayer报错： SecurityError: Error #2146: 安全沙箱冲突:http://xxx/xxx.swf 不能调用 navigateToURL，因为 HTML/容器参数 allowNetworking 具有值 internal。 &#160;&#160;&#160; at global/flash.net::navigateToURL() 然后查查allowNetworking是何方神圣，官网解释： This HTML parameter governs a number of ActionScript APIs. It has the following possible values: &#34;all&#34;&#8212;the default. No networking restrictions; player behaves normally. &#34;internal&#34;&#8212;SWF files may not call browser navigation o&#114; browser interaction APIs, but may call any other [...]]]></description>
			<content:encoded><![CDATA[<p>有同事说某个Flash的插件，放到Qzone，新浪等网站，Flash里的链接点击都不生效了，打开一看，果然。</p>
<p>然后用FireFox打开，点击链接，FlashPlayer报错：</p>
<blockquote><p> SecurityError: Error #2146: 安全沙箱冲突:http://xxx/xxx.swf 不能调用 navigateToURL，因为 HTML/容器参数 allowNetworking 具有值 internal。<br />
&nbsp;&nbsp;&nbsp; at global/flash.net::navigateToURL() </p></blockquote>
<p>然后查查allowNetworking是何方神圣，官网解释：</p>
<blockquote><p> This HTML parameter governs a number of ActionScript APIs. It has the following possible values: <br />
&quot;all&quot;&mdash;the default. No networking restrictions; player behaves normally. <br />
&quot;internal&quot;&mdash;SWF files may not call browser navigation o&#114; browser interaction APIs, but may call any other networking APIs. <br />
&quot;none&quot;&mdash;SWF files may not call any networking APIs, nor any SWF-to-SWF communication APIs.   </p></blockquote>
<p><strong>allowNetworking</strong></p>
<p>参数：</p>
<ul>
<li>&quot;all&quot;（默认值）― SWF 文件中允许使用所有网络 API。</li>
<li>&quot;internal&quot;― SWF 文件可能不调用浏览器导航或浏览器交互 API，但是它会调用任何其它网络 API。</li>
<li>&quot;none&quot;― SWF 文件可能不调用浏览器导航或浏览器交互 API，并且它无法使用任何 SWF 到 SWF 通信 API。</li>
</ul>
<p>可以控制 SWF 文件对网络功能的访问。调用被禁止的 API 会引发 SecurityError 异常。</p>
<p>当 allowNetworking 设置为 &quot;internal&quot; 时，以下 API 被禁止：</p>
<ul>
<li>navigateToURL()</li>
<li>fscommand()</li>
<li>ExternalInterface.call()</li>
</ul>
<p>当 allowNetworking 设置为 &quot;none&quot; 时，除了上面列出的那些 API 外，还会禁止以下 API：</p>
<ul>
<li>sendToURL()</li>
<li>FileReference.download()</li>
<li>FileReference.upload()</li>
<li>Loader.load()</li>
<li>LocalConnection.connect()</li>
<li>LocalConnection.send()</li>
<li>NetConnection.connect()</li>
<li>NetStream.play()</li>
<li>Security.loadPolicyFile()</li>
<li>SharedObject.getLocal()</li>
<li>SharedObject.getRemote()</li>
<li>Socket.connect()</li>
</ul>
<p><span style="color: rgb(51, 51, 153);">扩展阅读</span></p>
<p><strong>AllowScriptAccess</strong></p>
<p>参数：</p>
<ul>
<li>sameDomain：仅当 SWF 文件和网页位于同一域中时才允许执行外出脚本访问。这是 AVM2 内容的默认值。</li>
<li>never：外出脚本访问将始终失败。</li>
<li>always：外出脚本访问将始终成功。</li>
</ul>
<p>AllowScriptAccess 参数可以防止从一个域中承载的 SWF 文件访问来自另一个域的 HTML 页面中的脚本。<br />
对从另一个域承载的所有 SWF 文件使用 AllowScriptAccess=&quot;never&quot; 可以确保位于 HTML 页面中的脚本的安全性。</p>
<p><strong>allowFullScreen</strong></p>
<p>参数：</p>
<ul>
<li>启用全屏模式设置为&quot;true&quot;，否则设置为&quot;false&quot;（默认值）</li>
<li>仅当在响应鼠标事件或键盘事件时才会调用启动全屏模式的 ActionScript。如果在其它情况中调用，Flash Player 会引发异常。</li>
<li>在全屏模式下，用户无法在文本输入字段中输入文本。所有键盘输入和键盘相关的 ActionScript 在全屏模式下均会被禁用，但将应用程序返回标准模式的键盘快捷键（例如按 Esc）除外。</li>
<li>当内容进入全屏模式时，程序会显示一条消息，指导用户如何退出和返回标准模式。该消息将显示几秒钟，然后淡出。</li>
<li>如果某个调用方与 Stage 所有者（主 SWF 文件）没有位于同一安全沙箱，则调用 Stage 对象的 displayState 属性会引发异常。</li>
<li>管理员可以通过在 mms.cfg 文件中设置 FullScreenDisable = 1 对浏览器中运行的 SWF 文件禁用全屏模式。</li>
<li>在浏览器中，必须在 HTML 页面中包含 SWF 文件，才能进入全屏模式。</li>
<li>在独立的播放器或放映文件中始终允许全屏模式。</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://foxling.org/as-flex-air/allownetworking-allowscriptaccess-allowfullscreen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

