<?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>flex &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/flex/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>ExternalInterface from JavaScript to IE/Firefox</title>
		<link>/2009/07/08/externalinterface-from-javascript-to-ie-firefox/</link>
		<comments>/2009/07/08/externalinterface-from-javascript-to-ie-firefox/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 06:53:53 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[flex 3]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[embed]]></category>
		<category><![CDATA[ExternalInterface]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[object]]></category>

		<guid isPermaLink="false">/?p=660</guid>
		<description><![CDATA[ExternalInterface communication with JavaScript The most simple way to describe the case is as if you have the ExternalInterface addCallback in the Flex application like that: flex.mxml ExternalInterface.addCallback("jsFunc", flexFunc); public flexFunc() : void { ... } and in the javascript code you&#8217;ve something like that: file.js function getSwf(movieName) { if (navigator.appName.indexOf("Microsoft") != -1) { return &#8230; <a href="/2009/07/08/externalinterface-from-javascript-to-ie-firefox/" class="more-link">Continue reading <span class="screen-reader-text">ExternalInterface from JavaScript to IE/Firefox</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/03/09/flex-javascript-communcation-example/" rel="bookmark" title="Flex Javascript communcation example">Flex Javascript communcation example </a></li>
<li><a href="/2009/10/28/tips-and-tricks-in-externalinterface-communication/" rel="bookmark" title="Tips and tricks in ExternalInterface communication!">Tips and tricks in ExternalInterface communication! </a></li>
<li><a href="/2009/02/09/ie-externalinterface-communication-problem/" rel="bookmark" title="IE &#038; ExternalInterface communication problem">IE &#038; ExternalInterface communication problem </a></li>
<li><a href="/2009/10/29/passing-objects-with-externalinterface-from-js-to-flex/" rel="bookmark" title="Passing objects with ExternalInterface from JS to Flex">Passing objects with ExternalInterface from JS to Flex </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>ExternalInterface communication with JavaScript</h2>
<p>The most simple way to describe the case is as if you have the ExternalInterface addCallback in the Flex application like that:</p>
<p><strong>flex.mxml</strong></p>
<blockquote>
<pre>ExternalInterface.addCallback("jsFunc", flexFunc);

public flexFunc() : void
{ ... }</pre>
</blockquote>
<p>and in the javascript code you&#8217;ve something like that:<span id="more-660"></span></p>
<p><strong>file.js</strong></p>
<blockquote>
<pre>function getSwf(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
         return window[movieName];
    } else{
         return document[movieName];
    }
}

getSwf('movie').jsFunc();</pre>
</blockquote>
<p>that will execute the <strong>flexFunc</strong> in the flex app.</p>
<h2>Important!</h2>
<p>is very important to have the object/embed tag correct:</p>
<blockquote>
<pre>&lt;object classid="clsid:d27cdb6 ....
&lt;param name="name" value="movie" /&gt;
&lt;param name="allowFullScreen" value="true" /&gt;
&lt;param name="AllowScriptAccess" value="always" /&gt;
&lt;param name="wmode" value="transparent" /&gt;
&lt;param name="flashVars" /&gt;
&lt;param name="src" value="movie.swf" /&gt;
&lt;embed ... name="movie"&gt;&lt;/embed&gt;
&lt;/object&gt;</pre>
</blockquote>
<h2>That doesn&#8217;t work? Where&#8217;s the bug?</h2>
<p>Even it&#8217;s not so clear the bug is present. The getSwf function gets the window[moviename], or document[moviename] depending of which browser is used. But the problem is that both object and embed tags have same name and the selected object is not one but two.</p>
<h2>So there&#8217;s a simple patch</h2>
<p>Name the object embed tags with different names, i.e.</p>
<blockquote>
<pre>&lt;object classid="clsid:d27cdb6e-ae6d-11 ...&gt;
&lt;param name="name" value="movieie" /&gt;
&lt;param name="allowFullScreen" value="true" /&gt;
&lt;param name="AllowScriptAccess" value="always" /&gt;
&lt;param name="wmode" value="transparent" /&gt;
&lt;param name="flashVars" /&gt;
&lt;param name="src" value="movie.swf" /&gt;
&lt;embed ... name="movieie"&gt;&lt;/embed&gt;
&lt;/object&gt;</pre>
</blockquote>
<p>now they are named movieie (for IE) and movieff  (for Firefox) and we must to change a bit the getSwf function like that:</p>
<blockquote>
<pre>function getSwf(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
         return window[movieName + 'ie'];
    } else{
         return document[movieName + 'ff'];
    }
}

