<?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>Sönke Rohde &#187; AIR</title>
	<atom:link href="http://soenkerohde.com/category/air/feed/" rel="self" type="application/rss+xml" />
	<link>http://soenkerohde.com</link>
	<description>Flash Platform (Flash, Flex, AIR) thoughts and examples</description>
	<lastBuildDate>Wed, 18 Apr 2012 22:45:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>AIR Mobile StageWebView UIComponent</title>
		<link>http://soenkerohde.com/2010/11/air-mobile-stagewebview-uicomponent/</link>
		<comments>http://soenkerohde.com/2010/11/air-mobile-stagewebview-uicomponent/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 16:28:53 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=995</guid>
		<description><![CDATA[<p>When you want to use webkit to display HTML in AIR 2.5 mobile projects you want to use StageWebView. Since StageWebView is a subclass of EventDispatcher you cannot add it to the display chain right away. The API works a bit differently and you need to define a Rectangle as the viewPort. However, I thought it [...]]]></description>
			<content:encoded><![CDATA[<p>When you want to use webkit to display HTML in AIR 2.5 mobile projects you want to use <a href="http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/media/StageWebView.html">StageWebView</a>. Since StageWebView is a subclass of EventDispatcher you cannot add it to the display chain right away. The API works a bit differently and you need to define a Rectangle as the viewPort. However, I thought it would be convenient to have a StageWebView UIComponent so that you can add it to the display chain. It is just a wrapper class which exposes the needed APIs like the <em>text</em> and <em>url</em> setter and the methods <em>show</em>, <em>hide</em> and <em>dispose</em>. Further you can listen for all event listeners which just get cloned and re-dispatched.</p>
<p>Example:<br />
<script src="https://gist.github.com/666366.js?file=StageWebViewUIComponentExampleView.mxml"></script></p>
<p>Source:<br />
<script src="https://gist.github.com/666342.js?file=StageWebViewUIComponent.as"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2010/11/air-mobile-stagewebview-uicomponent/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>How to Skin AIR Mobile ActionBar</title>
		<link>http://soenkerohde.com/2010/11/how-to-skin-air-mobile-actionbar/</link>
		<comments>http://soenkerohde.com/2010/11/how-to-skin-air-mobile-actionbar/#comments</comments>
		<pubDate>Mon, 08 Nov 2010 16:57:36 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=1001</guid>
		<description><![CDATA[<p>It took me a bit to figure out how to skin the ActionBar in a mobile AIR application so here a short tutorial. There are also two small bugs when you want to skin the ActionBar but there are decent workarounds for now.</p>
<p>To apply a custom skin to the ActionBar you first have to define a [...]]]></description>
			<content:encoded><![CDATA[<p>It took me a bit to figure out how to skin the <a href="http://opensource.adobe.com/wiki/display/flexsdk/Mobile+ActionBar">ActionBar</a> in a mobile AIR application so here a short tutorial. There are also two small bugs when you want to skin the ActionBar but there are decent workarounds for now.</p>
<p>To apply a custom skin to the ActionBar you first have to define a skin for the MobileApplication itself.</p>
<p><script src="https://gist.github.com/666983.js?file=ActionBarSkinExample.mxml"></script></p>
<p>In the ApplicationSkin.mxml you have to define a ViewNavigator component with the id <em>navigagor</em>:</p>
<p><script src="https://gist.github.com/666996.js?file=ApplicationSkin.mxml"></script></p>
<p>The ViewNavigatorSkin.mxml contains the push and pop transition, the ActionBar component and the content group.<br />
Due to a small bug in the SlideViewTransition.as you have to set the direction to right on creationComplete:</p>
<p><script src="https://gist.github.com/667083.js?file=ViewNavigatorSkin.mxml"></script></p>
<p>Finally we can create the ActionBarSkin. There is another small bug so for now you have to define an empty Group at the 1st position.</p>
<p><script src="https://gist.github.com/667084.js?file=ActionBarSkin.mxml"></script></p>
<p>So right now you have to create 4 different skins to change the dimensions and look of the ActionBar. From an architectural standpoint this looks very clean but having to create 4 skins to just change the height is kind of overkill.<br />
MobileApplication should expose a style to define the dimensions of the ActionBar and should support to set the <em>actionBarSkin</em> right away.</p>
<p>You can <a href="http://soenkerohde.com/downloads/ActionBarSkinExample.fxp">download the example project here</a>. The example uses compile-time FXG for the ActionBar background. More on that in a later post.</p>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2010/11/how-to-skin-air-mobile-actionbar/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Updating to AIR 2.0 Barriers</title>
		<link>http://soenkerohde.com/2010/06/updating-to-air-2-0-barriers/</link>
		<comments>http://soenkerohde.com/2010/06/updating-to-air-2-0-barriers/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 17:58:48 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=969</guid>
		<description><![CDATA[<p>Now that Adobe 2.0 is released it&#8217;s time to update some older apps to use the new APIs.
The process to update seems kind of complicated and definitely worth a blog post. In my special case I am upgrading from an self signed 1.5.2 app to a self signed 2.0 app.</p>
<p>Since 1.5.3 the publisherID works differently so [...]]]></description>
			<content:encoded><![CDATA[<p>Now that <a href="http://www.adobe.com/products/air/">Adobe 2.0</a> is released it&#8217;s time to update some older apps to use the new APIs.<br />
The process to update seems kind of complicated and definitely worth a blog post. In my special case I am upgrading from an self signed 1.5.2 app to a self signed 2.0 app.</p>
<p>Since <a href="http://www.adobe.com/support/documentation/en/air/1_5_3/releasenotes_developers.html">1.5.3 the publisherID works differently</a> so you have to add the publisherID to the XML descriptor like also <a href="http://gregsramblings.com/2010/06/18/adobe-air-common-auto-upgrade-issues-when-upgrading-your-app-to-air-2-0/#comment-3280">described here</a>. If you are not using EncryptedLocalStore you might be fine by now but otherwise you get this error when you debug the application: <strong>EncryptedLocalStore may not use publisher IDs passed in from ADL</strong></p>
<p>A <a href="http://ebrentnelson.blogspot.com/2009/07/encryptedlocalstore-may-not-use.html">quick search</a> lead me to add the publisherID to the debug configuration but then you get the error that the publisherID can&#8217;t be passed anymore by ADL since 1.5.3, damn.</p>
<p>More research brought me to this <a href="http://groups.google.com/group/air-tight/browse_thread/thread/3c6b425ad17eb4f1/b6a222f8467518b9?show_docid=b6a222f8467518b9">forum thread</a>. So it looks like this bug is in the AIR 2.0 final so the only solution is to remove the publisherID from the descriptor while debugging the application. Before packaging the app you then have to add it to not break the update for your users who still have the older version of your app.</p>
<p>Ok, I removed the publisherID and finally could run my app with AIR 2.0, not! My next runtime exception is <strong>TypeError: Error #1034: Type Coercion failed: cannot convert flashx.textLayout.formats::TextLayoutFormat@184eb041 to flashx.textLayout.formats.TextLayoutFormatValueHolder</strong>.</p>
<p>Solution is to change TextLayoutFormat to TextLayoutFormatValueHolder like here:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> cfg : Configuration = TextFlow.<span style="color: #006600;">defaultConfiguration</span>;
<span style="color: #000000; font-weight: bold;">var</span> normalTLF : TextLayoutFormat = <span style="color: #000000; font-weight: bold;">new</span> TextLayoutFormat<span style="color: #66cc66;">&#40;</span> cfg.<span style="color: #006600;">defaultLinkNormalFormat</span> <span style="color: #66cc66;">&#41;</span>;
cfg.<span style="color: #006600;">defaultLinkNormalFormat</span> = normalTLF;</pre></div></div>

<p>to</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> normalTLF : TextLayoutFormatValueHolder = <span style="color: #000000; font-weight: bold;">new</span> TextLayoutFormatValueHolder<span style="color: #66cc66;">&#40;</span> cfg.<span style="color: #006600;">defaultLinkNormalFormat</span> <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Now I can finally run the app with AIR 2.0 without any runtime exceptions or other errors, uhh!<br />
The TextArea default height seems to have changed though but that&#8217;s for another time.</p>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2010/06/updating-to-air-2-0-barriers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Twitter AS3 OAuth Lib with Flex 4 example</title>
		<link>http://soenkerohde.com/2010/01/twitter-as3-oauth-lib-with-flex-4-example/</link>
		<comments>http://soenkerohde.com/2010/01/twitter-as3-oauth-lib-with-flex-4-example/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 12:30:30 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=813</guid>
		<description><![CDATA[<p>I have build a little Twitter AS3 library which handles Twitter OAuth authentication and let&#8217;s you update your Twitter status. The lib basically uses the OAuth AS3 lib and should be a good example how to use the actual OAuth lib.</p>
<p>This is still basic functionality but since it&#8217;s open source someone may fork and extend it. [...]]]></description>
			<content:encoded><![CDATA[<p>I have build a little <a href="http://github.com/srohde/Twitter">Twitter AS3 library</a> which handles <a href="http://apiwiki.twitter.com/OAuth-FAQ">Twitter OAuth authentication</a> and let&#8217;s you update your Twitter status. The lib basically uses the <a href="http://code.google.com/p/oauth-as3/">OAuth AS3 lib</a> and should be a good example how to use the actual OAuth lib.</p>
<p>This is still basic functionality but since it&#8217;s open source someone may fork and extend it. To get a simple idea of the current feature-set have a look at the <a href="http://github.com/srohde/Twitter/blob/master/src/com/soenkerohde/twitter/ITwitter.as">ITwitter interface</a>.</p>
<p>Further I have build a simple <a href="http://gist.github.com/266163">Flex 4 example AIR app</a> which shows things in action. The only thing you need to do upfront is <a href="http://twitter.com/apps">registering a Twitter app</a> to obtain an OAuth consumer key and secret which you have to add to the example:</p>
<p><script src="http://gist.github.com/266163.js?file=TwitterExample"></script></p>
<p>BTW: You maybe have already granted access to your Twitter account for some apps which you can <a href="http://twitter.com/account/connections">check here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2010/01/twitter-as3-oauth-lib-with-flex-4-example/feed/</wfw:commentRss>
		<slash:comments>47</slash:comments>
		</item>
		<item>
		<title>Swiz Desktop for AIR support</title>
		<link>http://soenkerohde.com/2009/11/swiz-desktop-for-air-support/</link>
		<comments>http://soenkerohde.com/2009/11/swiz-desktop-for-air-support/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 13:33:31 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Swiz]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=265</guid>
		<description><![CDATA[<p>When you develop AIR applications you see repeating tasks which you have in all projects. You need to take care about the update process and online status. I am developing all my applications with the Swiz framework so I tried to come up with some re-usable code which fits nicely into Swiz.</p>
<p>Source and Download</p>

Get source from [...]]]></description>
			<content:encoded><![CDATA[<p>When you develop AIR applications you see repeating tasks which you have in all projects. You need to take care about the update process and online status. I am developing all my applications with the <a href="http://swizframework.org">Swiz framework</a> so I tried to come up with some re-usable code which fits nicely into Swiz.</p>
<p><b>Source and Download</b></p>
<ul>
<li><a href="http://github.com/srohde/swizdesktop">Get source from GitHub</a></li>
<li><a href="http://github.com/srohde/swizdesktop/downloads">Download Flex 4 SWC from GitHub</a></li>
<li><a href="http://srohde.github.com/swizdesktop/">API Documentation</a></li>
<li>Swiz Desktop includes <a href="http://codeazur.com.br/lab/airremoteupdater/">côdeazur AIR Remote Updater</a></li>
</ul>
<p><b>Define the SwizUpdateBean in your Swiz BeanLoader:</b></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;desktop:SwizUpdateBean</span> <span style="color: #000066;">xmlns:desktop</span>=<span style="color: #ff0000;">&quot;com.soenkerohde.desktop.*&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;swizUpdateBean&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">updateUrl</span>=<span style="color: #ff0000;">&quot;http://yourdomain.com/YourApp.air&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">autoCheckUpdate</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">autoStartUpdate</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>We have set the update URL and the flag to automatically check for an update and automatically download and invoke the update when a newer version is online.<br />
However you may only want to use this in a very early stage of your development to simply ensure that the user always get&#8217;s the latest version. The user experience is a bit odd though since the user get&#8217;s no visual feedback at all and might be upset when the app closes, updates and restarts itself.</p>
<p><b>Control Update</b><br />
A controller can add event listeners to the SwizUpdateBean to get notified when the update phase change so you get a point to interact. You can autowire the bean also against a setter which gives you the possibility to add event listeners:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">soenkerohde</span>.<span style="color: #006600;">example</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">soenkerohde</span>.<span style="color: #006600;">example</span>.<span style="color: #006600;">UpdateWindow</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">soenkerohde</span>.<span style="color: #006600;">desktop</span>.<span style="color: #006600;">ISwizUpdateBean</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">soenkerohde</span>.<span style="color: #006600;">desktop</span>.<span style="color: #006600;">event</span>.<span style="color: #006600;">OnlineEvent</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">soenkerohde</span>.<span style="color: #006600;">desktop</span>.<span style="color: #006600;">event</span>.<span style="color: #006600;">UpdateEvent</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">swizframework</span>.<span style="color: #006600;">Swiz</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> spark.<span style="color: #006600;">components</span>.<span style="color: #006600;">Window</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> UpdateController <span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Autowire<span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> updateBean<span style="color: #66cc66;">&#40;</span> bean : ISwizUpdateBean <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			bean.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> UpdateEvent.<span style="color: #006600;">VERSION_INFO</span>, versionInfoHandler, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
			bean.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> UpdateEvent.<span style="color: #006600;">UPDATE</span>, updateHandler, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
			bean.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> OnlineEvent.<span style="color: #006600;">CHANGE</span>, onlineHandler, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		protected <span style="color: #000000; font-weight: bold;">function</span> versionInfoHandler<span style="color: #66cc66;">&#40;</span> event : UpdateEvent <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// when locale and remote version are different show update window</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> event.<span style="color: #006600;">updateInfo</span>.<span style="color: #006600;">localVersion</span> <span style="color: #66cc66;">!</span>= event.<span style="color: #006600;">updateInfo</span>.<span style="color: #006600;">remoteVersion</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> updateWindow:Window = <span style="color: #000000; font-weight: bold;">new</span> UpdateWindow<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				Swiz.<span style="color: #006600;">registerWindow</span><span style="color: #66cc66;">&#40;</span> updateWindow <span style="color: #66cc66;">&#41;</span>;
				updateWindow.<span style="color: #006600;">open</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				updateWindow.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">50</span>, <span style="color: #cc66cc;">50</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		protected <span style="color: #000000; font-weight: bold;">function</span> updateHandler<span style="color: #66cc66;">&#40;</span> event : UpdateEvent <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// prevent automatic update and wait for user to invoke</span>
			event.<span style="color: #006600;">preventDefault</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		protected <span style="color: #000000; font-weight: bold;">function</span> onlineHandler<span style="color: #66cc66;">&#40;</span> event : OnlineEvent <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> online:<span style="color: #0066CC;">Boolean</span> = event.<span style="color: #006600;">online</span>;
			<span style="color: #808080; font-style: italic;">// TODO handle online status</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><b>Visual Feedback</b><br />
Since the SwizUpdateBean is loaded in the BeanLoader we can autowire it into any view. The SwizUpdateBean implements the ISwizUpdateBean so we can autowire the interface by type without caring about the id. The ISwizUpdateBean has a getter for updateInfo which is a bindable getter for detailed update status information. In the example below we autowire it by property. We could also access it from the swizUpdateBean.updateInfo but I like it more as an extra member variable.</p>
<p>UpdateInfo gives you access to:</p>
<ul>
<li>localVersion</li>
<li>remoteVersion</li>
<li>percent</li>
<li>bytesLoaded</li>
<li>bytesTotal</li>
<li>kiloBytePerSecond (we calculate the connection speed of the user)</li>
<li>timeRemaing (the time in seconds we have calculated remains to download the update)</li>
<li>updateFilePath (the path to the downloaded update file)</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>s:Window <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;240&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;210&quot;</span>
		  xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span>
		  xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span> title=<span style="color: #ff0000;">&quot;Update&quot;</span> alwaysInFront=<span style="color: #ff0000;">&quot;true&quot;</span> resizable=<span style="color: #ff0000;">&quot;false&quot;</span> showStatusBar=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>s:layout<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>s:BasicLayout <span style="color: #66cc66;">/&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>s:layout<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>fx:Script<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
			<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;
			<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">soenkerohde</span>.<span style="color: #006600;">desktop</span>.<span style="color: #006600;">ISwizUpdateBean</span>;
			<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">soenkerohde</span>.<span style="color: #006600;">desktop</span>.<span style="color: #006600;">info</span>.<span style="color: #006600;">IUpdateInfo</span>;
&nbsp;
			<span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
			<span style="color: #66cc66;">&#91;</span>Autowire<span style="color: #66cc66;">&#40;</span>bean=<span style="color: #ff0000;">&quot;swizUpdateBean&quot;</span>, property=<span style="color: #ff0000;">&quot;updateInfo&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
			<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> updateInfo:IUpdateInfo;
&nbsp;
			<span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
			<span style="color: #66cc66;">&#91;</span>Autowire<span style="color: #66cc66;">&#93;</span>
			<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> swizUpdateBean:ISwizUpdateBean;
&nbsp;
			protected <span style="color: #000000; font-weight: bold;">function</span> clickHandler<span style="color: #66cc66;">&#40;</span> event : MouseEvent <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
				swizUpdateBean.<span style="color: #006600;">executeUpdate</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>fx:Script<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>s:VGroup horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:Form verticalGap=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>mx:FormItem label=<span style="color: #ff0000;">&quot;Your Version:&quot;</span><span style="color: #66cc66;">&gt;</span>
				<span style="color: #66cc66;">&lt;</span>s:Label <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{updateInfo.localVersion}&quot;</span> <span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;/</span>mx:FormItem<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>mx:FormItem label=<span style="color: #ff0000;">&quot;New Version:&quot;</span><span style="color: #66cc66;">&gt;</span>
				<span style="color: #66cc66;">&lt;</span>s:Label <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{updateInfo.remoteVersion}&quot;</span> <span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;/</span>mx:FormItem<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>mx:Form<span style="color: #66cc66;">&gt;</span>
&nbsp;
		<span style="color: #66cc66;">&lt;</span>s:Label <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Progress: {updateInfo.bytesLoaded}/{updateInfo.bytesTotal} Bytes&quot;</span> <span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:ProgressBar indeterminate=<span style="color: #ff0000;">&quot;false&quot;</span> label=<span style="color: #ff0000;">&quot;Remaining: {updateInfo.timeRemaining} sec with {updateInfo.kiloBytePerSecond} KB/s&quot;</span> mode=<span style="color: #ff0000;">&quot;polled&quot;</span>
						source=<span style="color: #ff0000;">&quot;{updateInfo}&quot;</span> <span style="color: #66cc66;">/&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;/</span>s:VGroup<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>s:<span style="color: #0066CC;">Button</span> bottom=<span style="color: #ff0000;">&quot;10&quot;</span>
			  horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> label=<span style="color: #ff0000;">&quot;Update and Restart&quot;</span> <span style="color: #0066CC;">enabled</span>=<span style="color: #ff0000;">&quot;{updateInfo.complete}&quot;</span> click=<span style="color: #ff0000;">&quot;clickHandler(event)&quot;</span> <span style="color: #66cc66;">/&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;/</span>s:Window<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>You see how easy it is to implement the ProgressBar. Because the updateInfo object has a getter for bytesLoaded and bytesTotal we only have to set the mode to &#8220;polled&#8221; and can set the object itself as the source of the ProgressBar.</p>
<p>Feedback appreciated or just fork the project on GitHub if you want to extend it.</p>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2009/11/swiz-desktop-for-air-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlairLoc Public Beta</title>
		<link>http://soenkerohde.com/2009/11/flairloc-public-beta/</link>
		<comments>http://soenkerohde.com/2009/11/flairloc-public-beta/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 09:58:24 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[RIA]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=722</guid>
		<description><![CDATA[<p>FlairLoc is an Adobe® AIR™ application to localize Adobe® Flex® applications.</p>
<p>Today I am happy to announce that the public beta of FlairLoc is available.</p>
<p>Features</p>

Change resources in a user interface with search capability
Extract resource keys from source code and synchronizes it with all locale sets
Automatic translation into 42 languages with the Google Translate API
Add new automatic translated [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://flairloc.com">FlairLoc</a> is an Adobe® AIR™ application to localize Adobe® Flex® applications.</p>
<p>Today I am happy to announce that the public beta of FlairLoc is available.</p>
<p><strong>Features</strong></p>
<ul>
<li>Change resources in a user interface with search capability</li>
<li>Extract resource keys from source code and synchronizes it with all locale sets</li>
<li>Automatic translation into 42 languages with the Google Translate API</li>
<li>Add new automatic translated languages in only <strong>4 CLICKS</strong></li>
<li>Generation of locale compile statement and Ant parameters</li>
</ul>
<p>For more information, screenvideo and screenshots and to install the application please visit the <a href="http://flairloc.com">product page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2009/11/flairloc-public-beta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YouTube AS3 example</title>
		<link>http://soenkerohde.com/2009/10/youtube-as3-example/</link>
		<comments>http://soenkerohde.com/2009/10/youtube-as3-example/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 16:16:53 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Swiz]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=661</guid>
		<description><![CDATA[<p>Today YouTube finally released an ActionScript 3 API. Maybe this was accelerated by the move of Vimeo because they came up with an AS3 API last week.</p>
<p>I have build a little AIR client as an example application. Check my YouTubeAS3 project on github for the source code. The example of course uses the Swiz framework.</p>
<p>The meat [...]]]></description>
			<content:encoded><![CDATA[<p>Today <a href="http://youtube.com">YouTube</a> finally released an <a href="http://code.google.com/apis/youtube/flash_api_reference.html">ActionScript 3 API</a>. Maybe this was accelerated by the move of <a href="http://vimeo.com">Vimeo</a> because they came up with an <a href="http://vimeo.com/api/docs/advanced-api">AS3 API</a> last week.</p>
<p>I have build a little AIR client as an example application. Check my <a href="http://github.com/srohde/YouTubeAS3/">YouTubeAS3 project on github</a> for the source code. The example of course uses the <a href="http://swizframework.org/">Swiz framework</a>.</p>
<p>The meat is the <a href="http://github.com/srohde/YouTubeAS3/blob/master/src/com/soenkerohde/youtube/Player.as">Player class</a> and the <a href="http://github.com/srohde/YouTubeAS3/blob/master/src/com/soenkerohde/youtube/IPlayer.as">IPlayer interface</a> which wraps the YouTube proxy object. The Player extends UIComponent and implements IVisualElement so it works decent with <a href="opensource.adobe.com/wiki/display/flexsdk">Flex 4</a>. The original SWFProxy object extends Sprite which is fine for Flash but not for Flex.</p>
<p>If you are to lazy to study the API docs like me this screenshot might help:</p>
<div class="thumbnail"><a href="http://skitch.com/soenkerohde/ndejy/flash-debug-eclipse-users-soenkerohde-documents-workspace-gumbo"><img src="http://img.skitch.com/20091015-5cty54gbdn59eq7ergkrwsx2n.preview.jpg" alt="Flash Debug - Eclipse - /Users/soenkerohde/Documents/workspace_gumbo" /></a><br />
<span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>&#8216;s <a href="http://skitch.com">Skitch</a>!</span></div>
<p>The example is still pretty small but I&#8217;ll try to extend it when I find some time in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2009/10/youtube-as3-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>High level AS3/Flex library for OAuth with Twitter from AIR</title>
		<link>http://soenkerohde.com/2009/07/high-level-as3flex-library-for-oauth-with-twitter-from-air/</link>
		<comments>http://soenkerohde.com/2009/07/high-level-as3flex-library-for-oauth-with-twitter-from-air/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 09:22:03 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=552</guid>
		<description><![CDATA[<p>Recently I have played again with the Twitter API and finally have OAuth working. When I have first played with the Twitter API I have used the example from Tour de Flex. The example loads up the friends list and uses the Twitter AS3 API. The API is not really my taste but offers the functionality [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have played again with the Twitter API and finally have <a href="http://oauth.net/">OAuth</a> working. When I have first played with the Twitter API I have used the example from <a href="http://www.adobe.com/devnet/flex/tourdeflex/">Tour de Flex</a>. The example loads up the friends list and uses the <a href="http://code.google.com/p/twitterscript/">Twitter AS3 API</a>. The API is not really my taste but offers the functionality to build a Twitter client application. However when you want to have your client application to show up as the <a href="http://apiwiki.twitter.com/FAQ#HowdoIget“fromMyApp”appendedtoupdatessentfrommyAPIapplication">source of tweets</a> you have to use OAuth for user authentication. It adds another step to get started but is a good decision to force developers to use OAuth which should provide more trust into the client app because users don&#8217;t like to enter their Twitter credentials into a 3rd party application.</p>
<p>After a bit of research a came across the awesome open source library <a href="http://www.iotashan.com/index.php/2008/04/28/oauth-actionscript-library/">oauth-as3</a>. There were no examples yet but I remembered an Email from my friend <a href="http://twitter.com/cwahlers">Claus</a> with a link to this <a href="http://github.com/sekimura/as3-misc/tree/cfc912d3ba6769125e953cba5d2eaa51e338a9eb/twitter-oauth">github project</a>. The example application uses the oauth-as3 library and demonstrates how to integrate the library.</p>
<p>To use OAuth in your Twitter application you need a consumerKey and consumerSecret which you can get after the registration of your client app: <a href="http://twitter.com/oauth_clients/">http://twitter.com/oauth_clients/</a> or go to your settings and select the &#8220;Connections&#8221; tab for an overview and further links.<br />
However, the github example doesn&#8217;t work anymore because Twitter changed their API recently and implemented a PIN mechanism for desktop cients which should provide even more security.</p>
<p>So how does it work?</p>
<ol>
<li>Get the request token with your consumerKey/Secret</li>
<li>Open the browser and pass the request token</li>
<li>User authenticates on the Twitter site and gets a 6 digit pin code</li>
<li>User enters pin code in the AIR app which you need to get the access token</li>
<li>Save the accessKey/Secret in the EncryptedLocaleStorage for all further requests/sessions</li>
</ol>
<p>I have build a <a href="http://github.com/srohde/OAuth/tree/master">high level AS3/Flex library for OAuth</a> which is hosted on github. The library is licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License, Version 2.0</a>.<br />
Check the inline comments of the <a href="http://github.com/srohde/OAuth/blob/3e97944b356b6d45aeedb3db334360d67e44c844/src/org/flaircode/oauth/IOAuth.as">IOAuth interface</a> which should already explain the basics.</p>
<p>Here a little semi pseudo code example:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// create OAuth</span>
oauth:IOAuth = <span style="color: #000000; font-weight: bold;">new</span> OAUth<span style="color: #66cc66;">&#40;</span>consumerKey, consumerSecret<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// get request token</span>
<span style="color: #000000; font-weight: bold;">var</span> loader:URLLoader = oauth.<span style="color: #006600;">getRequestToken</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;http://twitter.com/oauth/request_token&quot;</span><span style="color: #66cc66;">&#41;</span>;
loader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, requestTokenHandler<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> requestTokenHandler<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	requestToken = OAuthUtil.<span style="color: #006600;">getTokenFromResponse</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>.<span style="color: #006600;">currentTarget</span>.<span style="color: #0066CC;">data</span> as <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> request:URLRequest = oauth.<span style="color: #006600;">getAuthorizeRequest</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;http://twitter.com/oauth/authorize&quot;</span>, requestToken.<span style="color: #0066CC;">key</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #808080; font-style: italic;">// opens website where user has to login on Twitter and gets 6 digit pin code</span>
	navigateToURL<span style="color: #66cc66;">&#40;</span>request, <span style="color: #ff0000;">&quot;_blank&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> getAccessToken<span style="color: #66cc66;">&#40;</span>pin:<span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> loader:URLLoader = oauth.<span style="color: #006600;">getAccessToken</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;http://twitter.com/oauth/access_token&quot;</span>, requestToken, <span style="color: #66cc66;">&#123;</span>oauth_verifier:pin<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
	loader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, accessTokenHandler<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> accessTokenHandler<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	accessToken = OAuthUtil.<span style="color: #006600;">getTokenFromResponse</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>.<span style="color: #006600;">currentTarget</span>.<span style="color: #0066CC;">data</span> as <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #808080; font-style: italic;">// TODO store accessToken.key and accessToken.secret in EncryptedLocalStorage for all further requests</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Instead of opening the Twitter authorization page in the browser the library also contains OAuthLoader which is a wrapper around HTMLLoader which enables to directly show the authorization page within an AIR window:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// use this in the requestTokenHandler instead of navigateToURL</span>
<span style="color: #000000; font-weight: bold;">var</span> loader:OAuthLoader = <span style="color: #000000; font-weight: bold;">new</span> OAuthLoader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
loader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span>request<span style="color: #66cc66;">&#41;</span>;
loader.<span style="color: #006600;">percentWidth</span> = <span style="color: #cc66cc;">100</span>;
loader.<span style="color: #006600;">percentHeight</span> = <span style="color: #cc66cc;">100</span>;
<span style="color: #000000; font-weight: bold;">var</span> w:Window = <span style="color: #000000; font-weight: bold;">new</span> Window<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
w.<span style="color: #0066CC;">width</span> = <span style="color: #cc66cc;">800</span>;
w.<span style="color: #0066CC;">height</span> = <span style="color: #cc66cc;">400</span>;
w.<span style="color: #006600;">title</span> = req.<span style="color: #0066CC;">url</span>;
w.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>loader<span style="color: #66cc66;">&#41;</span>;
w.<span style="color: #006600;">open</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The OAuth library is not only considered to be used with Twitter but this was the first thing I have tested from AIR. When you build a web client there will be no pin mechanism but I haven&#8217;t tested this yet. If you have it working or see problems/bugs for web clients please drop a comment a or better <a href="http://github.com/srohde/OAuth/issues">file a bug</a>.</p>
<p>Big thanks to <a href="http://www.iotashan.com">Shannon Hicks</a> for his <a href="http://www.iotashan.com/index.php/2008/04/28/oauth-actionscript-library/">core oauth as3 library</a> and to Masayoshi Sekimura for the <a href="http://github.com/sekimura/as3-misc/tree/cfc912d3ba6769125e953cba5d2eaa51e338a9eb/twitter-oauth">example</a> which got me started.</p>
<p><strong>Links</strong></p>
<ul>
<li><a href="http://github.com/srohde/OAuth/tree/master">High level AS3/Flex library for OAuth</a></li>
<li><a href="http://code.google.com/p/oauth-as3/">Core oauth-as3 library</a></li>
<li><a href="http://oauth.net/">OAuth</a></li>
<li><a href="http://apiwiki.twitter.com/OAuth-FAQ">Twitter OAuth FAQ</a></li>
<li><a href="http://apiwiki.twitter.com/Twitter-API-Documentation">Twitter API Documentation</a></li>
<li><a href="http://www.hueniverse.com/hueniverse/2007/10/beginners-gui-1.html">Getting Started with OAuth</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2009/07/high-level-as3flex-library-for-oauth-with-twitter-from-air/feed/</wfw:commentRss>
		<slash:comments>61</slash:comments>
		</item>
		<item>
		<title>Swiz Unit Tests with FlexUnit 4</title>
		<link>http://soenkerohde.com/2009/05/swiz-unit-tests-with-flexunit-4/</link>
		<comments>http://soenkerohde.com/2009/05/swiz-unit-tests-with-flexunit-4/#comments</comments>
		<pubDate>Tue, 26 May 2009 20:14:02 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Swiz]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=478</guid>
		<description><![CDATA[<p>Recently FlexUnit 4 beta 1 was released. To get started I recommend FlexUnit 4 in 360 seconds and the feature overview. If you are using the Swiz framework and want to apply some changes to provide a patch file you could run the unit tests to be sure to break no features.</p>
<p>This is quite easy to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently <a href="http://opensource.adobe.com/wiki/display/flexunit/Downloads">FlexUnit 4 beta 1</a> was released. To get started I recommend <a href="http://blogs.digitalprimates.net/codeSlinger/index.cfm/2009/5/3/FlexUnit-4-in-360-seconds">FlexUnit 4 in 360 seconds</a> and the <a href="http://opensource.adobe.com/wiki/display/flexunit/FlexUnit+4+feature+overview">feature overview</a>. If you are using the <a href="http://swizframework.org/">Swiz framework</a> and want to apply some changes to provide a patch file you could run the unit tests to be sure to break no features.</p>
<p>This is quite easy to do with the following steps:</p>
<ul>
<li>Create a new Flex AIR project: SwizTestRunner</li>
<li><a href="http://opensource.adobe.com/wiki/display/flexunit/Downloads">Download latest FlexUnit 4</a> and copy the SWCs into the SwizTestRunner libs directory</li>
<li>Add the Swiz test class path: /../Swiz/src/test/flex</li>
<li>Add your compiled Swiz.swc as a library</li>
<li>Copy-n-paste the following into the SwizTestRunner.mxml</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:WindowedApplication xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span>
	applicationComplete=<span style="color: #ff0000;">&quot;applicationCompleteHandler()&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;1200&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;640&quot;</span>
	xmlns:flexUnitUIRunner=<span style="color: #ff0000;">&quot;http://www.adobe.com/2009/flexUnitUIRunner&quot;</span><span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
			<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">swizframework</span>.<span style="color: #006600;">service</span>.<span style="color: #006600;">ServiceTestSuite</span>;
			<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">swizframework</span>.<span style="color: #006600;">autowire</span>.<span style="color: #006600;">AutowireTestSuite</span>;
			<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">swizframework</span>.<span style="color: #006600;">factory</span>.<span style="color: #006600;">FactoryTestSuite</span>;
			<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">swizframework</span>.<span style="color: #006600;">util</span>.<span style="color: #006600;">ExpressionTestSuite</span>;
			<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">flexunit</span>.<span style="color: #006600;">listeners</span>.<span style="color: #006600;">UIListener</span>;
			<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">flexunit</span>.<span style="color: #006600;">runner</span>.<span style="color: #006600;">FlexUnitCore</span>;
&nbsp;
			<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> core:FlexUnitCore;
&nbsp;
			<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> applicationCompleteHandler<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
			<span style="color: #66cc66;">&#123;</span>
				core = <span style="color: #000000; font-weight: bold;">new</span> FlexUnitCore<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				core.<span style="color: #0066CC;">addListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> UIListener<span style="color: #66cc66;">&#40;</span>uiListener<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
				core.<span style="color: #006600;">run</span><span style="color: #66cc66;">&#40;</span>AutowireTestSuite, ServiceTestSuite, ExpressionTestSuite, FactoryTestSuite<span style="color: #66cc66;">&#41;</span>;
				move<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span>, <span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>mx:TraceTarget fieldSeparator=<span style="color: #ff0000;">&quot;-&gt;&quot;</span> includeCategory=<span style="color: #ff0000;">&quot;true&quot;</span> includeTime=<span style="color: #ff0000;">&quot;true&quot;</span> includeLevel=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #66cc66;">/&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>flexUnitUIRunner:TestRunnerBase id=<span style="color: #ff0000;">&quot;uiListener&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #66cc66;">/&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;/</span>mx:WindowedApplication<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>Now you can run the application and you should see the unit tests being executed:</p>
<div class="thumbnail"><a href="http://skitch.com/soenkerohde/btaqt/swiztestrunner"><img src="http://img.skitch.com/20090526-ra9xcphjjsj88uy3sca8xpxbrr.preview.jpg" alt="SwizTestRunner" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>&#8216;s <a href="http://skitch.com">Skitch</a>!</span></div>
<p>To get started just have a look at the Swiz unit tests we have build so far. FlexUnit 4 is metadata driven so you should feel home when you use Swiz. We are continually extending our unit test suites but if you find a bug and can prove it with a failed test case you have provided this would be pretty awesome!</p>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2009/05/swiz-unit-tests-with-flexunit-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlairSkin &#8211; Stateless Skinning for Flex</title>
		<link>http://soenkerohde.com/2009/05/flairskin-stateless-skinning-for-flex/</link>
		<comments>http://soenkerohde.com/2009/05/flairskin-stateless-skinning-for-flex/#comments</comments>
		<pubDate>Tue, 05 May 2009 14:27:53 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=325</guid>
		<description><![CDATA[<p>For Flex skinning I have usually used Flash with the Flex skinning extension. This is called the stateful approach because you can also add transitions between the states. This worked out fine and the workflow was ok and you ended up in Flex to define the skin via CSS like this:</p>

.myButton&#123;
	skin: ClassReference&#40;&#34;MyButton_skin&#34;&#41;;
&#125;

<p>You may have followed the [...]]]></description>
			<content:encoded><![CDATA[<p>For Flex skinning I have usually used Flash with the Flex skinning extension. This is called the stateful approach because you can also add transitions between the states. This worked out fine and the workflow was ok and you ended up in Flex to define the skin via CSS like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">.<span style="color: #006600;">myButton</span><span style="color: #66cc66;">&#123;</span>
	skin: ClassReference<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;MyButton_skin&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>You may have followed <a href="http://behindtheui.blogspot.com/2009/03/flex-component-kit-cpu-black-hole.html">the</a> <a href="http://patrickhansen.com/blog/index.php/2009/03/05/flex-stateful-skins-vs-stateless?blog=3">discussion</a> in March that this approach is CPU intensive because the Button subclasses mx.flash.UIMovieClip which has an enterFrame event listener which decreases the performance of your application.<br />
Bam! What? So the apps I have written in the past could be faster if I would avoid Flash for Flex skinning? Damn! I first tried to use another base class like explained <a href="http://gmalartre.blogspot.com/2009/03/cleaner-solution-to-uimovieclip-bad.html">here</a>. However this did not change much so I decided to switch over to stateless skins because they are <a href="http://patrickhansen.com/blog/index.php/2009/03/25/stateful-vs-stateless-now-vs-degrafa?blog=3">obviously the fastest solution</a>.</p>
<p>Ok, the app I wanted to refactor had about 15 different buttons and a bunch of other skinned components and almost all need a <a href="http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&#038;file=00000976.html">scale-9 grid</a> to resize decently. Scale-9 grid is easy to define in Flash because you get kind of rulers which you can drag to the right position. For stateless skins you have to define them by setting the numeric value for scaleGridTop, scaleGridBottom, scaleGridLeft and scaleGridRight so you end up with an Embed directive for a toggle button like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">.<span style="color: #006600;">myButton</span> <span style="color: #66cc66;">&#123;</span>
	up-skin: Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">'/../assets/default_up.png'</span>, scaleGridLeft=<span style="color: #ff0000;">'15'</span>, scaleGridRight=<span style="color: #ff0000;">'134'</span>, scaleGridTop=<span style="color: #ff0000;">'15'</span>, scaleGridBottom=<span style="color: #ff0000;">'43'</span><span style="color: #66cc66;">&#41;</span>;
	over-skin: Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">'/../assets/default_over.png'</span>, scaleGridLeft=<span style="color: #ff0000;">'15'</span>, scaleGridRight=<span style="color: #ff0000;">'134'</span>, scaleGridTop=<span style="color: #ff0000;">'15'</span>, scaleGridBottom=<span style="color: #ff0000;">'43'</span><span style="color: #66cc66;">&#41;</span>;
	down-skin: Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">'/../assets/default_down.png'</span>, scaleGridLeft=<span style="color: #ff0000;">'15'</span>, scaleGridRight=<span style="color: #ff0000;">'134'</span>, scaleGridTop=<span style="color: #ff0000;">'15'</span>, scaleGridBottom=<span style="color: #ff0000;">'43'</span><span style="color: #66cc66;">&#41;</span>;
	disabled-skin: Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">'/../assets/default_disabled.png'</span>, scaleGridLeft=<span style="color: #ff0000;">'15'</span>, scaleGridRight=<span style="color: #ff0000;">'134'</span>, scaleGridTop=<span style="color: #ff0000;">'15'</span>, scaleGridBottom=<span style="color: #ff0000;">'43'</span><span style="color: #66cc66;">&#41;</span>;
	selected-up-skin: Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">'/../assets/default_selected_up.png'</span>, scaleGridLeft=<span style="color: #ff0000;">'15'</span>, scaleGridRight=<span style="color: #ff0000;">'134'</span>, scaleGridTop=<span style="color: #ff0000;">'15'</span>, scaleGridBottom=<span style="color: #ff0000;">'43'</span><span style="color: #66cc66;">&#41;</span>;
	selected-over-skin: Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">'/../assets/default_selected_over.png'</span>, scaleGridLeft=<span style="color: #ff0000;">'15'</span>, scaleGridRight=<span style="color: #ff0000;">'134'</span>, scaleGridTop=<span style="color: #ff0000;">'15'</span>, scaleGridBottom=<span style="color: #ff0000;">'43'</span><span style="color: #66cc66;">&#41;</span>;
	selected-down-skin: Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">'/../assets/default_selected_down.png'</span>, scaleGridLeft=<span style="color: #ff0000;">'15'</span>, scaleGridRight=<span style="color: #ff0000;">'134'</span>, scaleGridTop=<span style="color: #ff0000;">'15'</span>, scaleGridBottom=<span style="color: #ff0000;">'43'</span><span style="color: #66cc66;">&#41;</span>;
	selected-disabled-skin: Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">'/../assets/default_selected_disabled.png'</span>, scaleGridLeft=<span style="color: #ff0000;">'15'</span>, scaleGridRight=<span style="color: #ff0000;">'134'</span>, scaleGridTop=<span style="color: #ff0000;">'15'</span>, scaleGridBottom=<span style="color: #ff0000;">'43'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Yeah, this look looks like a hell of fun to measure and write! <b>Not!</b></p>
<p>So long story short, this is where FlairSkin comes into play.<br />
FlairSkin is a little pet project I have been working on in my spare time to create stateless Flex skins in a more decent way. This is the first release so expect new features soon. Besides generating embed directives I also implemented a little font browser which also outputs the CSS needed by Flex.<br />
Thanks to <a href="http://twitter.com/inarator">Inara</a> for the logo and design!</p>
<p>Install it here:<br />
<div id="flashcontent1533" style="width:215px; height:180px;"><strong>Please upgrade your Flash Player</strong> This is the content that would be shown if the user does not have Flash Player 9.0.115 or higher installed.</div><script type="text/javascript">
<!-- // <![CDATA[
var so = new SWFObject("http://soenkerohde.com/wp-content/plugins/air-badge/AIRInstallBadge.swf", "Badge", "215", "180", "9.0.115", "#FFFFFF");
so.useExpressInstall("http://soenkerohde.com/wp-content/plugins/air-badge/expressinstall.swf");
so.addVariable("airversion", "1.0");
so.addVariable("appname", "FlairSkin");
so.addVariable("appurl", "http://flairskin.com/FlairSkin.air");
so.addVariable("appid", "FlairSkin");
so.addVariable("pubid", "");
so.addVariable("appversion", "1.5.1");
so.addVariable("imageurl", "http://flairskin.com/blog.png");
so.addVariable("appinstallarg", "installed from web");
so.addVariable("applauncharg", "launched from web");
so.addVariable("helpurl", "help.html");
so.addVariable("hidehelp", "true");
so.addVariable("skiptransition", "false");
so.addVariable("titlecolor", "#00AAFF");
so.addVariable("buttonlabelcolor", "#00AAFF");
so.addVariable("appnamecolor", "#00AAFF");
so.addVariable("str_err_airswf", "<u>Running locally?</u><br/><br/>The AIR proxy swf won't load properly when this is run from the local file system.");
so.write("flashcontent1533");
// ]]&gt; -->
</script>
</p>
<p>Screenshots:</p>
<p><img src="http://soenkerohde.com/img/FlairSkin-20090505-111330.png" /></p>
<p><img src="http://soenkerohde.com/img/FlairSkin-20090505-111712.png" /></p>
<p><img src="http://soenkerohde.com/img/FlairSkin-20090505-111246.png" /></p>
<p>Watch a screen video here:<br />
<object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4484078&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=4484078&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object>
<p><a href="http://vimeo.com/4484078">FlairSkin</a> from <a href="http://vimeo.com/user1703121">Sönke Rohde</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>After refactoring my app to stateless skins with FlairSkin the performance improvement was very significant so bye bye Flash for Flex skinning at least for now!<br />
One thing I am missing though is that in Flash I can define the registration point meaning around which point a graphic would rotate. In Flash you can simply move the graphic to the right position and I think there is no way to do this with stateless skins so you need to calculate it programatically which can be a pain. So it would be nice if the Embed metadata would support something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">&quot;foo.png&quot;</span> centerX=<span style="color: #ff0000;">&quot;20&quot;</span> centerY=<span style="color: #ff0000;">&quot;10&quot;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p> where default would be 0,0</p>
<p><b>Additional Links</b></p>
<ul>
<li><a href="http://opensource.adobe.com/wiki/display/flexsdk/Scale9+in+FXG">Scale9 in FXG (Flex 4)</a></li>
<li><a href="http://livedocs.adobe.com/flex/3/langref/flash/display/DisplayObject.html#scale9Grid">Flex Language Reference</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2009/05/flairskin-stateless-skinning-for-flex/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

