<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.1.1" -->
<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/"
	>

<channel>
	<title>Simon Wacker</title>
	<link>http://www.simonwacker.com</link>
	<description>Simon Wacker's Thoughts on Programming</description>
	<pubDate>Fri, 19 Sep 2008 10:47:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.1</generator>
	<language>en</language>
			<item>
		<title>As2ant 2.1</title>
		<link>http://www.simonwacker.com/weblog/2006/07/13/as2ant-21/</link>
		<comments>http://www.simonwacker.com/weblog/2006/07/13/as2ant-21/#comments</comments>
		<pubDate>Thu, 13 Jul 2006 15:30:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Release of As2ant 2.1 with a new task 'Swfsli' and many bug fixes. Swfsli injects script limit tags into SWFs to alter maximum recursion depth and script timeout.]]></description>
			<content:encoded><![CDATA[<p>As2ant 2.1 has just been released. Many bugs have been fixed, especially in the unit test task, and a new task has been added: Swfsli. The swfsli task can be used to inject script limit tags into SWFs to alter the maximum recursion depth and/or the script timeout.</p>
<p>Full list of changes:</p>
<p>[+] samples/swfsli<br />
Added sample showing usage of swfsli task.</p>
<p>[+] org.as2lib.ant.Swfsli<br />
Added task for the SWF ScriptLimits Injector (http://buraks.com/swfsli).</p>
<p>[!] org.as2lib.ant.Mtasc<br />
Enabled usage of &#8220;no&#8221; for &#8220;trace&#8221; argument.</p>
<p>[!] org.as2lib.ant.Swfmill<br />
Removed watchdog for execution of swfmill. Watchdog aborted execution if it took too long which caused troubles with big symbols (clips, fonts, includes).</p>
<p>[+] samples/swfmill, samples/swf<br />
Added samples showing usage of swfmill xml in-line.</p>
<p>[+] samples/asunit<br />
Added sample showing how to use AsUnit with the unit test task.</p>
<p>[!] org.as2lib.test.unit.XmlSocketTestListener<br />
Improved output: highlight only errors.</p>
<p>[!] org.as2lib.test.unit.XmlSocketResultPrinter<br />
Fixed bug with wrong value in attribute &#8220;hasErrors&#8221; of element &#8220;finish&#8221;.</p>
<p>[+] org.as2lib.ant.UnitTest<br />
Added proper handling of exceptions and failed tests.</p>
<p><a href="http://sourceforge.net/project/showfiles.php?group_id=94206&#038;package_id=164902" title="Download As2ant from Sourceforge">Download As2ant from Sourceforge</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwacker.com/weblog/2006/07/13/as2ant-21/feed/</wfw:commentRss>
		</item>
		<item>
		<title>As2ant 2.0 with Unit Test Task</title>
		<link>http://www.simonwacker.com/weblog/2006/06/11/as2ant-20-with-unit-test-task/</link>
		<comments>http://www.simonwacker.com/weblog/2006/06/11/as2ant-20-with-unit-test-task/#comments</comments>
		<pubDate>Sun, 11 Jun 2006 21:50:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Just released As2ant 2.0 (Apache Ant Tasks for Flash). Best new feature is the unit test task. It executes a unit test swf and prints the result directly to the console (command line, eclipse console, &#8230;). As2lib Unit Test and AsUnit are directly supported, but you may plug-in any other unit testing framework. An As2lib [...]]]></description>
			<content:encoded><![CDATA[<p>Just released As2ant 2.0 (<a href="http://ant.apache.org" title="Apache Ant Homepage">Apache Ant</a> Tasks for Flash). Best new feature is the unit test task. It executes a unit test swf and prints the result directly to the console (command line, eclipse console, &#8230;). <a href="http://www.as2lib.org" title="As2lib Homepage">As2lib Unit Test</a> and <a href="http://www.asunit.org" title="AsUnit Homepage">AsUnit</a> are directly supported, but you may plug-in any other unit testing framework. An As2lib sample is included in the distribution.</p>
<p>Complete list of changes:</p>
<p>[+] org.as2lib.ant.UnitTest<br />
Added task to execute unit tests. As2lib Unit Test and AsUnit are directly supported.</p>
<p>[!] org.as2lib.ant.Mtasc<br />
Detects and removes duplicate source files which are very likely when bean definition xml files are used as source files.</p>
<p>[+] org.as2lib.ant.Mtasc<br />
Added new argument: &#8216;packset&#8217;. This argument can be used to include multiple packages based on name patterns (analogous to &#8217;srcset&#8217;).</p>
<p>[+] org.as2lib.ant.Mtasc<br />
Added support for wimp-flag (turns warnings for unused imports on)</p>
<p>[+] org.as2lib.ant.Mtasc<br />
Added namespace support for xml source files (according to the As2lib Application Context specification)</p>
<p><a href="http://sourceforge.net/project/showfiles.php?group_id=94206&#038;package_id=164902" title="Download As2ant 2.0">Download As2ant 2.0</a>.</p>
<p>Hope you enjoy this major release. <img src='http://www.simonwacker.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwacker.com/weblog/2006/06/11/as2ant-20-with-unit-test-task/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Xml Dialect for Flash User Interfaces</title>
		<link>http://www.simonwacker.com/weblog/2006/05/24/xml-dialect-for-flash-user-interfaces/</link>
		<comments>http://www.simonwacker.com/weblog/2006/05/24/xml-dialect-for-flash-user-interfaces/#comments</comments>
		<pubDate>Wed, 24 May 2006 10:47:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[As mentioned in my previous article, the IoC container for Flash supports two XML dialects: a simple one to wire up business objects, and another less verbose one to build user interfaces (with any user interface framework or component library, including in-house ones, that follow some common coding practices).
Following is the ErrorWindow.xml from the As2lib [...]]]></description>
			<content:encoded><![CDATA[<p>As mentioned in my previous article, the IoC container for Flash supports two XML dialects: a simple one to wire up business objects, and another less verbose one to build user interfaces (with any user interface framework or component library, including in-house ones, that follow some common coding practices).</p>
<p>Following is the ErrorWindow.xml from the <a href="http://www.simonwacker.com/uploads/flash/as2lib/as2lib_chat_0.9.zip" title="Download As2lib Chat Sample Application">As2lib Chat</a> sample application:</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;beans</span> xmlns:<span style="color: #000066;">chat</span>=<span style="color: #ff0000;">&quot;org.as2lib.sample.chat&quot;</span> xmlns:<span style="color: #000066;">aw</span>=<span style="color: #ff0000;">&quot;org.aswing&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chat</span>:ErrorWindow <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;errorWindow&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;window&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;messageLabel<span style="font-weight: bold; color: black;">&gt;</span></span></span>r{messageLabel}<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/messageLabel<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;aw</span>:JPanel <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;title&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;aw</span>:JLabel<span style="font-weight: bold; color: black;">&gt;</span></span>{messageSource.message[title.error]}<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/aw</span>:JLabel<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/aw</span>:JPanel<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;aw</span>:Container <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;content&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;aw</span>:JLabel <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;messageLabel&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;aw</span>:JButton <span style="color: #000066;">actionListener</span>=<span style="color: #ff0000;">&quot;d{errorWindow.hide}&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;text<span style="font-weight: bold; color: black;">&gt;</span></span></span>{messageSource.message[button.ok]}<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/text<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/aw</span>:JButton<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/aw</span>:Container<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chat</span>:ErrorWindow<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/beans<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
</ol>
</div>
<p>Namespaces are declared for packages that contain needed components: namespace &#8216;chat&#8217; is mapped to package &#8216;org.as2lib.sample.chat&#8217; and &#8216;aw&#8217; to &#8216;org.aswing&#8217;.</p>
<p>Beans can now be declared as elements with one of the declared namespaces and the class name as local name: &lt;chat:ErrorWindow &#8230;/&gt; or &lt;aw:JPanel &#8230;/&gt;</p>
<p>Properties can either be elements with the element name as property name (&lt;messageLabel&gt;&#8230;&lt;/messageLabel&gt;) or attributes (actionListener=&#8221;&#8230;&#8221;).<br />
Note that there are some reserved attributes like &#8216;id&#8217;, &#8217;style&#8217; and &#8216;class&#8217;. If a property has the name of one of these reserved attributes, it must be declared with an element.<br />
You may have noticed that not all inner bean definitions are wrapped by a property element. For example the &#8216;JLabel&#8217; and &#8216;JButton&#8217; beans inside the &#8216;Container&#8217; bean. So to which property of the &#8216;Container&#8217; bean are they set? To the default property! If you parse the ErrorWindow.xml with the &#8216;AsWingBeanDefinitionParser&#8217; the default property is &#8216;append&#8217; which fits most needs. If you just use the &#8216;UiBeanDefinitionParser&#8217; there is no default property, but you may specify it with the &#8216;default-property&#8217; attribute in the root element as global default-property and/or in any bean definition as local default-property.</p>
<p>Property values with one of the following patterns are interpreted in a special way:<br />
 * p{} or {} is a property get access: {messageSource.message[title.error]} is interpreted as messageSource.getMessage(&#8221;title.error&#8221;)<br />
 * r{} is a bean reference: r{messageLabel}<br />
 * d{} creates a delegate: d{errorWindow.hide}<br />
 * v{} retrieves a variable: v{org.aswing.WindowLayout.TITLE}<br />
 * m{} invokes a method</p>
<p>The reserved &#8217;style&#8217; attribute maps a bean definition to a style class in a style sheet. Here&#8217;s an excerpt from the style.css file of the As2lib Chat (how it is loaded was shortly mentioned in the previous article):</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">@namespace {</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; aw: org.aswing;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ab: org.aswing.<span style="color: #000000; font-weight: bold;">border</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.window </span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; x: <span style="color: #cc66cc;">200</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; y: <span style="color: #cc66cc;">150</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span>: <span style="color: #cc66cc;">400</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">height</span>: <span style="color: #cc66cc;">110</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; resizable: false;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; modal: true;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.window </span><span style="color: #6666ff;">.<span style="color: #000000; font-weight: bold;">content</span> </span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; layout: aw|SoftBoxLayout<span style="color: #66cc66;">&#40;</span>axis=v<span style="color: #66cc66;">&#91;</span>org.aswing.SoftBoxLayout.Y_AXIS<span style="color: #66cc66;">&#93;</span>, gap=<span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span>: ab|EmptyBorder<span style="color: #66cc66;">&#40;</span>insets=aw|Insets<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span>, <span style="color: #cc66cc;">5</span>, <span style="color: #cc66cc;">5</span>, <span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #6666ff;">.window </span><span style="color: #6666ff;">.<span style="color: #000000; font-weight: bold;">content</span> </span>JPanel <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; layout: aw|SoftBoxLayout<span style="color: #66cc66;">&#40;</span>axis=v<span style="color: #66cc66;">&#91;</span>org.aswing.SoftBoxLayout.X_AXIS<span style="color: #66cc66;">&#93;</span>, gap=<span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
</ol>
</div>
<p>The &#8216;.window&#8217; style class is quite simple. It just declares the position and size and whether the window is resizable and modal.</p>
<p>The &#8216;.content&#8217; style class is a little more complex. It declares the layout and border of the window&#8217;s content, which are both instances in <a href="http://www.aswing.org" title="AsWing">AsWing</a>.</p>
<p>A bean (instance) can be declared with a namespace to specify the package (optional) and a class name followed by left and right parenthesis: aw|SoftBoxLayout(&#8230;). Between the parenthesis are either constructor argument or property definitions separated by commas: aw|Insets(5, 5, 5, 5) or aw|SoftBoxLayout(axis=v[org.aswing.SoftBoxLayout.Y_AXIS], gap=5) respectively. Constructor argument definitions are simple values; property definitions consist of the property name followed by &#8216;=&#8217; and the property value.</p>
<p>As you can see in the property definition example, it is also possible to retrieve constants: v[org.aswing.SoftBoxLayout.Y_AXIS]</p>
<p>Applications mostly have multiple screens and windows. Defining all these in a single file would be unmaintainable. Every screen and window is normally defined in its own file. For example the error window is needed by the chat screen to show errors to the users. The chat screen can import the error window as follows:</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;beans</span> &#8230; <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;*.xml&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chat</span>:Chat <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;chat&quot;</span> <span style="color: #000066;">init-method</span>=<span style="color: #ff0000;">&quot;init&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;frame&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;errorWindow<span style="font-weight: bold; color: black;">&gt;</span></span></span>r{errorWindow}<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/errorWindow<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &#8230;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chat</span>:Chat<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &#8230;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;ErrorWindow</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;errorWindow&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.as2lib.context.support.AsWingApplicationContext&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/beans<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
</ol>
</div>
<p>Declare a namespace for importing external definitions: xmlns=&#8221;*.xml&#8221;<br />
Declare an imported bean as any other bean with the import namespace and the file name, and the class of the context which shall manage the imported bean: &lt;ErrorWindow id=&#8221;errorWindow&#8221; class=&#8221;org.as2lib.context.support.AsWingApplicationContext&#8221;/&gt;<br />
You can give the imported bean an &#8216;id&#8217; to reference it: &lt;errorWindow&gt;r{errorWindow}&lt;/errorWindow&gt;<br />
You may also declare properties for the imported bean: &lt;Chat width=&#8221;800&#8243; height=&#8221;600&#8243; visible=&#8221;true&#8221; &#8230;/&gt;</p>
<p>The use cases explained above are the most common ones; they probably fit 90% of all needs. I&#8217;m going to explain more special use cases in the next article.</p>
<p>Download the As2lib Chat sample application with all needed libraries: <a href="http://www.simonwacker.com/uploads/flash/as2lib/as2lib_chat_0.9.zip" title="Download As2lib Chat Sample Application">As2lib Chat</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwacker.com/weblog/2006/05/24/xml-dialect-for-flash-user-interfaces/feed/</wfw:commentRss>
		</item>
		<item>
		<title>IoC Container for Flash</title>
		<link>http://www.simonwacker.com/weblog/2006/05/22/ioc-container-for-flash/</link>
		<comments>http://www.simonwacker.com/weblog/2006/05/22/ioc-container-for-flash/#comments</comments>
		<pubDate>Mon, 22 May 2006 14:46:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[After taking a closer look at dependency injection and discussing some theory about inversion of control containers in the previous articles, we are now going to examine the As2lib Inversion of Control Container which is largely inspired by the Spring Framework.
Note that I use the name bean to refer to application objects managed by bean [...]]]></description>
			<content:encoded><![CDATA[<p>After taking a closer look at <a href="http://www.simonwacker.com/blog/archives/000102.php" title="Dependency Injection">dependency injection</a> and discussing some theory about <a href="http://www.simonwacker.com/blog/archives/000103.php" title="Inversion of Control Containers">inversion of control containers</a> in the previous articles, we are now going to examine the As2lib Inversion of Control Container which is largely inspired by the <a href="http://springframework.org" title="Spring Framework">Spring Framework</a>.</p>
<p>Note that I use the name bean to refer to application objects managed by bean factories (they may be defined by a bean definition and may provide setters and getters to access properties).</p>
<p><b>Bean Wrapper</b> (org.as2lib.bean.BeanWrapper): Bean wrappers are used by bean factories to access properties on beans. They provide methods to check whether properties with a given name are readable and/or writable, to set property values or to get property values and to convert property values to required types.</p>
<p><b>Bean Factory</b> (org.as2lib.bean.factory.BeanFactory): The bean factory is a central registry for application objects. It holds bean definitions identified by unique names. If a bean is requested the bean factory will either create a new bean on each request with the information provided by the bean definition (prototype beans) or create the bean once and return always the same shared bean (singleton beans). The bean factory invokes lifecycle callbacks on a bean during its creation and destruction; creation involves instantiating the bean, populating it (setting property values) and resolving bean references. Most bean factories also support bean post-processors which can modify new beans before they are returned.</p>
<p><b>Factory Bean</b> (org.as2lib.bean.factory.FactoryBean): Factory beans can be used as any other bean in a bean factory; but the bean returned by a bean factory on a bean request is not the factory bean itself, but the bean it creates. This mechanism can be used to retrieve constants that shall be used as property values or to create typed proxies for remoting or web services.</p>
<p><b>Runtime Bean Reference</b> (org.as2lib.bean.factory.config.RuntimeBeanReference): Placeholder holding information to resolve bean references at run-time (dependency injection).</p>
<p><b>Bean Definition Parser</b> (org.as2lib.bean.factory.parser.BeanDefinitionParser): Parses bean definitions which may for example be described with a XML dialect.</p>
<p><b>Application Context</b> (org.as2lib.context.ApplicationContext): Application contexts build on the functionalities provided by bean factories and add some new ones that are typically needed by applications. These additional functionalities are: message sources for internationalization, application events, aspect oriented programming support and process support to execute asynchronous processes on start-up.</p>
<p>Let&#8217;s take a look at the applicationContext.xml file of the <a href="http://www.simonwacker.com/uploads/flash/as2lib/as2lib_chat_0.9.zip" title="Download As2lib Chat Sample">As2lib Chat</a> sample.</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;beans</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;*.xml&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.as2lib.bean.factory.config.StyleSheetConfigurer&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;styleSheetUri&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>style.css<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/property<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/bean<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;smartFoxClient&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;it.gotoandplay.smartfoxserver.SmartFoxClient&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;Login</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;login&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;800&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;600&quot;</span> <span style="color: #000066;">ip</span>=<span style="color: #ff0000;">&quot;127.0.0.1&quot;</span> <span style="color: #000066;">port</span>=<span style="color: #ff0000;">&quot;9339&quot;</span> <span style="color: #000066;">zone</span>=<span style="color: #ff0000;">&quot;simpleChat&quot;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.as2lib.context.support.AsWingApplicationContext&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;smartFoxClient&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;ref</span> <span style="color: #000066;">local</span>=<span style="color: #ff0000;">&quot;smartFoxClient&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/property<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;chat&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;ref</span> <span style="color: #000066;">local</span>=<span style="color: #ff0000;">&quot;chat&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/property<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/Login<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;Chat</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;chat&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;800&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;600&quot;</span> <span style="color: #000066;">visible</span>=<span style="color: #ff0000;">&quot;true&quot;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.as2lib.context.support.AsWingApplicationContext&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;smartFoxClient&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;ref</span> <span style="color: #000066;">local</span>=<span style="color: #ff0000;">&quot;smartFoxClient&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/property<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/Chat<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;localeManager&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.as2lib.lang.LocaleManager&quot;</span> <span style="color: #000066;">factory-method</span>=<span style="color: #ff0000;">&quot;getInstance&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;defaultLocale&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>en<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/property<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;locales&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;array<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.as2lib.lang.GermanLocale&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.as2lib.lang.EnglishLocale&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/array<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/property<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/bean<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;messageSource&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.as2lib.context.support.ResourceBundleMessageSource&quot;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">depends-on</span>=<span style="color: #ff0000;">&quot;localeManager&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;baseName&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>messages<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/property<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/bean<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/beans<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
</ol>
</div>
<p>Beans are defined with bean elements. Every bean element must at least provide the information needed to instantiate it. This is in the simplest case just a bean class. Properties are defined with property elements. They have a name attribute and optionally a type attribute to convert the property value to. The definition of the message source bean can be interpreted as (the depends-on attribute forces the locale manager to be instantiated prior to the message source):</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> messageSource:ResourceBundleMessageSource = <span style="color: #000000; font-weight: bold;">new</span> ResourceBundleMessageSource<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">messageSource.<span style="color: #006600;">setBaseName</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;messages&quot;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
</ol>
</div>
<p>The instantiation can also be done by a per-class or per-instance factory method. This approach is used by the locale manager whose declaration can be interpreted as:</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> localeManager:LocaleManager = LocaleManager.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">localeManager.<span style="color: #006600;">setDefaultLocale</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;en&quot;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> locales:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">locales.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> GermanLocale<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">locales.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> EnglishLocale<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">localeManager.<span style="color: #006600;">addLocales</span><span style="color: #66cc66;">&#40;</span>locales<span style="color: #66cc66;">&#41;</span>;</div>
</li>
</ol>
</div>
<p>While beans can be defined with bean and property elements, such a notation is too verbose and inconvenient to use for defining whole user interfaces. There is thus also another XML dialect which you can see a glimpse of in the above example: The definition of the login and chat beans. We&#8217;ll take a closer look at this more convenient dialect in the next article. Let&#8217;s now think about what the beans are doing.</p>
<p>The <b>message source</b> loads properties files for the target locale with the base name &#8220;messages&#8221; on start-up: messages_de.properties, messages_en.properties, &#8230; . After the properties files have been loaded, the message source can be used to get internationalized messages by name (&#8221;title.welcome&#8221;, &#8220;button.submit&#8221;, &#8230; ).</p>
<p>The <b>locale manager</b> defines a default locale and a list of available locales. If the language of the operating system does not match one of the available locales, the default locale will be used as target locale, whose properties file is loaded by the message source.</p>
<p>The unnamed <b>style sheet configurer</b> loads the cascading style sheet style.css to format the user interface with.</p>
<p>The <b>smart fox client</b> is used to log-in, create rooms and send messages.</p>
<p>The two beans <b>login</b> and <b>chat</b> are user interface screens. Their definition is done in separate xml files: Login.xml and Chat.xml respectively; these files are loaded and parsed on start-up.</p>
<p>We now know what the bean definitions mean, but how can the application be started? The main.Mtasc class is responsible for starting the application in the As2lib Chat sample. It first specifies the parser to use, then creates a new loading application context with the parser and a bean definition URI, adds a listener to the application context to be notified if the application context has finished loading and at the end starts the loading process.</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> beanDefinitionParser:BeanDefinitionParser = <span style="color: #000000; font-weight: bold;">new</span> UiBeanDefinitionParser<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">applicationContext = <span style="color: #000000; font-weight: bold;">new</span> LoadingApplicationContext<span style="color: #66cc66;">&#40;</span>APPLICATION_CONTEXT_URI, beanDefinitionParser<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">applicationContext.<span style="color: #0066CC;">addListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">applicationContext.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
</ol>
</div>
<p>As soon as the application context has finished loading and parsing the Mtasc class gets the login screen from the application context and shows it.</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">try</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> login:Login = applicationContext.<span style="color: #006600;">getBean</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;login&quot;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; login.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">catch</span> <span style="color: #66cc66;">&#40;</span>exception<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Initializing chat failed with error:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> + StringUtil.<span style="color: #006600;">addSpaceIndent</span><span style="color: #66cc66;">&#40;</span>exception.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
</ol>
</div>
<p>The last question that remains is: How do we get the needed classes into the swf? This is actually quite problematic in Flash; every needed class must be referenced for example in the first frame which is quite inconvenient. When you are free to compile your application with <a href="http://www.mtasc.org" title="Motion-Twin ActionScript 2 Compiler">MTASC</a> things are much more convenient: use <a href="http://ant.apache.org" title="Apache Ant">Ant</a> build scripts in combination with <a href="http://sourceforge.net/project/showfiles.php?group_id=94206&#038;package_id=164902" title="As2ant - Swf, Mtasc, Swfmill and As2api Ant Tasks">As2ant</a> to compile the application. With As2ant you have the option to specify the application context as XML source. The SWF task steps through the XML file and compiles all needed classes into the swf.</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;swf</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;${as2lib.dir}/org/as2lib/app/conf/MtascApplication.as&quot;</span> <span style="color: #000066;">dest</span>=<span style="color: #ff0000;">&quot;${chat.swf}&quot;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">header</span>=<span style="color: #ff0000;">&quot;800:600:31&quot;</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000066;">trace</span>=<span style="color: #ff0000;">&quot;org.as2lib.env.log.logger.DebugItLogger.trace&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;classpath<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;pathelement</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;${lib.dir}&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &#8230;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/classpath<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;srcxml<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;pathelement</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;${context.dir}/applicationContext.xml&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &#8230;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/srcxml<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/swf<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
</ol>
</div>
<p>If you use Eclipse or another development environment with integrated Ant support, compiling everything requires just one click.</p>
<p>Download the As2lib Chat sample application with all needed libraries: <a href="http://www.simonwacker.com/uploads/flash/as2lib/as2lib_chat_0.9.zip" title="Download As2lib Chat Sample Application">As2lib Chat</a></p>
<p>As already mentioned previously, the XML dialect for user interfaces will be presented in the next article (but you can of course take a look at it in the As2lib Chat sample application if you can&#8217;t wait).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwacker.com/weblog/2006/05/22/ioc-container-for-flash/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Inversion of Control Containers</title>
		<link>http://www.simonwacker.com/weblog/2006/05/20/inversion-of-control-containers/</link>
		<comments>http://www.simonwacker.com/weblog/2006/05/20/inversion-of-control-containers/#comments</comments>
		<pubDate>Sat, 20 May 2006 12:27:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[OOP]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[An Inversion of Control container is an infrastructural backbone for applications by providing services like lifecycle management, lookup, configuration and dependency resolution.
Lifecycle management: The lifecycle of application objects is managed by the container. The container is able to create new objects, to populate them (applying property values), to invoke initialization and destruction callbacks.
Lookup: References to [...]]]></description>
			<content:encoded><![CDATA[<p>An Inversion of Control container is an infrastructural backbone for applications by providing services like lifecycle management, lookup, configuration and dependency resolution.</p>
<p><b>Lifecycle management:</b> The lifecycle of application objects is managed by the container. The container is able to create new objects, to populate them (applying property values), to invoke initialization and destruction callbacks.</p>
<p><b>Lookup:</b> References to application objects can be obtained through the container. A container is so to speak a factory.</p>
<p><b>Configuration:</b> Application objects can be configured in a consistent way (without needing recompilation); for example with an XML dialect.</p>
<p><b>Dependency resolution:</b> The container should not only configure application objects with simple types, but also manage relationships between them.</p>
<p>While application objects should be able to take advantage of these services, they should NOT depend on the container. This can be achieved by Inversion of Control (and <a href="http://www.simonwacker.com/blog/archives/000102.php" title="Dependency Injection">Dependency Injection</a>). Inversion of Control containers are thus also called non-invasive containers.</p>
<p>IoC containers do not impose invasive dependencies on your code, but it is advisable to follow some good coding practices.</p>
<p>* Code to interfaces to maximize pluggability.<br />
* Each application object should have a clear set of responsibilities.<br />
* Favor the Strategy design pattern over inheritance.<br />
* Do not write code to do anything that the container can do.<br />
* Use method prefixes in a consistent manner (<a href="http://www.simonwacker.com/blog/archives/000087.php#mutator_methods" title="Mutator Methods: Naming">Mutator Methods: Naming</a>)</p>
<p>If you follow the preceding recommendations, you can also easily unit test your code and practice <a href="http://www.simonwacker.com/blog/archives/000085.php" title="TDD - Test Driven Development">test-driven development</a>.</p>
<p>In the next article we are going to take a look at the As2lib IoC container for Flash and its simple XML dialect.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwacker.com/weblog/2006/05/20/inversion-of-control-containers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dependency Injection</title>
		<link>http://www.simonwacker.com/weblog/2006/05/19/dependency-injection/</link>
		<comments>http://www.simonwacker.com/weblog/2006/05/19/dependency-injection/#comments</comments>
		<pubDate>Fri, 19 May 2006 18:54:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Design Patterns]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Applications consist of multiple classes which collaborate with each other. For example an instance of class A needs an instance of class B and C to do its job; in other words, class A depends on class B and C; class B and C are thus dependencies of class A.
There are three options to satisfy [...]]]></description>
			<content:encoded><![CDATA[<p>Applications consist of multiple classes which collaborate with each other. For example an instance of class <i>A</i> needs an instance of class <i>B</i> and <i>C</i> to do its job; in other words, class <i>A</i> depends on class <i>B</i> and <i>C</i>; class <i>B</i> and <i>C</i> are thus dependencies of class <i>A</i>.</p>
<p>There are three options to satisfy dependencies:</p>
<ol>
<li>hard-code dependencies,</li>
<li>look up dependencies,</li>
<li>use the Dependency Injection pattern.</li>
</ol>
<p>1. <a name="hardcode"></a><b>Hard-coding dependencies</b> is the easiest strategy: class <i>A</i> simply instantiates its dependencies.</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> A <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> b:B;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> c:C;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> A<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; b = <span style="color: #000000; font-weight: bold;">new</span> B<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; c = <span style="color: #000000; font-weight: bold;">new</span> C<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> doSomething<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> r:<span style="color: #0066CC;">String</span> = b.<span style="color: #006600;">doSomething</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; c.<span style="color: #006600;">doSomething</span><span style="color: #66cc66;">&#40;</span>r<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
</ol>
</div>
<p>Problems of hard-coding dependencies:</p>
<ul>
<li>Configuration is distributed across the whole application (configuration is in this case wiring up the instances and configuring dependent instances).</li>
<li>Class <i>A</i> must be modified to exchange a dependency (tight coupling): the instance of <i>B</i> may be replaced by an instance of <i>SubB</i> which fulfils the same contract as its super-class <i>B</i>. If <i>B</i> were an interface than any implementations could be used to satisfy the dependency.</li>
<li>What if a fourth class <i>D</i> has a dependency to the same instance of <i>B</i> as class <i>A</i>?</li>
</ul>
<p>2. <a name="lookup"></a><b>Looking up dependencies</b> requires a context: class <i>A</i> gets the context and looks up its dependencies.</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> A <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> b:B;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> c:C;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> A<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> context:Context = Context.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; b = context.<span style="color: #006600;">getB</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; c = context.<span style="color: #006600;">getC</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &#8230;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
</ol>
</div>
<p>Advantages of looking up dependencies:</p>
<ul>
<li>Partially centralized configuration of the context: dependency <i>b</i> is already fully configured; but every instance looks up its dependencies on its own.</li>
<li>One instance can be used to satisfy multiple dependencies: an instance of class <i>D</i> can simply use <i>context.getB()</i> to get the same instance.</li>
</ul>
<p>Problems of looking up dependencies:</p>
<ul>
<li>Class <i>A</i> depends on a context: makes unit testing more difficult and the look ups are disturbing.</li>
<li>Code is bloated with dependency look-ups.</li>
</ul>
<p>3. <a name="injection"></a>Using the <b>Dependency Injection</b> pattern is simple and places no requirements: class <i>A</i> provides ways to inject dependencies.</p>
<p>Advantages of dependency injection:</p>
<ul>
<li>Configuration is centralized in one place: both configuration of instances and wiring up instances.</li>
<li>Dependencies can be exchanged easily (loose coupling).</li>
<li>Wiring up instances is made easy.</li>
</ul>
<p>Problem of dependency injection: The wiring code may become rather complex if there are a lot of instances with a lot of dependencies to satisfy.</p>
<p>One way to go is to use <b>Constructor Injection</b>. In this approach class <i>A</i> declares a constructor with paramters for both dependencies; the dependencies are given on instantiation.</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> A <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> b:B;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> c:C;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> A<span style="color: #66cc66;">&#40;</span>b:B, c:C<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">b</span> = b;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">c</span> = c;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &#8230;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
</ol>
</div>
<p>Advantages of constructor injection:</p>
<ul>
<li>Dependencies cannot be changed after instantiation.</li>
<li>Initialization which requires all dependencies can be done directly in the constructor.</li>
<li>Instance is not in illegal state after instantiation.</li>
</ul>
<p>Problems of constructor injection:</p>
<ul>
<li>Parameter list of constructor may become very long (there may be a lot of dependencies, plus other information to pass to the constructor).</li>
<li>Parameters are distinguished by index and not by name, which may make the code harder to understand.</li>
</ul>
<p>Another way to go is <b>Setter Injection</b>. In this approach class <i>A</i> provides setters for both dependencies; the dependencies are satisfied after instantiation.</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> A <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> b:B;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> c:C;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> A<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setB<span style="color: #66cc66;">&#40;</span>b:B<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">b</span> = b;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setC<span style="color: #66cc66;">&#40;</span>c:C<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">c</span> = c;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &#8230;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
</ol>
</div>
<p>Advantages of setter injection:</p>
<ul>
<li>Constructor can be used to pass other information than dependencies.</li>
<li>Code is easier to understand because names rather than indices are used to distinguish dependencies.</li>
</ul>
<p>Problems of setter injection:</p>
<ul>
<li>Dependencies may not have been satisfied when needed.</li>
<li>Dependencies may be changed after &#8216;official&#8217; initialization.</li>
<li>Initialization may have to be done after all dependencies are satisfied: init-method is needed.</li>
</ul>
<p>While dependency injection is a pattern with many advantages, there are also some problems when used extensively, which can only be solved by an Inversion of Control Container. Such a container provides means of managing instances: lifecycle management (instantiating classes, setting dependencies, invoking init-methods, destroying classes), looking up managed instances, configuring managed instances, resolving dependencies.</p>
<p>In my following articles I&#8217;m going to present the As2lib Inversion of Control Container and show you how it solves the problems mentioned above and which other functionalities it provides (for example using its generic XML dialect to create UIs with ActionStep, AsWing, EnFlash or any other component library).</p>
<p>Further Reading: <a href="http://martinfowler.com/articles/injection.html" title="Inversion of Control Containers and the Dependency Injection pattern">Inversion of Control Containers and the Dependency Injection pattern</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwacker.com/weblog/2006/05/19/dependency-injection/feed/</wfw:commentRss>
		</item>
		<item>
		<title>As2ant 1.5: Specify Swfmill XML within Task</title>
		<link>http://www.simonwacker.com/weblog/2006/03/05/as2ant-15-specify-swfmill-xml-within-task/</link>
		<comments>http://www.simonwacker.com/weblog/2006/03/05/as2ant-15-specify-swfmill-xml-within-task/#comments</comments>
		<pubDate>Sun, 05 Mar 2006 18:26:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[You can now specify the swfmill xml directly in the task. The advantages are that you have only one file to maintain (build.xml) and that you can use ant properties within the swfmill xml.



&#60;swf src=&#34;${src.dir}/com/simonwacker/ant/Sample.as&#34; dest=&#34;${build.dir}/sample.swf&#34;&#62;


&#160; &#60;xml&#62;


&#160; &#160; &#60;![CDATA[


&#160; &#160; &#160; &#60;movie width=&#34;300&#34; height=&#34;100&#34; framerate=&#34;31&#34;&#62;


&#160; &#160; &#160; &#160; &#60;background color=&#8217;#FF8A00&#8242;/&#62;


&#160; &#160; &#160; &#160; &#60;frame&#62;


&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>You can now specify the swfmill xml directly in the task. The advantages are that you have only one file to maintain (build.xml) and that you can use ant properties within the swfmill xml.</p>
<div class="ch_code_container" style="font-family: monospace;height:100%;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;swf</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;${src.dir}/com/simonwacker/ant/Sample.as&quot;</span> <span style="color: #000066;">dest</span>=<span style="color: #ff0000;">&quot;${build.dir}/sample.swf&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xml<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #339933;">&lt;![CDATA[</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &lt;movie width=&quot;300&quot; height=&quot;100&quot; framerate=&quot;31&quot;&gt;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;background color=&#8217;#FF8A00&#8242;/&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;frame&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;library&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;clip id=&quot;simonwacker&quot; import=&quot;${res}/simonwacker.jpg&quot;/&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;font id=&quot;pixel&quot; import=&quot;${res}/pixel.ttf&quot;/&gt;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/library&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/frame&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &lt;/movie&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ]]&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xml<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/swf<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
</ol>
</div>
<p>Further enhancements are:</p>
<p>[+] org.as2lib.ant.Mtasc<br />
Added special XML support for As2lib Bean Factory and Context.</p>
<p>[+] org.as2lib.ant.Swfmill / org.as2lib.ant.Swf<br />
Added support for specifying the swfmill xml directly in the tasks.</p>
<p>[+] org.as2lib.ant.Swf<br />
Added support for overriding font family names.</p>
<p>[+] org.as2lib.ant.Swfmill / org.as2lib.ant.Swf<br />
Added support for extra verbose debugging output.</p>
<p><a href="http://sourceforge.net/project/showfiles.php?group_id=94206&#038;package_id=164902" title="Download As2ant 1.5 from sourceforge.net">Download As2ant 1.5 from sourceforge.net</a><br />
<a href="http://www.simonwacker.com/uploads/ant/as2ant_1.5.zip" title="Download As2ant 1.5 from simonwacker.com">Download As2ant 1.5 from simonwacker.com</a></p>
<p>I hope you enjoy the new features!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwacker.com/weblog/2006/03/05/as2ant-15-specify-swfmill-xml-within-task/feed/</wfw:commentRss>
		</item>
		<item>
		<title>As2ant 1.0 with As2api Task</title>
		<link>http://www.simonwacker.com/weblog/2006/02/27/as2ant-10-with-as2api-task/</link>
		<comments>http://www.simonwacker.com/weblog/2006/02/27/as2ant-10-with-as2api-task/#comments</comments>
		<pubDate>Mon, 27 Feb 2006 14:52:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[As2ant 1.0 has just been released! Best new features are the new As2api task and the custom-arguments support for the Mtasc task.
Full list of changes:
[+] org.as2lib.ant.As2api
Added support for HTML API documentation generation via As2api.
[!] org.as2lib.ant.Mtasc
Fixed bug with package-argument: Use relative paths!
[+] org.as2lib.ant.Mtasc
Added support for custom arguments: &#60;argument name=&#8221;-myargument&#8221; value=&#8221;myvalue&#8221;/&#62;
[~] org.as2lib.ant.Mtasc
Ignore classes in source xml files [...]]]></description>
			<content:encoded><![CDATA[<p>As2ant 1.0 has just been released! Best new features are the new As2api task and the custom-arguments support for the Mtasc task.</p>
<p>Full list of changes:</p>
<p>[+] org.as2lib.ant.As2api<br />
Added support for HTML API documentation generation via As2api.</p>
<p>[!] org.as2lib.ant.Mtasc<br />
Fixed bug with package-argument: Use relative paths!</p>
<p>[+] org.as2lib.ant.Mtasc<br />
Added support for custom arguments: &lt;argument name=&#8221;-myargument&#8221; value=&#8221;myvalue&#8221;/&gt;</p>
<p>[~] org.as2lib.ant.Mtasc<br />
Ignore classes in source xml files that cannot be found.</p>
<p>[+] org.as2lib.ant.Mtasc<br />
Added support for source xml files with &#8216;type&#8217; as attribute.</p>
<p>[+] org.as2lib.ant.Mtasc<br />
Improved commandline output by adding locations to all exceptions.</p>
<p>[~] org.as2lib.ant.Mtasc<br />
Compile all source files in split-mode, even when one raises a compile error.</p>
<p><a href="http://sourceforge.net/project/showfiles.php?group_id=94206&#038;package_id=164902" title="Download As2ant 1.0 from sourceforge.net">Download As2ant 1.0 from sourceforge.net</a><br />
<a href="http://www.simonwacker.com/uploads/ant/as2ant_1.0.zip" title="Downlaod As2ant 1.0 from simonwacker.com">Downlaod As2ant 1.0 from simonwacker.com</a></p>
<p>If you find any bugs please report them!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwacker.com/weblog/2006/02/27/as2ant-10-with-as2api-task/feed/</wfw:commentRss>
		</item>
		<item>
		<title>As2lib 0.9.3, New Version</title>
		<link>http://www.simonwacker.com/weblog/2005/10/13/as2lib-093-new-version/</link>
		<comments>http://www.simonwacker.com/weblog/2005/10/13/as2lib-093-new-version/#comments</comments>
		<pubDate>Thu, 13 Oct 2005 19:30:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[News]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[A new version of the as2lib is finally available for download.
Major changes are:

A completely rewritten File framework that offers various file format representations, like properties files, and support for loading and parsing these files - org.as2lib.io.file
Support for configuring the Logging framework via XML - org.as2lib.env.log.parser
Improved Process and Unit Testing frameworks - org.as2lib.app.exec, org.as2lib.test.unit
Many bug fixes [...]]]></description>
			<content:encoded><![CDATA[<p>A new version of the as2lib is finally available for download.</p>
<p>Major changes are:</p>
<ul>
<li>A completely rewritten File framework that offers various file format representations, like properties files, and support for loading and parsing these files - org.as2lib.io.file</li>
<li>Support for configuring the Logging framework via XML - org.as2lib.env.log.parser</li>
<li>Improved Process and Unit Testing frameworks - org.as2lib.app.exec, org.as2lib.test.unit</li>
<li>Many bug fixes in the AOP framework - org.as2lib.aop</li>
<li>New Regular Expression (RegExp) framework (note that there is still much documentation missing) - org.as2lib.regexp</li>
</ul>
<p>As you can see, it is definitely worth updating to this new version.</p>
<p><a href="http://www.as2lib.org/download#release_0_9_3" title="Download As2lib 0.9.3">Download As2lib 0.9.3.</a></p>
<p><a href="http://api.as2lib.org/0.9.3" title="View API Documentation">View API Documentation</a></p>
<p>If you find any bugs, report it, if you want a new feature, tell us about it, if you need support, ask us: <a href="http://www.as2lib.org/response" title="Response">Response</a>.</p>
<p>The next releases will contain a Bean Factory and Application Context framework and of course - a documented Regular Expression (RegEx) framework. <img src='http://www.simonwacker.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
So, stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwacker.com/weblog/2005/10/13/as2lib-093-new-version/feed/</wfw:commentRss>
		</item>
		<item>
		<title>As2ant 1.0 beta, Released!</title>
		<link>http://www.simonwacker.com/weblog/2005/10/13/as2ant-10-beta-released/</link>
		<comments>http://www.simonwacker.com/weblog/2005/10/13/as2ant-10-beta-released/#comments</comments>
		<pubDate>Thu, 13 Oct 2005 17:30:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[News]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Changes include:
 * Better readability of generated commandline output.
 * Support for local variable inference: -infer
 * Support for package-attribute: -pack
 * New way of specifying sources, via XML
The new way of specifying sources via XML is especially important. Because this allows you to write a xml log configuration for the As2lib logging framework and [...]]]></description>
			<content:encoded><![CDATA[<p>Changes include:</p>
<p> * Better readability of generated commandline output.<br />
 * Support for local variable inference: -infer<br />
 * Support for package-attribute: -pack<br />
 * New way of specifying sources, via XML</p>
<p>The new way of specifying sources via XML is especially important. Because this allows you to write a xml log configuration for the As2lib logging framework and specify this xml log configuration as source xml in your mtasc or swf tasks.</p>
<p>Check it out yourself!</p>
<p><a href="https://sourceforge.net/project/showfiles.php?group_id=94206&#038;package_id=164902&#038;release_id=363226" title="Download As2ant 1.0 beta">Download As2ant 1.0 beta.</a></p>
<p>The next release will contain</p>
<p>  * a task for <a href="http://www.badgers-in-foil.co.uk/projects/as2api" title="As2api">As2api</a>,<br />
  * fixes for all the bugs you encounter and<br />
  * implementations of new features you need.</p>
<p>I hope you enjoy working with the tasks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwacker.com/weblog/2005/10/13/as2ant-10-beta-released/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
