<?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; Swiz</title>
	<atom:link href="http://soenkerohde.com/category/swiz/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>Swiz Yahoo Finance Metadata Processor</title>
		<link>http://soenkerohde.com/2010/03/swiz-yahoo-finance-metadata-processor/</link>
		<comments>http://soenkerohde.com/2010/03/swiz-yahoo-finance-metadata-processor/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 19:38:19 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Swiz]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=957</guid>
		<description><![CDATA[<p>Swiz 1.0 alpha introduced a very cool new feature which lets you extend Swiz be creating custom metadata processors.
This means that if you want to add a metadata like [MyCustomMetadata] you can now do so and Swiz offers you a very easy way to implement it.
For the Swiz 360 Flex demo app I have build a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://swizframework.org">Swiz</a> 1.0 alpha introduced a very cool new feature which lets you extend Swiz be creating custom metadata processors.<br />
This means that if you want to add a metadata like [MyCustomMetadata] you can now do so and Swiz offers you a very easy way to implement it.<br />
For the <a href="http://github.com/srohde/Swiz1Example">Swiz 360 Flex demo app</a> I have build a proof of concept YahooFinance metadata processor. The idea was to have something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>YahooFinance<span style="color: #66cc66;">&#40;</span>tickerSymbol=<span style="color: #ff0000;">&quot;ADBE&quot;</span>, days=<span style="color: #ff0000;">&quot;60&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> adobeStocks:IList;</pre></div></div>

<p>When you annotate the list variable with that metadata the YahooFinanceProcessor gets notified to process it and for the case above fetches the Adobe stock data for the last 60 days. The result is a list of objects which contain a date and a price. You can then bind this list to a chart é voilá, your chart shows live fetched data without writing any code (ok, except declaring the variable).</p>
<p>Here the full source of the view component:</p>

<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>s:Group 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/mx&quot;</span><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> mx.<span style="color: #006600;">collections</span>.<span style="color: #006600;">IList</span>;
&nbsp;
			<span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
			<span style="color: #66cc66;">&#91;</span>YahooFinance<span style="color: #66cc66;">&#40;</span>tickerSymbol=<span style="color: #ff0000;">&quot;ADBE&quot;</span>, days=<span style="color: #ff0000;">&quot;60&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> adobeStocks:IList;
&nbsp;
			<span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
			<span style="color: #66cc66;">&#91;</span>YahooFinance<span style="color: #66cc66;">&#40;</span>tickerSymbol=<span style="color: #ff0000;">&quot;MSFT&quot;</span>, days=<span style="color: #ff0000;">&quot;60&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> microsoftStocks:IList;
		<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:layout<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>s:VerticalLayout<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>s:Label <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Stock Prices last 60 days&quot;</span> <span style="color: #66cc66;">/&gt;</span>
	<span style="color: #66cc66;">&lt;</span>mx:LineChart id=<span style="color: #ff0000;">&quot;chart&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> showDataTips=<span style="color: #ff0000;">&quot;true&quot;</span> dataProvider=<span style="color: #ff0000;">&quot;{adobeStocks}&quot;</span><span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:horizontalAxis<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>mx:CategoryAxis categoryField=<span style="color: #ff0000;">&quot;date&quot;</span> title=<span style="color: #ff0000;">&quot;Time&quot;</span> <span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>mx:horizontalAxis<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:verticalAxis<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>mx:LinearAxis title=<span style="color: #ff0000;">&quot;Price&quot;</span> baseAtZero=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>mx:verticalAxis<span style="color: #66cc66;">&gt;</span>
&nbsp;
		<span style="color: #66cc66;">&lt;</span>mx:series<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>mx:LineSeries dataProvider=<span style="color: #ff0000;">&quot;{microsoftStocks}&quot;</span> displayName=<span style="color: #ff0000;">&quot;Microsoft&quot;</span> xField=<span style="color: #ff0000;">&quot;date&quot;</span> yField=<span style="color: #ff0000;">&quot;price&quot;</span> <span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;</span>mx:LineSeries dataProvider=<span style="color: #ff0000;">&quot;{adobeStocks}&quot;</span> displayName=<span style="color: #ff0000;">&quot;Adobe&quot;</span> xField=<span style="color: #ff0000;">&quot;date&quot;</span> yField=<span style="color: #ff0000;">&quot;price&quot;</span> <span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>mx:series<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>mx:LineChart<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;</span>mx:Legend dataProvider=<span style="color: #ff0000;">&quot;{chart}&quot;</span> <span style="color: #66cc66;">/&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;/</span>s:Group<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>The result looks like this:<br />
<img src="/img/yahoochart.png" /></p>
<p>When you have a look at the <a href="http://github.com/srohde/Swiz1Example/blob/master/src/com/soenkerohde/example/processor/YahooFinanceProcessor.as">source of the YahooFinaceProcessor</a> you see how easy it is to build.</p>
<p>The example also shows how to use the <a href="http://code.google.com/p/foomonger-swizframework/">MediateSignalProcessor</a> build by <a href="http://blog.foomonger.com">Sam Ahn</a>.<br />
There are also a bunch of other custom metadata processors on the way like the <a href="http://blog.foomonger.com/2010/03/10/swiz-resourcemanager-and-resource/">ResourceProcessor</a> also by Sam.<br />
Note that I had to add -keep-as3-metadata+=YahooFinance which you have to do for any new metadata you introduce.</p>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2010/03/swiz-yahoo-finance-metadata-processor/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>360 Flex Swiz Birds of a Feather</title>
		<link>http://soenkerohde.com/2010/03/360-flex-swiz-birds-of-a-feather/</link>
		<comments>http://soenkerohde.com/2010/03/360-flex-swiz-birds-of-a-feather/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 06:42:48 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[Swiz]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=932</guid>
		<description><![CDATA[<p></p>
<p>Thanks to all who joined the Swiz BOF session at 360 Flex in San Jose today.</p>
<p>John Yanarella and I got the opportunity to show Swiz and some examples. We even had Chris around via Skype and I hope you guys enjoyed it!</p>
<p>Here the links to the slides and code:</p>

Slides
Swiz1Example on GitHub

<p>Many thanks to John Wilker for [...]]]></description>
			<content:encoded><![CDATA[<p><img title="Swiz" src="http://soenkerohde.com/img/swiz.png" alt="" width="400" height="234" /></p>
<p>Thanks to all who joined the <a href="http://swizframework.org">Swiz</a> BOF session at <a href="http://www.360flex.com/">360 Flex </a>in San Jose today.</p>
<p><a href="http://www.codecatalyst.com/">John Yanarella</a> and I got the opportunity to show Swiz and some examples. We even had Chris around via Skype and I hope you guys enjoyed it!</p>
<p>Here the links to the slides and code:</p>
<ul>
<li><a href="http://codecatalyst.com/labs/360flex/360Flex-Swiz.pdf">Slides</a></li>
<li><a href="http://github.com/srohde/Swiz1Example">Swiz1Example on GitHub</a></li>
</ul>
<p>Many thanks to <a href="http://johnwilker.com/">John Wilker</a> for organizing this great conference and inviting us to talk. 360 Flex is a great event so if you missed it make sure to attend next time when it&#8217;s around!</p>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2010/03/360-flex-swiz-birds-of-a-feather/feed/</wfw:commentRss>
		<slash:comments>2</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>FGATracker for Google Analytics tracking</title>
		<link>http://soenkerohde.com/2009/11/fgatracker-for-google-analytics-tracking/</link>
		<comments>http://soenkerohde.com/2009/11/fgatracker-for-google-analytics-tracking/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 13:10:46 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Swiz]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=780</guid>
		<description><![CDATA[<p>FGATracker is an AS3 library which wraps gaforflash for Google Analytics and can be easily used in combination with the Swiz framework.</p>
<p>Source and Download</p>

Source on GitHub
Download SWC
API docs

<p>Usage</p>
<p>Add FGATracker to your BeanLoader:</p>

&#60;ga:FGATracker id=&#34;fgaTracker&#34;
	   account=&#34;GOOGLE ANALYTICS ID&#34; xmlns:ga=&#34;com.soenkerohde.ga.*&#34; /&#62;

<p>Dispatch TrackPageEvent or TrackActionEvent:</p>
<p>From a view class (set bubbles=true):</p>

dispatchEvent&#40; new TrackPageEvent&#40; TrackPageEvent.PAGE, &#34;/pagename&#34;, true &#41; &#41;;
dispatchEvent&#40; new [...]]]></description>
			<content:encoded><![CDATA[<p>FGATracker is an AS3 library which wraps <a href="http://code.google.com/p/gaforflash/">gaforflash</a> for <a href="http://www.google.com/analytics/">Google Analytics</a> and can be easily used in combination with the <a href="http://swizframework.org">Swiz framework</a>.</p>
<p><b>Source and Download</b></p>
<ul>
<li><a href="http://github.com/srohde/FGATracker">Source on GitHub</a></li>
<li><a href="http://github.com/srohde/FGATracker/downloads">Download SWC</a></li>
<li><a href="http://srohde.github.com/fgatracker/">API docs</a></li>
</ul>
<p><b>Usage</b></p>
<p>Add FGATracker to your BeanLoader:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>ga:FGATracker id=<span style="color: #ff0000;">&quot;fgaTracker&quot;</span>
	   account=<span style="color: #ff0000;">&quot;GOOGLE ANALYTICS ID&quot;</span> xmlns:ga=<span style="color: #ff0000;">&quot;com.soenkerohde.ga.*&quot;</span> <span style="color: #66cc66;">/&gt;</span></pre></div></div>

<p>Dispatch TrackPageEvent or TrackActionEvent:</p>
<p>From a view class (set bubbles=true):</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">dispatchEvent<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> TrackPageEvent<span style="color: #66cc66;">&#40;</span> TrackPageEvent.<span style="color: #006600;">PAGE</span>, <span style="color: #ff0000;">&quot;/pagename&quot;</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
dispatchEvent<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> TrackActionEvent<span style="color: #66cc66;">&#40;</span> TrackActionEvent.<span style="color: #006600;">ACTION</span> <span style="color: #ff0000;">&quot;category&quot;</span>, <span style="color: #ff0000;">&quot;action&quot;</span>, <span style="color: #ff0000;">&quot;label&quot;</span>, <span style="color: #0066CC;">NaN</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>From a non-view class:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">_dispatcher.<span style="color: #006600;">dispatchEvent</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> TrackPageEvent<span style="color: #66cc66;">&#40;</span> TrackPageEvent.<span style="color: #006600;">PAGE</span>, <span style="color: #ff0000;">&quot;/pagename&quot;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>You can get a reference if your class implements the IDispatcherBean interface:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _dispatcher:IEventDispatcher;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> dispatcher<span style="color: #66cc66;">&#40;</span>dispatcher:IEventDispatcher<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	_dispatcher  = dispatcher;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2009/11/fgatracker-for-google-analytics-tracking/feed/</wfw:commentRss>
		<slash:comments>2</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>Presentation Model Interface with Swiz</title>
		<link>http://soenkerohde.com/2009/08/presentation-model-interface-with-swiz/</link>
		<comments>http://soenkerohde.com/2009/08/presentation-model-interface-with-swiz/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 12:28:38 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Swiz]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=639</guid>
		<description><![CDATA[<p>Lately I have started to use the presentation model approach and I like it a lot. Swiz fellow Ben Clinkinbeard has a wonderful example posted on his blog.</p>
<p>However I disliked that I have to dispatch custom events to make getters bindable. This would normally look like this in an interface:</p>

&#91;Bindable&#40;event=&#34;customDataChanged&#34;&#41;&#93;
function get someData&#40;&#41;:Array;

<p>The problem with it is [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I have started to use the presentation model approach and I like it a lot. <a href="http://code.google.com/p/swizframework/">Swiz</a> fellow <a href="http://www.returnundefined.com/">Ben Clinkinbeard</a> has a wonderful example <a href="http://www.returnundefined.com/2009/05/swiz-example-application-with-presentation-model-pattern">posted on his blog</a>.</p>
<p>However I disliked that I have to dispatch custom events to make getters bindable. This would normally look like this in an interface:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#40;</span>event=<span style="color: #ff0000;">&quot;customDataChanged&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> someData<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Array</span>;</pre></div></div>

<p>The problem with it is that I have to dispatch an event typed &#8220;customDataChanged&#8221; from the presentation model implementation when I want the binding to be updated.<br />
So my implementation would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _someData:<span style="color: #0066CC;">Array</span>;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> someData<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> _someData;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setSomeData<span style="color: #66cc66;">&#40;</span>a:<span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
    _someData = a;
    dispatchEvent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;customDataChanged&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>But what I wanted to use is the Swiz autowire-by-property style which would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><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;appModel&quot;</span>, property=<span style="color: #ff0000;">&quot;someData&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> someData:<span style="color: #0066CC;">Array</span></pre></div></div>

<p>So for the examle above I have a bean with id appModel defined in my IoC Container (BeanLoader) which contains the someData variable. Swiz wires the property into the presentation model implementation but how do I get my interface getter bindable?<br />
The solution is quite easy. Just have a look at the generated actionscript with the compiler args -keep-generated-actionscript and you see that by default a PropertyChangeEvent is dispatched for bindable variables when they are changed. The type value of the event is &#8220;propertyChange&#8221; so the only thing I have to change in my interface is the event type:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#40;</span>event=<span style="color: #ff0000;">&quot;propertyChange&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> someData<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Array</span>;</pre></div></div>

<p>So my view gets the presentation model interface autowired-by-type:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><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> model:IMyPresentationModel;
<span style="color: #66cc66;">&lt;</span>s:<span style="color: #0066CC;">List</span> dataProvider=<span style="color: #ff0000;">&quot;{model.someData}&quot;</span><span style="color: #66cc66;">/&gt;</span></pre></div></div>

<p>Now when the application model someData property changes, Swiz updates the autowired property which fires a PropertyChangeEvent and forces the binding to be updated in the view.</p>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2009/08/presentation-model-interface-with-swiz/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Swiz 0.6.2 with Flex 4 support</title>
		<link>http://soenkerohde.com/2009/06/swiz-062-with-flex-4-support/</link>
		<comments>http://soenkerohde.com/2009/06/swiz-062-with-flex-4-support/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 17:56:27 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Swiz]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=487</guid>
		<description><![CDATA[<p>We just released a new Swiz update:</p>

Flex 4 support (beta)
TwoWay autowire
Mediate priorities
Pass event to mediating method

<p>Flex 4 support
Today Adobe has released Flex Flash Builder 4 and Flash Catalyst betas on Adobe Labs. One more reason for Swiz to support Flex 4.
We have now posted two SWCs for Flex 2/3 and one for Flex 4. To compile [...]]]></description>
			<content:encoded><![CDATA[<p>We just released a new <a href="http://code.google.com/p/swizframework/downloads/list">Swiz update</a>:</p>
<ul>
<li>Flex 4 support (beta)</li>
<li>TwoWay autowire</li>
<li>Mediate priorities</li>
<li>Pass event to mediating method</li>
</ul>
<p><b>Flex 4 support</b><br />
Today Adobe has released <del>Flex</del> <a href="http://labs.adobe.com/">Flash Builder 4 and Flash Catalyst betas on Adobe Labs</a>. One more reason for Swiz to support Flex 4.<br />
We have now posted two SWCs for Flex 2/3 and one for Flex 4. To compile the library on your own you now have to add a new compiler statement because we are using conditional compilation to support Flex 4:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">-define=CONFIG::flex4,<span style="color: #000000; font-weight: bold;">true</span></pre></div></div>

<p>or for Flex 2/3:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">-define=CONFIG::flex4,<span style="color: #000000; font-weight: bold;">false</span></pre></div></div>

<p>so the compiler args for Flex 4 read like:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #339933;">-</span>keep<span style="color: #339933;">-</span>as3<span style="color: #339933;">-</span>metadata<span style="color: #339933;">+=</span>Autowire<span style="color: #339933;">,</span>Mediate <span style="color: #339933;">-</span>namespace http<span style="color: #339933;">://</span>swiz<span style="color: #339933;">.</span>swizframework<span style="color: #339933;">.</span>org manifest<span style="color: #339933;">.</span>xml <span style="color: #339933;">-</span>include<span style="color: #339933;">-</span>namespaces http<span style="color: #339933;">://</span>swiz<span style="color: #339933;">.</span>swizframework<span style="color: #339933;">.</span>org <span style="color: #339933;">-</span>define<span style="color: #339933;">=</span>CONFIG<span style="color: #339933;">::</span><span style="color: #006600;">flex4</span><span style="color: #339933;">,</span>true</pre></div></div>

<p>Further to let Swiz work in Flex 4 your beans in a BeanLoader have to be wrappend in a declarations tag:</p>

<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>swiz:BeanLoader
	xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span>
	xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span>
	xmlns:swiz=<span style="color: #ff0000;">&quot;http://swiz.swizframework.org&quot;</span><span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>fx:Declarations<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>ctrl:TestController id=<span style="color: #ff0000;">&quot;testController&quot;</span> xmlns:ctrl=<span style="color: #ff0000;">&quot;example.ctrl.*&quot;</span> <span style="color: #66cc66;">/&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>fx:Declarations<span style="color: #66cc66;">&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;/</span>swiz:BeanLoader<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>If you use the SwizConfig tag in your main application MXML you also have to nest it into a declarations tag. Our first tests with Flex 4 are fine but since this is the first release with it please give use feedback that all works as expected. Also note that Flex 4 is still beta so there might be changes in the future.<br />
Our internal change is that for Flex 4 we are now using FlexGlobals.topLevelApplication to get access to the Application and the SystemManager. We think that should be it and our Flex 4 test projects works fine. If you have any problems with Flex 4 please let us know and post a comment here and/or join the <a href="http://groups.google.com/group/swiz-framework">Swiz group on Google code</a>.</p>
<p><b>TwoWay autowire</b><br />
<a href="http://www.returnundefined.com">Ben</a> has added twoWay autowire which is really cool and already demonstrated it in his awesome <a href="http://www.returnundefined.com/2009/05/swiz-example-application-with-presentation-model-pattern">Swiz example project</a>. In short you can now do:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><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;appModel&quot;</span>, property=<span style="color: #ff0000;">&quot;activeView&quot;</span>, twoWay=<span style="color: #ff0000;">&quot;true&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> activeView:<span style="color: #0066CC;">int</span>;</pre></div></div>

<p>So when you change the activeView variable above also appModel.activeView will be changed. </p>
<p><b>Mediate priorities</b><br />
The mediate annotation has a new attribute <i>priority</i> which should be self explaining:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Mediate<span style="color: #66cc66;">&#40;</span>event=<span style="color: #ff0000;">&quot;FooEvent.FOO&quot;</span>, priority=<span style="color: #ff0000;">&quot;0&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;">function</span> secondHandler<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#91;</span>Mediate<span style="color: #66cc66;">&#40;</span>event=<span style="color: #ff0000;">&quot;FooEvent.FOO&quot;</span>, priority=<span style="color: #ff0000;">&quot;1&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;">function</span> firstHandler<span style="color: #66cc66;">&#40;</span><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;">// I am called first because of higher priority</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><b>Pass event to mediating method</b><br />
Now you have got the possibility to pass over the event to a mediating method instead of properties:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Mediate<span style="color: #66cc66;">&#40;</span>event=<span style="color: #ff0000;">&quot;FooEvent.FOO&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;">function</span> eventHandler<span style="color: #66cc66;">&#40;</span>event:FooEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>So the rule is when no properties are defined Swiz first tries to call the method without arguments. This is wrapped in a try/catch block so when this fails we call the method again with the event itself as argument. We try to avoid too much &#8220;magic&#8221; in Swiz but I think in this way it&#8217;s pretty handy.</p>
<p><b>Example</b><br />
Event:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FooEvent <span style="color: #0066CC;">extends</span> Event
	<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const FOO:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;foo&quot;</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> FooEvent<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">type</span>:<span style="color: #0066CC;">String</span>, bubbles:<span style="color: #0066CC;">Boolean</span>=<span style="color: #000000; font-weight: bold;">true</span>, cancelable:<span style="color: #0066CC;">Boolean</span>=<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">type</span>, bubbles, cancelable<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> clone<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:Event
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> FooEvent<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">type</span>, bubbles, cancelable<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Because dispatchEvent returns false when the event is canceled your view code, in this example opened as popup, could look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// note that the event bubble flag has to be set to true</span>
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>dispatchEvent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> FooEvent<span style="color: #66cc66;">&#40;</span>FooEvent.<span style="color: #006600;">FOO</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #808080; font-style: italic;">// event not canceled</span>
	<span style="color: #808080; font-style: italic;">// usecase could be to close a popup when an event wasn't canceled like:</span>
	PopupManager.<span style="color: #006600;">removePopup</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #b1b100;">else</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #808080; font-style: italic;">// event is canceled, this is what happens in this example with the controller code below</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>So let&#8217;s have a look at the controller which mediates the FooEvent:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Mediate<span style="color: #66cc66;">&#40;</span>event=<span style="color: #ff0000;">&quot;FooEvent.FOO&quot;</span>, priority=<span style="color: #ff0000;">&quot;0&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;">function</span> secondHandler<span style="color: #66cc66;">&#40;</span><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;">// I will not be called in this example because event.stopImmediatePropagation() in firstHandler</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#91;</span>Mediate<span style="color: #66cc66;">&#40;</span>event=<span style="color: #ff0000;">&quot;FooEvent.FOO&quot;</span>, priority=<span style="color: #ff0000;">&quot;1&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;">function</span> firstHandler<span style="color: #66cc66;">&#40;</span>event:FooEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	event.<span style="color: #006600;">stopImmediatePropagation</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #808080; font-style: italic;">// note that the event cancelable property has to be true to cancel it</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></pre></div></div>

<p>So what happens with the code above:<br />
Because firstHandler has a higher priority than secondHandler it will be called first. In the method we call stopImmediatePropagation so the secondHandler will not be invoked. The event itself gets canceled with preventDefault and the view if statement is false and will not close the popup.</p>
<p>Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2009/06/swiz-062-with-flex-4-support/feed/</wfw:commentRss>
		<slash:comments>30</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>Swiz Autowire View</title>
		<link>http://soenkerohde.com/2009/05/swiz-autowire-view/</link>
		<comments>http://soenkerohde.com/2009/05/swiz-autowire-view/#comments</comments>
		<pubDate>Thu, 21 May 2009 18:26:13 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Swiz]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=304</guid>
		<description><![CDATA[<p>Swiz got a new feature which allows you to autowire views into any class which has been loaded in a BeanLoader. A target could be a controller class which wants to interact with a view. Normally you would say that the view dispatches events which are then handled by a controller to decouple them but there [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/p/swizframework/">Swiz</a> got a new feature which allows you to autowire views into any class which has been loaded in a BeanLoader. A target could be a controller class which wants to interact with a view. Normally you would say that the view dispatches events which are then handled by a controller to decouple them but there are scenarios where you wish you had access to the view directly to avoid a large Script tag in the view component.</p>
<p><b>Disclaimer</b><br />
Swiz does not require or encourage code behind, just that we decided to support this rare use case for the sake of flexibility.</p>
<p>In this first version Autowire view works only for accessors what should be the common usecase meaning you can autowire a setter with the [Autowire(view=true)] metadata above the setter:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Autowire<span style="color: #66cc66;">&#40;</span>view=<span style="color: #ff0000;">&quot;true&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;">function</span> <span style="color: #0066CC;">set</span> myView<span style="color: #66cc66;">&#40;</span>view:MyView<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;">//...</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>The setter is invoked when the view is added to the stage and has dispatched the creationComplete event meaning all elements in the view are created and can be accessed. Since all MXML members are public this gives you quite some power but use it wisely to not introduce unnecessary coupling. Because a view is not a bean you have no bean attribute in the Autowire metadata but you autowire by type.</p>
<p><b>Example handling NativeDragEvent in an AIR app:</b></p>
<p>This code to handle drag-n-drop usually ends up in the Script block because you have to add the event listeners for dragEnter and dragDrop on for instance a Canvas. One could of course dispatch this further with custom events to a controller which could do the logic but I think letting a class directly add the event listeners could save this extra code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package example.<span style="color: #006600;">ctrl</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> example.<span style="color: #006600;">model</span>.<span style="color: #006600;">SomeModel</span>;
	<span style="color: #0066CC;">import</span> example.<span style="color: #006600;">view</span>.<span style="color: #006600;">DragView</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">desktop</span>.<span style="color: #006600;">ClipboardFormats</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">NativeDragEvent</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">filesystem</span>.<span style="color: #006600;">File</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">core</span>.<span style="color: #006600;">IUIComponent</span>;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">managers</span>.<span style="color: #006600;">DragManager</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DragController
	<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;">var</span> someModel:SomeModel;
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Autowire<span style="color: #66cc66;">&#40;</span>view=<span style="color: #ff0000;">&quot;true&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;">function</span> <span style="color: #0066CC;">set</span> dragView<span style="color: #66cc66;">&#40;</span>view:DragView<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>view.<span style="color: #006600;">hasEventListener</span><span style="color: #66cc66;">&#40;</span>NativeDragEvent.<span style="color: #006600;">NATIVE_DRAG_ENTER</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
				view.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>NativeDragEvent.<span style="color: #006600;">NATIVE_DRAG_ENTER</span>, dragEnterHandler, <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: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>view.<span style="color: #006600;">hasEventListener</span><span style="color: #66cc66;">&#40;</span>NativeDragEvent.<span style="color: #006600;">NATIVE_DRAG_DROP</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
				view.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>NativeDragEvent.<span style="color: #006600;">NATIVE_DRAG_DROP</span>, dragDropHandler, <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;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> DragController<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		protected <span style="color: #000000; font-weight: bold;">function</span> getFilesFromDragEvent<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:NativeDragEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Array</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>.<span style="color: #006600;">clipboard</span>.<span style="color: #006600;">hasFormat</span><span style="color: #66cc66;">&#40;</span>ClipboardFormats.<span style="color: #006600;">FILE_LIST_FORMAT</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> files:<span style="color: #0066CC;">Array</span> = <span style="color: #0066CC;">e</span>.<span style="color: #006600;">clipboard</span>.<span style="color: #006600;">getData</span><span style="color: #66cc66;">&#40;</span>ClipboardFormats.<span style="color: #006600;">FILE_LIST_FORMAT</span><span style="color: #66cc66;">&#41;</span> as <span style="color: #0066CC;">Array</span>;
				<span style="color: #b1b100;">return</span> files;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">null</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		protected <span style="color: #000000; font-weight: bold;">function</span> dragEnterHandler<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:NativeDragEvent<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> files:<span style="color: #0066CC;">Array</span> = getFilesFromDragEvent<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>files <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&amp;&amp;</span> files.<span style="color: #0066CC;">length</span> == <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				DragManager.<span style="color: #006600;">acceptDragDrop</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>.<span style="color: #006600;">currentTarget</span> as IUIComponent<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> dragDropHandler<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:NativeDragEvent<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> files:<span style="color: #0066CC;">Array</span> = getFilesFromDragEvent<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>files <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&amp;&amp;</span> files.<span style="color: #0066CC;">length</span> == <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> f:File = files<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span> as File;
				<span style="color: #808080; font-style: italic;">// notify your model that a file is dragged on the view</span>
				someModel.<span style="color: #006600;">addFile</span><span style="color: #66cc66;">&#40;</span>f<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Autowire view can give you more flexibility but for sure more <b>responsibility</b> so take care! So ask yourself twice if you are using the right approach when introducing Autowire view. However, if you have interesting scenarios where you can apply a decent pattern with this approach please share it.</p>
<p><b>Important</b></p>
<ul>
<li>In some scenarios I have seen that the setter is called twice so you maybe want to add an initView flag. Have to figure out if this is caused by the way Flex works or if this is a Swiz bug.</li>
<li>Be always sure to add event listeners with a weak reference to enable garbage collection when the view is removed</li>
<li>When you store a reference of the view be sure to release it when the view is removed to enable garbage collection</li>
<li>Autowire view is considered to be used for custom components and I have not tried what happens when you autowire a Canvas or a Button or whatever <img src='http://soenkerohde.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2009/05/swiz-autowire-view/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Swiz 0.6 Released</title>
		<link>http://soenkerohde.com/2009/05/swiz-06-released/</link>
		<comments>http://soenkerohde.com/2009/05/swiz-06-released/#comments</comments>
		<pubDate>Tue, 19 May 2009 15:09:13 +0000</pubDate>
		<dc:creator>Sönke</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Swiz]]></category>

		<guid isPermaLink="false">http://soenkerohde.com/?p=413</guid>
		<description><![CDATA[<p>Chris just released a new version of Swiz with some really great additions and improvements. We now also own the domain swizframework.org which forwards to the Google code homepage.</p>
<p>This release makes Swiz faster, more flexible and even easier to use:</p>

Support for mediating bubbled event
Added view attribute in Mediate tag
Autowire views with view attribute in Autowire tag
Ignoring [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cdscott.blogspot.com/" target="_blank">Chris</a> just released a <a href="http://code.google.com/p/swizframework/downloads/list" target="_blank">new version of Swiz</a> with some really great additions and improvements. We now also own the domain <a href="http://swizframework.org" target="_blank">swizframework.org</a> which forwards to the Google code homepage.</p>
<p>This release makes Swiz faster, more flexible and even easier to use:</p>
<ul>
<li>Support for mediating bubbled event</li>
<li>Added view attribute in Mediate tag</li>
<li>Autowire views with view attribute in Autowire tag</li>
<li>Ignoring view classes with underscore for performance optimization</li>
<li>Added viewPackages for performance optimization</li>
<li>Added eventPackages for shorter notation in strict mode</li>
<li>SwizConfig for Swiz MXML declaration</li>
<li>Generic fault handler for executeServiceCall</li>
<li>Autowire bean properties with new property attribute</li>
<li>Prototype supports class reference and constructor arguments</li>
</ul>
<p>Swiz got a new member <a href="http://www.returnundefined.com/" target="_blank">Ben Clinkinbeard</a> who contributed some really cool stuff which makes mediating events more flexible and removed the Swiz dependency from the view because they can now bubble and lot&#8217;s of other stuff. Awesome to have Ben on board!</p>
<p>So here a quick overview for each new feature/improvement:</p>
<p><b>Support for mediating bubbled event</b></p>
<p>Events don&#8217;t have to be dispatched with the central event dispatcher anymore. So when you have a view instead of:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">Swiz.<span style="color: #006600;">dispatchEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> FooEvent<span style="color: #66cc66;">&#40;</span>FooEvent.<span style="color: #006600;">CHANGE</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>you can do:</p>

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

<p>When you want to use this approach you have to</p>
<ul>
<li>enable the feature with Swiz.setMediateBubbledEvents(true) or via SwizConfig</li>
<li>set the bubble flag of the event to &#8220;true&#8221;</li>
<li>override clone method of the event</li>
</ul>
<p>So the view has no Swiz import statement anymore and in fact doesn&#8217;t know anything about Swiz except to autowire models.</p>
<p><b>Added view attribute in Mediate tag</b></p>
<p>A dynamic mediator can now listen for view specific events. In the following example the dynamic mediator only listens for events dispatches by the view class &#8220;MyView&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Mediate<span style="color: #66cc66;">&#40;</span>event=<span style="color: #ff0000;">&quot;SomEvent.FOO&quot;</span>, view=<span style="color: #ff0000;">&quot;MyView&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></pre></div></div>

<p>This is also extremely helpful to code more generic itemRenderers.</p>
<p><b>Autowire views with view attribute in Autowire tag</b></p>
<p>You can now autowire views into any bean with:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Autowire<span style="color: #66cc66;">&#40;</span>view=<span style="color: #ff0000;">&quot;true&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;">function</span> <span style="color: #0066CC;">set</span> myView<span style="color: #66cc66;">&#40;</span>view:MyView<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>...<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>The setter is invoked when the view is added to the stage and has fired its creationComplete event so you can access all members of the view which in MXML are all public scope.<br />
For more details and an example <a href="http://soenkerohde.com/2009/05/swiz-autowire-view/">read my post here.</a></p>
<p><b>Ignoring view classes with underscore for performance optimization</b></p>
<p>This is an internal performance optimization where you as a developer don&#8217;t have to change anything except you have view classes with an underscore in the classname.<br />
In Swiz 0.6 view classes with &#8220;_&#8221; are ignored for dependency injection because these are internal classes like skin classes, cursors or internal non-custom item renderers. Because these kind of classes won&#8217;t contain any metadata we can safely ignore them which improves the runtime performance significantly.</p>
<p><b>Added viewPackages for performance optimization</b></p>
<p>For further optimization beyond already ignoring underscore classes you can now define one or multiple view packages. If you set this property only views in these packages will get autowired.<br />
You can set the viewPackage with</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">Swiz.<span style="color: #006600;">addViewPackage</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;com.domain.project.view&quot;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p> or with the new SwizConfig.</p>
<p><b>Added eventPackages for shorter notation in strict mode</b></p>
<p>When you are using Swiz in strict mode you can now define eventPackages to have a shorter notation of the event. I already <a href="http://soenkerohde.com/2009/04/swiz-eventpackages-in-strict-mode/">blogged about this feature here</a>.</p>
<p><b>SwizConfig for Swiz MXML declaration</b></p>
<p>Instead of adding an event listener for the Application/WindowedApplication preInitialize event and the calling Swiz.loadBeans besides configuring Swiz you can now use the new SwizConfig class in MXML. The markup for an AIR app then looks like this:</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;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:WindowedApplication</span> <span style="color: #000066;">xmlns:mx</span>=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> <span style="color: #000066;">layout</span>=<span style="color: #ff0000;">&quot;absolute&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #339933;">&lt;![CDATA[</span>
<span style="color: #339933;">			import mx.rpc.events.FaultEvent;</span>
<span style="color: #339933;">			import mx.logging.LogEventLevel;</span>
&nbsp;
<span style="color: #339933;">			private function genericFault(fe:FaultEvent):void</span>
<span style="color: #339933;">			{</span>
<span style="color: #339933;">				// TODO handle fault</span>
<span style="color: #339933;">			}</span>
&nbsp;
<span style="color: #339933;">		]]&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:TraceTarget</span> <span style="color: #000066;">fieldSeparator</span>=<span style="color: #ff0000;">&quot;-&gt;</span></span>&quot; includeLevel=&quot;true&quot; includeCategory=&quot;true&quot; includeTime=&quot;true&quot; /&gt;
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;swizframework:SwizConfig</span> <span style="color: #000066;">xmlns:swizframework</span>=<span style="color: #ff0000;">&quot;org.swizframework.*&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">strict</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">mediateBubbledEvents</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">eventPackages</span>=<span style="color: #ff0000;">&quot;example.event&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">viewPackages</span>=<span style="color: #ff0000;">&quot;example.view&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">beanLoaders</span>=<span style="color: #ff0000;">&quot;{[Beans]}&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">serviceCallFaultHandler</span>=<span style="color: #ff0000;">&quot;{genericFault}&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">logEventLevel</span>=<span style="color: #ff0000;">&quot;{LogEventLevel.WARN}&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;view:SwizConfigTestView</span> <span style="color: #000066;">xmlns:view</span>=<span style="color: #ff0000;">&quot;example.view.*&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:WindowedApplication<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>The SwizConfig itself will listen for the preInitialize event of the application and configure Swiz.</p>
<p><b>Generic fault handler for executeServiceCall</b></p>
<p>When you use Swiz.executeServiceCall or subclass AbstractController and call executeService call you can leave out the fault handler. When a fault comes up Swiz currently shows an Alert window with the fault details. You can override this like in the SwizConfig example above.</p>
<p><b>Autowire bean properties with new property attribute</b></p>
<p>You can now autowire bean members instead of the bean itself. So instead of:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><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> someModel:SomeModel;
&nbsp;
<span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">List</span> dataProvider=<span style="color: #ff0000;">&quot;{someModel.someList}&quot;</span> <span style="color: #66cc66;">/&gt;</span></pre></div></div>

<p>you can use:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><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;someModel&quot;</span>, property=<span style="color: #ff0000;">&quot;someList&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> someList:ICollectionView;
&nbsp;
<span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">List</span> dataProvider=<span style="color: #ff0000;">&quot;{someList}&quot;</span> <span style="color: #66cc66;">/&gt;</span></pre></div></div>

</p>
<p><b>Prototype supports class reference and constructor arguments</b></p>
<p>Prototype (<a href="http://soenkerohde.com/2009/01/swiz-prototype-bean/" target="_blank">see old post here</a>) now support constructor arguments and you can declare a class reference instead of the full qualified class name.<br />
Example:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>factory:<span style="color: #0066CC;">Prototype</span> xmlns:factory=<span style="color: #ff0000;">&quot;org.swizframework.factory.*&quot;</span>
	classReference=<span style="color: #ff0000;">&quot;{SomeClass}&quot;</span> constructorArguments=<span style="color: #ff0000;">&quot;{['foo', 'bar']}&quot;</span> <span style="color: #66cc66;">/&gt;</span></pre></div></div>

</p>
<p>There will come a lot of new blog posts regarding each new feature soon but I hope this has given an overview about what&#8217;s new in 0.6. Besides that we try to add more documentation and example projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://soenkerohde.com/2009/05/swiz-06-released/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

