<?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>yourpalmark &#187; Featured</title>
	<atom:link href="http://yourpalmark.com/category/featured/feed/" rel="self" type="application/rss+xml" />
	<link>http://yourpalmark.com</link>
	<description>lulz</description>
	<lastBuildDate>Thu, 29 Dec 2011 02:34:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Updated Solution: AS3 Security Error #2122 with 300 Redirects</title>
		<link>http://yourpalmark.com/2011/12/28/updated-solution-as3-security-error-2122-with-300-redirects/</link>
		<comments>http://yourpalmark.com/2011/12/28/updated-solution-as3-security-error-2122-with-300-redirects/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 02:32:59 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://yourpalmark.com/?p=600</guid>
		<description><![CDATA[Quite a while ago Steven Sacks posted a solution to 300 redirects when loading images in Flash.
This seemed to work most of the time but the solution does not work every time (at least anymore).]]></description>
			<content:encoded><![CDATA[<p>Quite a while ago Steven Sacks <a href="http://www.stevensacks.net/2008/12/23/solution-as3-security-error-2122-with-300-redirects/">posted a solution</a> to 300 redirects when loading images in Flash.<br />
This seemed to work most of the time but the solution does not work every time (at least anymore).<br />
One thing I noticed with Facebook in particular is that the contentLoaderInfo.url (the redirected url) was not a complete url with profile images. So loading that url would not work.</p>
<p>Started looking into other possible solutions and low-and-behold, the language reference actually tells you <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/LoaderContext.html#checkPolicyFile">what to do</a>.<br />
At the bottom of the checkPolicyFile section, Adobe mentions steps to take with redirects:</p>
<ol>
<li>Examine the value of LoaderInfo.url after you have received a ProgressEvent.PROGRESS or Event.COMPLETE event, which tells you the object&#8217;s final URL.</li>
<li>Call the Security.loadPolicyFile() method with a policy file URL based on the object&#8217;s final URL.</li>
<li>Poll the value of LoaderInfo.childAllowsParent until it becomes true.</li>
</ol>
<p>I put together some example source code below to walk you through the steps.</p>
<pre class="brush: as3">
private var loader:Loader;
private var accessChildTimer:Timer;
private var url:String;

private function init():void
{
	accessChildTimer = new Timer( 100, 100 );
	accessChildTimer.addEventListener( TimerEvent.TIMER, onAccessChildTimer );
}

public function loadImage():void
{
	loader = new Loader();
	loader.contentLoaderInfo.addEventListener( Event.COMPLETE, onLoaderComplete );

	var context:LoaderContext = new LoaderContext();
	context.checkPolicyFile = true;

	var request:URLRequest = new URLRequest( url );
	loader.load( request, context );
}

protected function onLoaderComplete( event:Event ):void
{
	var loaderInfo:LoaderInfo = loader.contentLoaderInfo;
	if( loaderInfo.childAllowsParent )
	{
		displayImage();
	}
	else if( loaderInfo.url != this.url )
	{
		var redirectURL:String = loaderInfo.url + &quot;crossdomain.xml&quot;; //Might want to write a method to append a &#039;/&#039; if necessary.
		Security.loadPolicyFile( redirectURL );
		accessChildTimer.reset();
		accessChildTimer.start();
	}
}

protected function onAccessChildTimer( event:TimerEvent ):void
{
	var loaderInfo:LoaderInfo = loader.contentLoaderInfo;
	if( loaderInfo.childAllowsParent )
	{
		accessChildTimer.stop();
		displayImage();
	}
}

private function displayImage():void
{
	//Access BitmapData here
}
</pre>
<p>Hopefully that helps you out!</p>
]]></content:encoded>
			<wfw:commentRss>http://yourpalmark.com/2011/12/28/updated-solution-as3-security-error-2122-with-300-redirects/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>AS3 Facebook Graph API Branch</title>
		<link>http://yourpalmark.com/2011/03/06/as3-facebook-graph-api-branch/</link>
		<comments>http://yourpalmark.com/2011/03/06/as3-facebook-graph-api-branch/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 03:04:19 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://yourpalmark.com/?p=569</guid>
		<description><![CDATA[If you’re using the officially supported AS3 Facebook library, you might want to check out my branch...]]></description>
			<content:encoded><![CDATA[<p><img src="http://yourpalmark.com/blog/wp-content/uploads/2011/03/facebook_platform_logo-300x300.png" alt="" title="facebook_platform_logo" width="300" height="300" class="alignleft size-medium wp-image-574" />Back in May of last year, I was getting frustrated with the lack of support in Adobe&#8217;s official Facebook ActionScript library. In fact at that time, the library that claimed it was &#8220;fully supported by Facebook and Adobe&#8221; had not been updated since December 1, 2009. At the same time, Facebook was fully pushing their new Graph API.</p>
<p>At my job, I was starting to do a lot of Facebook work and was constantly seeing posts about Graph. Instead of waiting on Adobe, I started to edit their library locally to add support for Graph. I mentioned this on the issue tracker of Adobe&#8217;s library to see if anyone would be interested, and several people responded favorably&#8230; but no one from Adobe responded at all.</p>
<p>At first, I was pulling in the new Graph JS SDK on our site, initializing the user with it directly, and had just made a few line changes in the library to make the same old REST calls using it instead. This was just a bridge to start working with Graph. Once I had the user initialized with it, I was able to start taking advantage of the new calls. I then started making more changes, next supporting the JS SDK&#8217;s UI methods and then the actual API. After a few months of writing and working with the library in a production environment, I decided to upload my branch of the library to GitHub.</p>
<p>I did this at the beginning of September. Between May and September, several people were complaining about the complete lack of support of the official Adobe library with no response at all. In fact, Jason Crist the original author of the library who handed over control to Adobe was getting frustrated with the lack of support as well and reached out to me about joining forces on the new library. But within a week of just talking about it, Adobe comes out of the blue and says that a new library with Graph support was coming. They were obviously working on it for a while, because the day after they announced that, it was uploaded. Thanks for the head&#8217;s up Adobe!</p>
<p>So if you&#8217;re keeping tabs, the officially supported library didn&#8217;t see an update from December 1, 2009 through September 30, 2010. That&#8217;s almost 10 months. So you&#8217;ll forgive me if I didn&#8217;t believe this new library would be supported any better. I did however like what they had done with the library, most of it that is. I decided to rewrite my library again, but this time based on the new Adobe library. I continued to maintain my branch for several reasons: support being the biggest, a few issues I was noticing with the new library, and lack of typed value objects for the returned data.</p>
<p>As I find issues with the core library, I update them in my branch. Most of these changes in turn get implemented into the core library. In fact, I was annoyed that the new library required an external JS file and a special way of embedding the swf, so I rewrote the JS in an ActionScript class that gets injected into the HTML at runtime, and Adobe now uses that class directly with no modification. I reached out to Adobe to see if I could become a committer on the library, they responded, but unfortunately didn&#8217;t seem too interested. So instead I continue to maintain my branch.</p>
<p>Long story short, if you&#8217;re using the officially supported AS3 Facebook library, you might want to check out my branch too. You might just find that your issues and suggestions get taken into account faster, if Adobe does make any updates to their library, I make those updates as soon as I notice, and you might like having typed objects for the returned data (like FacebookUser instead of just a generic object with the user&#8217;s info).</p>
<p>Get it here: <a href="https://github.com/yourpalmark/facebook-actionscript-api">https://github.com/yourpalmark/facebook-actionscript-api</a><br />
Docs: <a href="http://yourpalmark.github.com/facebook-actionscript-api/docs/">http://yourpalmark.github.com/facebook-actionscript-api/docs/</a></p>
<p>I also maintain an AIR branch as well: <a href="https://github.com/yourpalmark/facebook-air-api">https://github.com/yourpalmark/facebook-air-api</a><br />
Docs: <a href="http://yourpalmark.github.com/facebook-air-api/docs/">http://yourpalmark.github.com/facebook-air-api/docs/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://yourpalmark.com/2011/03/06/as3-facebook-graph-api-branch/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

