<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Beckh@m&#039;s Blog &#187; Flash</title>
	<atom:link href="http://beckh0m.wordpress.com/category/uncategorized/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://beckh0m.wordpress.com</link>
	<description></description>
	<lastBuildDate>Wed, 04 Apr 2012 23:47:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='beckh0m.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Beckh@m&#039;s Blog &#187; Flash</title>
		<link>http://beckh0m.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://beckh0m.wordpress.com/osd.xml" title="Beckh@m&#039;s Blog" />
	<atom:link rel='hub' href='http://beckh0m.wordpress.com/?pushpress=hub'/>
		<item>
		<title>JavaScript &#8211; Flash Communication</title>
		<link>http://beckh0m.wordpress.com/2009/08/29/javascript-flash-communication/</link>
		<comments>http://beckh0m.wordpress.com/2009/08/29/javascript-flash-communication/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 04:28:34 +0000</pubDate>
		<dc:creator>beckh0m</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Java Script]]></category>
		<category><![CDATA[Flash Java Script]]></category>

		<guid isPermaLink="false">http://beckh0m.wordpress.com/?p=36</guid>
		<description><![CDATA[I used to work with flash all the times, in fact we used it in almost every project through college. You can do amazing things with flash very easily and honestly I love action script[:D]. Whenever you work with flash you will find yourself need to make flash communicate with other applications. In action script [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=beckh0m.wordpress.com&#038;blog=11025696&#038;post=36&#038;subd=beckh0m&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I used to work with flash all the times, in fact we used it in almost every project through college. You can do amazing things with flash very easily and honestly I love action script[:D].<br />
Whenever you work with flash you will find yourself need to make flash communicate with other applications.<br />
In action script you can communicate with a host application (in my case the Browser)<br />
through <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html">External Interface</a>.</p>
<p><strong>To do that you to write a little JavaScript Code:</strong></p>
<p>First you need to get the name of the flash movie and as usual this name differs along with the browser you are using so here is a method that I found here to get you the name of the flash movie whatever the browser is:</p>
<pre class="csharpcode"><span style="color:#0000ff;"><span class="kwrd">function</span> </span>getFlashMovieObject(movieName) {
    <span style="color:#0000ff;"><span class="kwrd">if</span> </span>(window.document[movieName]) {
             <span style="color:#0000ff;"><span class="kwrd">return</span> </span>window.document[movieName];
        }
    <span style="color:#0000ff;"><span class="kwrd">if</span> </span>(navigator.appName.indexOf(<span style="color:#800080;"><span class="str">"Microsoft Internet"</span></span>) == -1) {
                <span class="kwrd">if</span> (document.embeds &amp;&amp; document.embeds[movieName])
                    <span style="color:#0000ff;"><span class="kwrd">return</span> </span>document.embeds[movieName];
            }
    <span style="color:#0000ff;"><span class="kwrd">else</span> </span><span style="color:#008000;">// <span class="kwrd">if</span> (navigator.appName.indexOf(<span class="str">"Microsoft Internet"</span>)!=-1)</span>
            {
                <span class="kwrd">return</span> document.getElementById(movieName);
            }
        }

<span style="color:#008000;">// Now Call the function on your flash movie.</span>

      <span style="color:#0000ff;"><span class="kwrd">function</span> </span>SendDataToFlashMovie(data) {
       <span style="color:#0000ff;">var </span>flashMovie = getFlashMovieObject(<span style="color:#800080;"><span class="str">"myFlashMovie"</span></span>);
       flashMovie.<span style="color:#0000ff;">JStoAS</span>(data);}


<strong>then you have to write alittel Action Script code:</strong>
Now you have to register a callback method to respond to your method call from javascript.



<pre class="csharpcode"><span style="color:#0000ff;"><span class="kwrd">import flash.external.ExternalInterface;</span><span class="kwrd">
ExternalInterface.addCallback</span></span>(<span style="color:#800080;"><span class="str">"JStoAS"</span></span>, getDataFromJavaScript);
<span style="color:#0000ff;"><span class="kwrd">function</span> </span>getDataFromJavaScript(data:<span style="color:#0000ff;"><span class="kwrd">String</span></span>):<span style="color:#0000ff;">void </span>{
<span style="color:#008000;">// Dod whatever you want <span class="kwrd">with</span> data here</span>
}

and that's how it's done [;)]

<span style="color:#000000;"><strong>Beckham</strong></span>
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beckh0m.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/beckh0m.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/beckh0m.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/beckh0m.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/beckh0m.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/beckh0m.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/beckh0m.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=beckh0m.wordpress.com&#038;blog=11025696&#038;post=36&#038;subd=beckh0m&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://beckh0m.wordpress.com/2009/08/29/javascript-flash-communication/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f1cb642e3bf0857c937c48cab52bcd3d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beckh0m</media:title>
		</media:content>
	</item>
	</channel>
</rss>
