<?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>Floorplanner Tech Blog &#187; actionscript2</title>
	<atom:link href="http://techblog.floorplanner.com/tag/actionscript2/feed/" rel="self" type="application/rss+xml" />
	<link>http://techblog.floorplanner.com</link>
	<description>Our latest geek adventures!</description>
	<lastBuildDate>Tue, 16 Mar 2010 18:45:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>BitmapData.draw(..) cross domains</title>
		<link>http://techblog.floorplanner.com/2008/05/26/bitmapdatadraw-cross-domains/</link>
		<comments>http://techblog.floorplanner.com/2008/05/26/bitmapdatadraw-cross-domains/#comments</comments>
		<pubDate>Mon, 26 May 2008 11:37:47 +0000</pubDate>
		<dc:creator>Gert-Jan van der Wel</dc:creator>
				<category><![CDATA[Flash+ActionScript]]></category>
		<category><![CDATA[actionscript2]]></category>
		<category><![CDATA[cross domain]]></category>

		<guid isPermaLink="false">http://www.suite75.net/blog/dev/bitmapdatadraw-cross-domains.html</guid>
		<description><![CDATA[Since recently we create a thumbnail image of every Floorplanner plan that is saved. To create a 240&#215;180px image we use the BitmapData class (AS2) to get the pixel info and we send it to our server to create the PNG/JPG.
It can happen that the content (images, swf&#8217;s) has to be loaded from a different [...]]]></description>
			<content:encoded><![CDATA[<p>Since recently we create a thumbnail image of every Floorplanner plan that is saved. To create a 240&#215;180px image we use the BitmapData class (AS2) to get the pixel info and we send it to our server to create the PNG/JPG.</p>
<p>It can happen that the content (images, swf&#8217;s) has to be loaded from a different server then the server that holds the HTML page with the Flash app. We noticed that the Flash Security Sandbox doesn&#8217;t like that (surprise!) by not allowing us to use the BitmapData.draw(..) method.</p>
<p><a href="http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/enabling_bitmapdatad.php">Abdul</a> found a solution for AS3 and we ported it to AS2. We only needed a way to load the crossdomain.xml file from the domain of the HTML page. This sniplet uses Javascript to determine the domain and loads the policy file (crossdomain.xml) from it.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="actionscript" style="font-family: Monaco,monospace;"><span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">url</span>:<span style="color: #0066CC;">String</span> =  <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span> ExternalInterface.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span>
    <span style="color: #ff0000;">&quot;function(){ return document.location.href.toString();}&quot;</span>
<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">split</span>:<span style="color: #0066CC;">Array</span> = lCurrentUrl.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;/&quot;</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">System</span>.<span style="color: #006600;">security</span>.<span style="color: #006600;">loadPolicyFile</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;http://&quot;</span>+ <span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span> +<span style="color: #ff0000;">&quot;/crossdomain.xml&quot;</span> <span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://techblog.floorplanner.com/2008/05/26/bitmapdatadraw-cross-domains/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
