<?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>Jozef Chúťka&#039;s blog &#187; FacebookCall</title>
	<atom:link href="http://blog.yoz.sk/tag/facebookcall/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.yoz.sk</link>
	<description>My life, my work</description>
	<lastBuildDate>Tue, 31 Jan 2012 12:40:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Parsing FQL result</title>
		<link>http://blog.yoz.sk/2010/01/parsing-fql-result/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=parsing-fql-result</link>
		<comments>http://blog.yoz.sk/2010/01/parsing-fql-result/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 11:43:00 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Flash / Flex]]></category>
		<category><![CDATA[facebook api]]></category>
		<category><![CDATA[FacebookCall]]></category>
		<category><![CDATA[FacebookData]]></category>
		<category><![CDATA[FQL]]></category>
		<category><![CDATA[FqlQuery]]></category>
		<category><![CDATA[namespace]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=928</guid>
		<description><![CDATA[Facebook Query Language, or FQL, allows you to use a SQL-style interface to more easily query the same Facebook social data that you can access through other Facebook API methods (assuming your application has access!). Data returned for Facebook ActionScript Api are XML. You can access data via E4X after setting correct namespace. As for [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.yoz.sk/wp-content/uploads/fqlExample.png" alt="" title="fqlExample" width="200" height="100" class="alignleft size-full wp-image-937" /></p>
<p><a href="http://wiki.developers.facebook.com/index.php/FQL">Facebook Query Language</a>, or FQL, allows you to use a SQL-style interface to more easily query the same Facebook social data that you can access through other Facebook API methods (assuming your application has access!). Data returned for Facebook ActionScript Api are XML. You can access data via <a href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e72.html">E4X</a> after setting correct namespace. As for now (January 25, 2010), Facebook result defines xmlns=&#8221;http://api.facebook.com/1.0/&#8221; , but it may change in future, so lets make it dynamic&#8230;</p>
<p><span id="more-928"></span></p>
<p style="clear:both;">Use e.g. extended <a href="http://blog.yoz.sk/2009/12/facebooklogger/">FacebookLogger</a> and add these lines</p>
<pre class="brush: as3; title: ; notranslate">public function fql(query:String):void
{
	var call:FacebookCall = facebook.post(new FqlQuery(query));
	call.addEventListener(FacebookEvent.COMPLETE, fqlCallComplete);
}

private function fqlComplete(event:FacebookEvent):void
{
	var data:FacebookData = FacebookData(event.data);
	var xml:XML = XML(data.rawResult);
	var ns:Namespace = xml.namespace();
	default xml namespace = ns;

	var result:Array = [];
	for each(var user:XML in xml.user)
		result.push({uid:user.uid.toString(), name:user.name.toString()});

	default xml namespace = new Namespace(&quot;&quot;);
	dispatchEvent(new ResultEvent(ResultEvent.RESULT, false, true, result));
}</pre>
<p>Notice xml.namespace() line. This method returns Namespace object used in main node (&#8220;http://api.facebook.com/1.0/&#8221;), so we can define it as default xml namespace.  If you do not set empty default namespace after you finish parsing this XML, it may throw some errors later in parsing another XMLs.</p>
<p>this is our fql query:</p>
<pre class="brush: as3; title: ; notranslate">FB.fql(&quot;SELECT uid, name FROM user WHERE uid = XXX&quot;)</pre>
<p>and data.rawResult contains following XML object</p>
<pre class="brush: xml; title: ; notranslate">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;fql_query_response xmlns=&quot;http://api.facebook.com/1.0/&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; list=&quot;true&quot;&gt;
  &lt;user&gt;
    &lt;uid&gt;12345678&lt;/uid&gt;
    &lt;name&gt;Some John Smith&lt;/name&gt;
  &lt;/user&gt;
  &lt;user&gt;
    &lt;uid&gt;12345679&lt;/uid&gt;
    &lt;name&gt;Another John Smith&lt;/name&gt;
  &lt;/user&gt;...</pre>
<p>Notice xmlns attribute in main node.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2010/01/parsing-fql-result/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Facebook PublishPost with image (update)</title>
		<link>http://blog.yoz.sk/2009/11/facebook-publishpost-with-image/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=facebook-publishpost-with-image</link>
		<comments>http://blog.yoz.sk/2009/11/facebook-publishpost-with-image/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 10:57:34 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Flash / Flex]]></category>
		<category><![CDATA[ActionLinkData]]></category>
		<category><![CDATA[facebook api]]></category>
		<category><![CDATA[FacebookCall]]></category>
		<category><![CDATA[PublishPost]]></category>
		<category><![CDATA[PublishUserAction]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=684</guid>
		<description><![CDATA[Soon, facebook api method PublishUserAction (flash api method) gets deprecated (December 20, 2009). It is suggested to use Facebook.streamPublish instead, and you can find this method in facebook flash api as PublishPost method. If you have problems to make it work take a look at the next simple example that is using image attachment and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.yoz.sk/wp-content/uploads/facebookPublishPost.png"><img src="http://blog.yoz.sk/wp-content/uploads/facebookPublishPost-200x75.png" alt="facebookPublishPost" title="facebookPublishPost" width="200" height="75" class="alignleft size-medium wp-image-685" /></a></p>
<p>Soon, facebook api method <a href="http://wiki.developers.facebook.com/index.php/Feed.publishUserAction">PublishUserAction</a> (<a href="http://code.google.com/p/facebook-actionscript-api/source/browse/trunk/source/actionscript/com/facebook/commands/feed/PublishUserAction.as">flash api method</a>) gets deprecated (December 20, 2009). It is suggested to use <a href="http://wiki.developers.facebook.com/index.php/Facebook.streamPublish">Facebook.streamPublish</a> instead, and you can find this method in facebook flash api as <a href="http://code.google.com/p/facebook-actionscript-api/source/browse/trunk/source/actionscript/com/facebook/commands/stream/PublishPost.as">PublishPost</a> method. If you have problems to make it work take a look at the next simple example that is using image attachment and actionLinkData (as prelink anywhere).</p>
<p><span id="more-684"></span></p>
<p style="clear:both;">Working part of application:</p>
<pre class="brush: as3; title: ; notranslate">var message:String = &quot;Hallo world&quot;;

var attachment:Object = {media: [{
   type: &quot;image&quot;,
   src: &quot;http://www.somedomain.com/someimage.jpg&quot;,
   href: &quot;http://www.somedomain.com/sometarget.html&quot;
}]};

var actionLinkData:ActionLinkData = new ActionLinkData();
actionLinkData.href = &quot;http://www.someapplication.com/sometarget.html&quot;;
actionLinkData.text = &quot;Uber application&quot;;

var post:PublishPost = new PublishPost(message, attachment, [actionLinkData], fbook.uid);
var call:FacebookCall = fbook.post(post);</pre>
<p>Update (Feb 12, 2009): Type-proper usage:</p>
<pre class="brush: as3; title: ; notranslate">import com.facebook.commands.stream.PublishPost;
import com.facebook.data.stream.ActionLinkData;
import com.facebook.data.stream.AttachmentData;
import com.facebook.data.stream.MediaTypes;
import com.facebook.data.stream.StreamMediaData;

var message:String = &quot;Some status message&quot;; // can be empty

var media:StreamMediaData = new StreamMediaData();
media.type = MediaTypes.PHOTO;
// MediaTypes defines &quot;link&quot;, &quot;video&quot;, &quot;photo&quot; but
// you should use &quot;image&quot;, &quot;flash&quot;, or &quot;mp3&quot;
// http://wiki.developers.facebook.com/index.php/Attachment_(Streams)

media.src = &quot;http://www.somedomain.com/someimage.jpg&quot;;
media.href = &quot;http://www.somedomain.com/go/somewhere.html&quot;;

var attachment:AttachmentData = new AttachmentData();
attachment.media = [media];
attachment.href = &quot;http://www.somedomain.com/go/somewhere.html&quot;;
attachment.name = &quot;Image title&quot;;
attachment.caption = &quot;Some subtitle&quot;;
attachment.description = &quot;Lorem Ipsum text about your image&quot;;

var link:ActionLinkData = new ActionLinkData();
link.href = &quot;http://www.somedomain.com/your_application.html&quot;;
link.text = &quot;Your application name&quot;; 

var post:PublishPost = new PublishPost(message, attachment, [link], facebook.uid);</pre>
<p>Read more about <a href="http://wiki.developers.facebook.com/index.php/Stream.publish">Stream.publish</a> and <a href="http://wiki.developers.facebook.com/index.php/Attachment_(Streams)">Attachment (Streams)</a></p>
<p>By default, the photo and the Flash object are rendered in a space up to 90 pixels in both height or width, with an emphasis on scaling the image to be 90 pixels wide (90&#215;90 px max).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2009/11/facebook-publishpost-with-image/feed/</wfw:commentRss>
		<slash:comments>54</slash:comments>
		</item>
	</channel>
</rss>