getSwf('movie').jsFunc();</pre>
</blockquote>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/03/09/flex-javascript-communcation-example/" rel="bookmark" title="Flex Javascript communcation example">Flex Javascript communcation example </a></li>
<li><a href="/2009/10/28/tips-and-tricks-in-externalinterface-communication/" rel="bookmark" title="Tips and tricks in ExternalInterface communication!">Tips and tricks in ExternalInterface communication! </a></li>
<li><a href="/2009/02/09/ie-externalinterface-communication-problem/" rel="bookmark" title="IE &#038; ExternalInterface communication problem">IE &#038; ExternalInterface communication problem </a></li>
<li><a href="/2009/10/29/passing-objects-with-externalinterface-from-js-to-flex/" rel="bookmark" title="Passing objects with ExternalInterface from JS to Flex">Passing objects with ExternalInterface from JS to Flex </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/07/08/externalinterface-from-javascript-to-ie-firefox/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Bitmaps in actionscript 3</title>
		<link>/2009/02/06/bitmaps-in-actionscript-3/</link>
		<comments>/2009/02/06/bitmaps-in-actionscript-3/#respond</comments>
		<pubDate>Fri, 06 Feb 2009 06:15:38 +0000</pubDate>
		<dc:creator><![CDATA[stoimen]]></dc:creator>
				<category><![CDATA[featured]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[bitmap]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[ram]]></category>
		<category><![CDATA[rgb]]></category>
		<category><![CDATA[stage]]></category>

		<guid isPermaLink="false">/?p=129</guid>
		<description><![CDATA[In actionscript 3 the bitmaps are stored with 4 bytes for each pixel. There are three bytes for RGB and one for the alpha channel. So you should be carefull when passing images to the flash, cause 20&#215;20 pixel image will be using apx. 1600 bytes of RAM, to optimize this send the image as &#8230; <a href="/2009/02/06/bitmaps-in-actionscript-3/" class="more-link">Continue reading <span class="screen-reader-text">Bitmaps in actionscript 3</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2012/01/16/computer-algorithms-data-compression-with-bitmaps/" rel="bookmark" title="Computer Algorithms: Data Compression with Bitmaps">Computer Algorithms: Data Compression with Bitmaps </a></li>
<li><a href="/2009/02/06/flex-3-custom-preloader/" rel="bookmark" title="Flex 3 Custom Preloader">Flex 3 Custom Preloader </a></li>
<li><a href="/2009/05/25/remove-dom-element-with-jquery/" rel="bookmark" title="Remove DOM Element with JQuery">Remove DOM Element with JQuery </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>In actionscript 3 the bitmaps are stored with 4 bytes for each pixel. There are three bytes for RGB and one for the alpha channel. So you should be carefull when passing images to the flash, cause 20&#215;20 pixel image will be using apx. 1600 bytes of RAM, to optimize this send the image as it should appear on stage and do not resize.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2012/01/16/computer-algorithms-data-compression-with-bitmaps/" rel="bookmark" title="Computer Algorithms: Data Compression with Bitmaps">Computer Algorithms: Data Compression with Bitmaps </a></li>
<li><a href="/2009/02/06/flex-3-custom-preloader/" rel="bookmark" title="Flex 3 Custom Preloader">Flex 3 Custom Preloader </a></li>
<li><a href="/2009/05/25/remove-dom-element-with-jquery/" rel="bookmark" title="Remove DOM Element with JQuery">Remove DOM Element with JQuery </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/02/06/bitmaps-in-actionscript-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
