<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: SWF9 to SWF8 Communication &#8211; EI not LC &#8211; Part 2</title>
	<atom:link href="http://blog.tracethis.com/archives/2006/07/13/swf9-to-swf8-communication-ei-not-lc-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tracethis.com/archives/2006/07/13/swf9-to-swf8-communication-ei-not-lc-part-2/</link>
	<description>Flash, SWF Studio, and the world around me</description>
	<lastBuildDate>Sat, 07 Jan 2012 22:51:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Derek Vadneau</title>
		<link>http://blog.tracethis.com/archives/2006/07/13/swf9-to-swf8-communication-ei-not-lc-part-2/#comment-108</link>
		<dc:creator>Derek Vadneau</dc:creator>
		<pubDate>Thu, 27 Sep 2007 14:21:46 +0000</pubDate>
		<guid isPermaLink="false">http://tracethis.com/?p=55#comment-108</guid>
		<description>@Paolo
The communication in that case is limited by Flash Player security. You can get around this by setting the allowScriptAccess parameter to always. In my example I left the default of sameDomain. That should allow both SWFs to talk to JavaScript, and thus, each other. You might also need a crossdomain.xml file for the remote SWF. I haven&#039;t tested this yet.

@Lawrence
Thanks. Yes and no. ExternalInterface is available to the container. If you are building a VB, C++, C#, etc., application and embedding the Flash Player within, then your app can receive an event when the Flash Player is trying to communicate using ExternalInterface or FSCommand. FSCommand passes data out of the Flash Player as a string with no encoding. ExternalInterface passes data out in XML format, and expects data in to be formatted similarly. With EI you have to encode and decode the XML yourself.

So, it is possible to have EI work in your own application outside of the browser. In fact you would have little parsing to do if all you wanted to do was have the container act as a local loop.

For the standalone Flash Player it is not possible. EI isn&#039;t available from the standalone Flash Player. You will receive a runtime error if you try and execute using EI. There&#039;s a property on ExternalInterface (available in AS3) called available that you can use to distinguish whether or not this type of communication is allowed.

Some notes on the different methods:
LocalConnection would be the slowest and most limiting, imo. It has a 40KB data limit and tends to be slow and unreliable. It is asynchronous. However, it can be used to connect to another Flash Player instance, regardless of where that Flash Player is contained. It&#039;s limited by the fact that a connection is only between two instances. A third instance trying to communicate to one of the other two will fail. You also can&#039;t communicate (easily) with the container in this way.

EI is not incredibly fast and does require you to encode/decode XML-safe data. It is, however, the only mechanism for getting data back into the AVM2 without using sockets. EI is synchronous, stopping AS execution until the container returns from FlashCall (the event).

FSCommand is by far the fastest, since there is no encoding/decoding. But it is only one-way communication. FSCommand is asynchronous, since it is not executed to the container until all other ActionScript in the same frame has executed. Therefore the fastest data can be returned to Flash is in the next frame.</description>
		<content:encoded><![CDATA[<p>@Paolo<br />
The communication in that case is limited by Flash Player security. You can get around this by setting the allowScriptAccess parameter to always. In my example I left the default of sameDomain. That should allow both SWFs to talk to JavaScript, and thus, each other. You might also need a crossdomain.xml file for the remote SWF. I haven&#8217;t tested this yet.</p>
<p>@Lawrence<br />
Thanks. Yes and no. ExternalInterface is available to the container. If you are building a VB, C++, C#, etc., application and embedding the Flash Player within, then your app can receive an event when the Flash Player is trying to communicate using ExternalInterface or FSCommand. FSCommand passes data out of the Flash Player as a string with no encoding. ExternalInterface passes data out in XML format, and expects data in to be formatted similarly. With EI you have to encode and decode the XML yourself.</p>
<p>So, it is possible to have EI work in your own application outside of the browser. In fact you would have little parsing to do if all you wanted to do was have the container act as a local loop.</p>
<p>For the standalone Flash Player it is not possible. EI isn&#8217;t available from the standalone Flash Player. You will receive a runtime error if you try and execute using EI. There&#8217;s a property on ExternalInterface (available in AS3) called available that you can use to distinguish whether or not this type of communication is allowed.</p>
<p>Some notes on the different methods:<br />
LocalConnection would be the slowest and most limiting, imo. It has a 40KB data limit and tends to be slow and unreliable. It is asynchronous. However, it can be used to connect to another Flash Player instance, regardless of where that Flash Player is contained. It&#8217;s limited by the fact that a connection is only between two instances. A third instance trying to communicate to one of the other two will fail. You also can&#8217;t communicate (easily) with the container in this way.</p>
<p>EI is not incredibly fast and does require you to encode/decode XML-safe data. It is, however, the only mechanism for getting data back into the AVM2 without using sockets. EI is synchronous, stopping AS execution until the container returns from FlashCall (the event).</p>
<p>FSCommand is by far the fastest, since there is no encoding/decoding. But it is only one-way communication. FSCommand is asynchronous, since it is not executed to the container until all other ActionScript in the same frame has executed. Therefore the fastest data can be returned to Flash is in the next frame.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lyau</title>
		<link>http://blog.tracethis.com/archives/2006/07/13/swf9-to-swf8-communication-ei-not-lc-part-2/#comment-107</link>
		<dc:creator>lyau</dc:creator>
		<pubDate>Thu, 27 Sep 2007 13:27:49 +0000</pubDate>
		<guid isPermaLink="false">http://tracethis.com/?p=55#comment-107</guid>
		<description>Useful indeed!  I&#039;m curious if the ExternalInterface solution is applicable when the application is not running within an embedded flashplayer on a web page.  LocalConnection works even if running in the standalone flash player or within an OCX component in a .NET application (I&#039;m not sure about an AIR app).
Great article.      Lawrence</description>
		<content:encoded><![CDATA[<p>Useful indeed!  I&#8217;m curious if the ExternalInterface solution is applicable when the application is not running within an embedded flashplayer on a web page.  LocalConnection works even if running in the standalone flash player or within an OCX component in a .NET application (I&#8217;m not sure about an AIR app).<br />
Great article.      Lawrence</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paolo Bassino</title>
		<link>http://blog.tracethis.com/archives/2006/07/13/swf9-to-swf8-communication-ei-not-lc-part-2/#comment-105</link>
		<dc:creator>Paolo Bassino</dc:creator>
		<pubDate>Thu, 26 Oct 2006 16:05:05 +0000</pubDate>
		<guid isPermaLink="false">http://tracethis.com/?p=55#comment-105</guid>
		<description>Thank you for these explanations, very useful... but... if the swf8 file is loaded from a different domain, it seems that the communication from swf9 to swf8 doesn&#039;t work anymore... any ideas?
Thank you.</description>
		<content:encoded><![CDATA[<p>Thank you for these explanations, very useful&#8230; but&#8230; if the swf8 file is loaded from a different domain, it seems that the communication from swf9 to swf8 doesn&#8217;t work anymore&#8230; any ideas?<br />
Thank you.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

