<?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; namespace</title>
	<atom:link href="http://blog.yoz.sk/tag/namespace/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>Quick Tip: Constructor Of Property With Namespace</title>
		<link>http://blog.yoz.sk/2011/03/quick-tip-constructor-of-property-with-namespace/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quick-tip-constructor-of-property-with-namespace</link>
		<comments>http://blog.yoz.sk/2011/03/quick-tip-constructor-of-property-with-namespace/#comments</comments>
		<pubDate>Fri, 18 Mar 2011 16:41:12 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash / Flex]]></category>
		<category><![CDATA[Class]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[getDefinitionByName]]></category>
		<category><![CDATA[namespace]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=2937</guid>
		<description><![CDATA[Some of you may not like the solution (including me) but sometimes you need a little hack to make things work for you. In my case I required a constructor of property declared under custom namespace but not defined (null). Normally, you would go for describeType(), but guess what, yeah it just does not describes [...]]]></description>
			<content:encoded><![CDATA[<p>Some of you may not like the solution (including me) but sometimes you need a little hack to make things work for you. In my case I required a constructor of property declared under custom namespace but not defined (null). Normally, you would go for <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/package.html#describeType()">describeType()</a>, but guess what, yeah it just does not describes properties with namespace other than public. While there was nothing better in my mind than passing some unexpected value and expect what happend I decided to go for it. Luckily an exception was thrown with correct constructor name.</p>
<p><span id="more-2937"></span></p>
<p>Error message looks something like this:</p>
<pre class="brush: plain; title: ; notranslate">TypeError: Error #1034: Type Coercion failed: cannot convert true to valueObject.SomeObject.</pre>
<p>lets parse it:</p>
<pre class="brush: as3; title: ; notranslate">import com.adobe.fiber.core.model_internal;

var item:SomeUltraCleverObjectWithNamespacedProperty
var className:String;
var constructor:Class;
try
{
    item.model_internal::[&quot;_internal_&quot; + name + &quot;_leaf&quot;] = true;
}
catch(error:Error)
{
    className = error.message.toString().match(&quot;([^\\s]+)\.$&quot;)[1];
}

constructor = getDefinitionByName(className) as Class;</pre>
<p>You should be careful about using it, because constructor is parsed from an error message that is localized (part of flash player). It may happen that in some translations the constructor name may appear in different part of the message (example parses at the end of sentence before dot &#8220;.&#8221; character).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2011/03/quick-tip-constructor-of-property-with-namespace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip: ApplicationUpdater for Updating AIR Executables</title>
		<link>http://blog.yoz.sk/2010/12/quick-tip-applicationupdater-for-updating-air-executables/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quick-tip-applicationupdater-for-updating-air-executables</link>
		<comments>http://blog.yoz.sk/2010/12/quick-tip-applicationupdater-for-updating-air-executables/#comments</comments>
		<pubDate>Thu, 30 Dec 2010 10:47:48 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash / Flex]]></category>
		<category><![CDATA[ApplicationUpdater]]></category>
		<category><![CDATA[ApplicationUpdaterUI]]></category>
		<category><![CDATA[namespace]]></category>
		<category><![CDATA[StatusUpdateEvent]]></category>
		<category><![CDATA[update.xml]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=2693</guid>
		<description><![CDATA[Few days ago I red an interesting article about Auto update for Adobe Air executable. This article is pretty self-explanatory, it is important to notice, you have to use ApplicationUpdater instead of ApplicationUpdaterUI that was designed for .air apps. One thing I was missing there was to make the process even more dynamic by reading [...]]]></description>
			<content:encoded><![CDATA[<p>Few days ago I red an interesting article about <a href="http://www.kleptomac.com/auto-update-for-adobe-air-executable-exe.htm/comment-page-1">Auto update for Adobe Air executable</a>. This article is pretty self-explanatory, it is important to notice, you have to use <a href="http://help.adobe.com/cs_CZ/AS3LCR/Flash_10.0/air/update/ApplicationUpdater.html">ApplicationUpdater</a> instead of <a href="http://help.adobe.com/cs_CZ/AS3LCR/Flash_10.0/air/update/ApplicationUpdaterUI.html">ApplicationUpdaterUI</a> that was designed for .air apps. One thing I was missing there was to make the process even more dynamic by reading the update url from an update.xml file. Long story short here is a piece of code doing exact the thing:</p>
<pre class="brush: as3; title: ; notranslate">// var updater:ApplicationUpdater;
var xml:XML = updater.updateDescriptor;
var ns:Namespace = xml.namespace();
var request:URLRequest = new URLRequest(xml.ns::url);
navigateToURL(request);</pre>
<p><span id="more-2693"></span></p>
<p>After wiring it up here is the replacement for onUpdateStatus method from <a href="http://www.kleptomac.com/auto-update-for-adobe-air-executable-exe.htm/comment-page-1">the original article</a>.</p>
<pre class="brush: as3; title: ; notranslate">private function onUpdateStatus(event:StatusUpdateEvent):void
{
	if(!event.available)
		return;

	Alert.show(&quot;An updated version &quot; + event.version + &quot; is available. Do you want to download?&quot;,
		&quot;Update Available&quot;, Alert.YES|Alert.NO, null,
		function(event:CloseEvent):void
		{
			if(event.detail != Alert.YES)
				return;

			var xml:XML = updater.updateDescriptor;
			var ns:Namespace = xml.namespace();
			var request:URLRequest = new URLRequest(xml.ns::url);
			navigateToURL(request);
		});
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2010/12/quick-tip-applicationupdater-for-updating-air-executables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>private setter, public getter</title>
		<link>http://blog.yoz.sk/2009/10/private-setter-public-getter/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=private-setter-public-getter</link>
		<comments>http://blog.yoz.sk/2009/10/private-setter-public-getter/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 13:58:33 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash / Flex]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[getter]]></category>
		<category><![CDATA[namespace]]></category>
		<category><![CDATA[private]]></category>
		<category><![CDATA[public]]></category>
		<category><![CDATA[set]]></category>
		<category><![CDATA[setter]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=26</guid>
		<description><![CDATA[It is possible to make private setter and public getter on actionscript classes. All you need is to use proper namespaces for getter and setter within the class. usage: compilation error:]]></description>
			<content:encoded><![CDATA[<p>It is possible to make private setter and public getter on actionscript classes. All you need is to use proper namespaces for getter and setter within the class.</p>
<p><span id="more-26"></span></p>
<pre class="brush: as3; title: ; notranslate">package
{
    public class GSTest extends Object
    {
        private var _foo:String;

        public function GSTest()
        {
            super();

            // setting value
            private::foo = &quot;bar&quot;;

            // getting value
            trace(public::foo);
        }

        public function get foo():String
        {
             return _foo;
        }

        private function set foo(value:String):void
        {
             _foo = value;
        }
    }
}</pre>
<p>usage:</p>
<pre class="brush: as3; title: ; notranslate">var gsTest:GSTest = new GSTest();
trace(gsTest.foo); // returns &quot;bar&quot;</pre>
<p>compilation error:</p>
<pre class="brush: as3; title: ; notranslate">var gsTest:GSTest = new GSTest();
gsTest.foo = &quot;hallo&quot;;</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2009/10/private-setter-public-getter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

