<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Christophe Herreman</title>
	<atom:link href="http://www.herrodius.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://www.herrodius.com/blog</link>
	<description>Thoughts from a software developer</description>
	<lastBuildDate>Fri, 12 Mar 2010 19:38:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Spring ActionScript: Café Townsend sample application</title>
		<link>http://www.herrodius.com/blog/307</link>
		<comments>http://www.herrodius.com/blog/307#comments</comments>
		<pubDate>Sun, 07 Mar 2010 14:42:59 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Domain-Driven Design]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[Inversion of Control]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=307</guid>
		<description><![CDATA[A new Spring ActionScript sample application is now available. This is the Café Townsend application, originally created as a sample application for the Cairngorm framework, that we ported to Spring ActionScript. This should make it easier to compare this implementation with the implementations of some of the other frameworks.
Open the Café Townsend sample.
(Be sure to [...]]]></description>
			<content:encoded><![CDATA[<p>A new Spring ActionScript sample application is now available. This is the Café Townsend application, originally created as a sample application for the Cairngorm framework, that we ported to Spring ActionScript. This should make it easier to compare this implementation with the implementations of some of the other frameworks.</p>
<p><a href="http://www.herrodius.com/examples/cafe-townsend/" target="new">Open the Café Townsend sample.</a><br />
(Be sure to check the source by right-clicking and choosing "View Source" from the context menu, click <a href="http://www.herrodius.com/examples/cafe-townsend/srcview/index.html" target="new">here</a> to go to the source directly.)</p>
<p><a href="http://www.herrodius.com/examples/cafe-townsend/cafe-townsend.zip">Download the Flex/Flash Builder project and sources.</a></p>
<p><strong>Discussion</strong></p>
<p>In what follows, we will discuss the implementation details and motivate certain choices made in this design.</p>
<p><strong>Package Structure</strong></p>
<p>The first thing you might notice is the package structure, that might seem a bit odd at first since it is different from what most frameworks use or prescribe. This example follows the Layered Architecture, described by Eric Evans in the book <a href="https://www.amazon.com/dp/0321125215?tag=christherrem-20&#038;camp=0&#038;creative=0&#038;linkCode=as1&#038;creativeASIN=0321125215&#038;adid=1BZQW3KXDC2XEGJEWAYC&#038;">Domain-Driven Design: Tackling Complexity in the Heart of Software</a> (recommended reading). This architecture makes it easy to detect and apply the different layers of the application and forces us somewhat to have a clean separation of the responsibilities of each layer.</p>
<p>The layered architecture consists of four layers, as shown on the image below:</p>
<p><img src="http://www.herrodius.com/blog/wp-content/uploads/2010/03/LayeredArchitecture.png" alt="" title="LayeredArchitecture" width="320" height="293" class="aligncenter size-full wp-image-312" /></p>
<ul>
<li><strong>Presentation Layer</strong>: contains the user interface (the view component and in this example the presentation models)</li>
<li><strong>Application Layer</strong>: coordinates the application and forms a communication channel between the UI and the domain</li>
<li><strong>Domain Layer</strong>: the core of the software. This layer defines the entities and repositories/services that form the business logic of the application. For the most part only the interfaces for the services will be written here. This layer does not contain any implementation details.</li>
<li><strong>Infrastructure Layer</strong>: provides implementation details for all other layers. Concrete implementations of services will be put here.</li>
</ul>
<p>Note that it is certainly not needed to structure your application like this. Spring ActionScript does not impose or prescribe this structure, but we certainly think it is useful and wanted to introduce it in this example. Also note that while we have applied this architecture as packages in the same application, you might want to create different swc's or libraries for each of these layers so that they can easily be reused.</p>
<p><strong>Presentation Layer &#038; Presentation Models</strong></p>
<p>This example uses the Presentation Model (PM) as the main presentation pattern for the UI layer. The PM allows us to extract all state and controller logic for the view into a separate class that is view agnostic. A view component contains a reference to its corresponding PM and delegates all UI actions to it. The view component can either instantiate the PM directly, or it can be given one, either by a parent component or by having it "injected" by the Spring ActionScript framework. The process of automatically injecting properties into a (view) component is known as "Autowiring" in Spring ActionScript. Note that since the PM is not a UI component and does not know anything about the view, it can be easily unit tested.</p>
<p>An example of autowiring can be found in the EmployeeLogin.mxml class:</p>
<div class="igBar"><span id="lactionscript-5"><a href="#" onclick="javascript:showPlainTxt('actionscript-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-5">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>Autowired<span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> presentationModel:EmployeeLoginPresentationModel; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The PMs used in this example will either delegate directly to the business logic (for instance for loading the employees) or will delegate to the Application Layer (for instance for logging the user out of the application). Here again, there is no strict rule to follow, but you can decide for your own what approach seems the bests.</p>
<p>Note that autowiring is disabled by default. This is because in bigger applications, there might be a significant performance hit when autowiring is used. It is adviced to finetune the autowiring by configuring the autowire processor to include or exclude certain classes. To enable autowiring, simply add the following to the XML configuration:</p>
<div class="igBar"><span id="lxml-6"><a href="#" onclick="javascript:showPlainTxt('xml-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-6">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;object</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"autowiringStageProcessor"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"org.springextensions.actionscript.stage.DefaultAutowiringStageProcessor"</span><span style="font-weight: bold; color: black;">/&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Application Layer</strong></p>
<p>In some cases, the UI will delegate responsibilities to the Application Layer. Since the UI does not know about this layer, it needs a loosely coupled way of communicating with it. The communication channel that provides this capability in Spring ActionScript is the EventBus. It is implemented on top of Flash's event dispatching capability and forms a centralized medium for component and layer interaction.</p>
<p>In the example, the code behind the Logout button will dispatch an event via the EventBus. The application controller listens for this event and will handle it by invoking the logout method on the authentication service. Notice that the application controller takes the authentication service as a constructor argument and that the service is typed to the interface IAuthenticationService. The actual instance is provided in the (XML) configuration, were both the application controller and the authentication service and defined and linked to eachother.</p>
<p>Notice that the application controller does not explicitely listen for the logout event. Instead, it is sufficient to create a method and annotate it with the <strong>[EventHandler]</strong> metadata. Spring ActionScript will then introspect the controller, pick up all annotated methods and link them automatically with the event received from the EventBus.</p>
<p>Here's what the logout method looks like in the application controller:</p>
<div class="igBar"><span id="lactionscript-7"><a href="#" onclick="javascript:showPlainTxt('actionscript-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-7">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>EventHandler<span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> logout<span style="color: #66cc66;">&#40;</span><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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">var</span> operation:IOperation = _authenticationService.<span style="color: #006600;">logout</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; operation.<span style="color: #006600;">addCompleteListener</span><span style="color: #66cc66;">&#40;</span>logout_completeHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice that the name of the logout method corresponds to the event being dispatched, namely "logout" (see the ApplicationEvents class for that). You can however also choose the name of this method as you like and specify the name of the event as an attribute of the EventHandler metadata.</p>
<p>As with autowiring, the processing of the EventHandler metadata is not enabled by default. If you want to use this in your application, simply add the following to the XML configuration:</p>
<div class="igBar"><span id="lxml-8"><a href="#" onclick="javascript:showPlainTxt('xml-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-8">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;object</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"eventHandlerProcessor"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"org.springextensions.actionscript.ioc.factory.config.EventHandlerMetaDataPostProcessor"</span><span style="font-weight: bold; color: black;">/&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>For more information on the EventBus, please refer to the <a href="http://www.springactionscript.org/docs/reference/html/the_eventbus.html">documentation</a>.</p>
<p><strong>Domain Layer</strong></p>
<p>The domain for this application is extremely simple. All it contains is an Employee entity and an employee service in the form of the IEmployeeService. Except for the actual entities of the domain, this layer does not contain any implementation details for the services it provides, but merely defines the interfaces for those services.</p>
<p><strong>Infrastructure Layer</strong></p>
<p>The infrastructure layer is where the technical details of the applications live. This layer provides the actual implementation of the services found in the other layers. Depending on the different contexts the application needs to be able to run in, you might provide different implementations of the services here. The implementations used in the application can then be defined the a Spring ActionScript Application Context. As an example, think of an application that needs to be able to connect to a set of services using Remote Objects in one scenario and needs to connect to a set of Webservices in another scenario. If we provide both implementations, we can easily reconfigure the application by changing the XML configuration of the application context.</p>
<p><strong>Application Context</strong></p>
<p>Once we have all components, we can bundle them together and prepare them to be used in the application. By doing this, we are configuring the <strong>context</strong> of the application. In Spring ActionScript this is done by instantiating a FlexXMLApplicationContext (in case you are working with Flex).</p>
<p>The application context in this example is configured using XML, but it could just as easily be configured using an MXML configuration. Both approaches have there pros and cons and you should decide what fits best for you project.</p>
<p>Looking at the Main.mxml class, which is the entry point of the application, we can see that a FlexXMLApplicationContext is instantiated and given the path to the external XML file (application-context.xml) that forms the application context's configuration. Now all we need to do is wait for the context to load before starting the application.</p>
<p><strong>Conclusion</strong></p>
<p>This example contains significantly less code than the original Cairngorm version. This is mainly because Spring ActionScript does not impose any strict architectural rules and provides the developer with plenty of choice for architecting things that best fit the application being developed. What might work in application A might not necessarily work well for application B or C. Being given so much freedom and choice might feel awkward at first, but you will notice that this is actual a good thing and you will benefit greatly from it.</p>
<p>If you have any remarks on this post, please leave them in comments or contact me. Whether they are errors, things that are unclear, or general questions... all feedback is welcome.</p>
<p>General information and document about Spring ActionScript can be found at <a href="http://www.springactionscript.org/">http://www.springactionscript.org/</a></p>
<p>Related articles:</p>
<ul>
<li><a href="http://www.herrodius.com/blog/284">The Operation API</a></li>
<li><a href="http://www.herrodius.com/blog/273">Spring ActionScript 1.0 RC1 Released</a></li>
<li><a href="http://www.herrodius.com/blog/255">Spring ActionScript Devoxx slides</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/307/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript: The Operation API</title>
		<link>http://www.herrodius.com/blog/284</link>
		<comments>http://www.herrodius.com/blog/284#comments</comments>
		<pubDate>Thu, 04 Mar 2010 20:39:50 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=284</guid>
		<description><![CDATA[Introduction
As Flex and Flash developers, we are used to working with asynchronous code. Whenever we load data from a server for instance, we need to wait for the result to come back as we can't just read the result of such a call directly. The way in which we wait for these asynchronous calls to [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>As Flex and Flash developers, we are used to working with asynchronous code. Whenever we load data from a server for instance, we need to wait for the result to come back as we can't just read the result of such a call directly. The way in which we wait for these asynchronous calls to complete differs from API to API. There are events, async tokens, callback functions, ... The fact that there is no unified approach to this, is a core problem in our opinion of Flash. It is not only confusing to developers, but it also prevents us from easily integrating these various techniques and abstracting away their details.</p>
<p>Consider a service that manages User objects by providing basic operations on these entities like create, read, update and delete (CRUD). If you plan on creating an interface for this user service so you can vary the implementation easily, what return type would the methods have?</p>
<div class="igBar"><span id="lactionscript-17"><a href="#" onclick="javascript:showPlainTxt('actionscript-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-17">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">interface</span> IUserService <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> addUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>: ? ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> deleteUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>: ? ;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> saveUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>: ? ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> loadAllUsers<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>: ? ;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>We could either:</p>
<ul>
<li>return nothing and wait for events to be dispatched by the service when its methods have executed: this has the disadvantage that there is no real contract on the method.</li>
<li>return nothing and pass in a Responder or result and fault handler callback functions: this has the disadvantage that it blurs the signature of the service method with technical details.</li>
<li>return an AsyncToken: this is a stricter contract, but it would tie our code to the Flex framework and it would only work if you create implementations that support AsyncToken</li>
</ul>
<p>In general, the biggest problem is that there is no standard way of defining an asynchronous execution in the Flash Player.</p>
<p><strong>Operation API</strong></p>
<p>The solution Spring ActionScript provides comes in the form of the Operation API. This is a set of interfaces and classes that enables developers to work with asynchronous processes in a uniform fashion. An "operation" in Spring ActionScript vocabulary is the term used for an asynchronous execution and is defined by the IOperation interface. Once an operation is created, it executes immediately and when it is done executing, it either dispatches a "complete" event or an "error" event.</p>
<p>Going back to our user service, this means that we would type all return types of its (asynchronous) methods to IOperation:</p>
<div class="igBar"><span id="lactionscript-18"><a href="#" onclick="javascript:showPlainTxt('actionscript-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-18">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">interface</span> IUserService <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> addUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>:IOperation;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> deleteUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>:IOperation;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> saveUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>:IOperation;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">function</span> loadAllUsers<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:IOperation;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Whether you now have an implementation that uses Remote Objects, Webservices, locally loaded XML data, a local SQLite database, ... clients working with the user service should not know and care about implementation details. All that they know is that asynchronous methods return an operation to which they can attach listeners to for dealing with the result or error of the call.</p>
<p>A client calling one of these methods might to something like the following, considering there is a userService of type IUserService:</p>
<div class="igBar"><span id="lactionscript-19"><a href="#" onclick="javascript:showPlainTxt('actionscript-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-19">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> user:User = <span style="color: #000000; font-weight: bold;">new</span> User<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"John"</span>, <span style="color: #ff0000;">"Doe"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> operation:IOperation = userService.<span style="color: #006600;">saveUser</span><span style="color: #66cc66;">&#40;</span>user<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">operation.<span style="color: #006600;">addCompleteListener</span><span style="color: #66cc66;">&#40;</span>saveUser_completeHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">operation.<span style="color: #006600;">addErrorListener</span><span style="color: #66cc66;">&#40;</span>saveUser_errorHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> saveUser_completeHandler<span style="color: #66cc66;">&#40;</span>event:OperationEvent<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">// user was saved</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">// event.result contains an optional result of the asynchronous method</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> saveUser_errorHandler<span style="color: #66cc66;">&#40;</span>event:OperationEvent<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;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">// user was not saved, since an error occurred</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">// event.error contains error information</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice that each operation has the convenience methods "addCompleteListener" and "addErrorListener" for listening to the events dispatched by the operation. The handlers for these events receive an instance of the OperationEvent which contains either the result or the error details.</p>
<p>We have also included some base classes that make it easy to create operations and services. The AbstractOperation class for instance provides a basic implementation of the IOperation interface and implements the event dispatching functionality. You might want to extend this class if you create your own operations.</p>
<p>Here's an example of a custom operation:</p>
<div class="igBar"><span id="lactionscript-20"><a href="#" onclick="javascript:showPlainTxt('actionscript-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-20">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyOperation <span style="color: #0066CC;">extends</span> AbstractOperation <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MyOperation<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// execute something asynchronously</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// the resultHandler and errorHandler deal with the result of fault</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> resultHandler<span style="color: #66cc66;">&#40;</span>aResult:<span style="color: #0066CC;">Object</span><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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dispatchCompleteEvent<span style="color: #66cc66;">&#40;</span>aResult<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> errorHandler<span style="color: #66cc66;">&#40;</span>anError:<span style="color: #0066CC;">Object</span><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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dispatchErrorEvent<span style="color: #66cc66;">&#40;</span>anError<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice that we call the "dispatchCompleteEvent" and "dispatchErrorEvent" on either success or failure. We pass in the result or the error we received. These will internally be set on the operation so that clients can request them via the OperationEvent.</p>
<p>The Spring ActionScript framework also contains a series of operation implementations for working with Remote Objects, NetConnections, etc.</p>
<p><strong>Combining Operations into Services</strong></p>
<p>Taking this a step further, we also provide base classes for creating services that consist of operations. Going back to our user service, we might create an implementation that uses RemoteObject by subclassing the RemoteObjectService class. This class provides basic functionality for delegating to the underlying Remote Object. Here's an example:</p>
<div class="igBar"><span id="lactionscript-21"><a href="#" onclick="javascript:showPlainTxt('actionscript-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-21">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> UserService <span style="color: #0066CC;">extends</span> RemoteObjectService <span style="color: #0066CC;">implements</span> IUserService <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> UserService<span style="color: #66cc66;">&#40;</span>remoteObject:RemoteObject<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span>remoteObject<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> addUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>:IOperation <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"addUser"</span>, user<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> deleteUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>:IOperation <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"deleteUser"</span>, user<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> saveUser<span style="color: #66cc66;">&#40;</span>user:User<span style="color: #66cc66;">&#41;</span>:IOperation <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"saveUser"</span>, user<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> loadAllUsers<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:IOperation <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"loadAllUsers"</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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Notice how easy it is to abstract away the use of a remote object and make clients unaware of this by only providing them with the IUserService interface. The "call" method is a very convenient method to forward the call to the remote object, without having to take care of AsyncTokens and Reponders.</p>
<p><strong>Progress Operations</strong></p>
<p>For operations that take longer to execute the IOperation interface has a subinterface called IProgressOperation. This might for instance be the loading of a sound file, a module, etc. Implementations of this interface can let clients know about the progress the operation made by dispatching progress events at certain intervals. When listening for these events, via the "addProgressListener" method, a ProgressOperationEvent is received that contains a "progress" and "total" property.</p>
<div class="igBar"><span id="lactionscript-22"><a href="#" onclick="javascript:showPlainTxt('actionscript-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-22">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> loadSoundOperation:IProgressOperation = <span style="color: #000000; font-weight: bold;">new</span> MyLoadSoundOperation<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"aSoundFile.mp3"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">loadSoundOperation.<span style="color: #006600;">addProgressListener</span><span style="color: #66cc66;">&#40;</span>loadSoundOperation_progressHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> loadSoundOperation_progressHandler<span style="color: #66cc66;">&#40;</span>event:ProgressOperationEvent<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Loaded "</span> + event.<span style="color: #006600;">progress</span> + <span style="color: #ff0000;">" of "</span> + event.<span style="color: #006600;">total</span> + <span style="color: #ff0000;">" bytes"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Batch Operations</strong></p>
<p>When you are in a scenario where you need to execute several operations and you don't care about the order in which they finish, you might want to use the OperationQueue class. This is an implementation of the IProgressOperation interface that lets you add operations to a queue and receive information about the progress of the complete execution. Since this also is an IOperation, we can listen to the completion of the queue via the "addCompleteListener" method.</p>
<div class="igBar"><span id="lactionscript-23"><a href="#" onclick="javascript:showPlainTxt('actionscript-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-23">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> queue:OperationQueue = <span style="color: #000000; font-weight: bold;">new</span> OperationQueue<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// setup event listeners</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">queue.<span style="color: #006600;">addCompleteListener</span><span style="color: #66cc66;">&#40;</span>queue_completeHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">queue.<span style="color: #006600;">addProgressListener</span><span style="color: #66cc66;">&#40;</span>queue_progressHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// add operations to the queue</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">queue.<span style="color: #006600;">addOperation</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> AnOperation<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">queue.<span style="color: #006600;">addOperation</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> AnotherOperation<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;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">queue.<span style="color: #006600;">addOperation</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> YetAnotherOperation<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> queue_completeHandler<span style="color: #66cc66;">&#40;</span>event:OperationEvent<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Queue is done executing."</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> queue_progressHandler<span style="color: #66cc66;">&#40;</span>event:ProgressOperationEvent<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Executed "</span> + event.<span style="color: #006600;">progress</span> + <span style="color: #ff0000;">" of "</span> + event.<span style="color: #006600;">total</span> + <span style="color: #ff0000;">" operations"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Mocking Operations</strong></p>
<p>During development it is often good to have mock or stub implementations of the services that normally connect to a backend. The main reason is that this provides a way of (unit) testing the use of the services without the backend running. Spring ActionScript provides a class called MockOperation for this purpose. Its constructor takes the following arguments:</p>
<ul>
<li>result: the result returned by the operation</li>
<li>delay (optional): the time the operations waits before completing, in milliseconds (default = 1000)</li>
<li>returnError (optional): a flag indicating wether or not the operation should return an error at random times (default = false)</li>
</ul>
<p>If you would mock the user service, you could do this as follows (only one method is implemented):</p>
<div class="igBar"><span id="lactionscript-24"><a href="#" onclick="javascript:showPlainTxt('actionscript-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-24">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> loadAllUsers<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:IOperation <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000000; font-weight: bold;">var</span> users:ArrayCollection = <span style="color: #000000; font-weight: bold;">new</span> TypedCollection<span style="color: #66cc66;">&#40;</span>User<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; users.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> User<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"John"</span>, <span style="color: #ff0000;">"Doe"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; users.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> User<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Mitch"</span>, <span style="color: #ff0000;">"Hedberg"</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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> MockOperation<span style="color: #66cc66;">&#40;</span>users<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Conclusion</strong></p>
<p>The Operation API provides a neat way of abstracting away technical details and makes it easier to swap implementations without affecting any code. It unifies asynchronous programming for the Flash Player into a simple set of interfaces and base classes. You will also see that it is the basis for other APIs in the Spring ActionScript framework such as the Command and Task API.</p>
<p>For more information on Spring ActionScript, refer to <a href="http://www.springactionscript.org">www.springactionscript.org</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/284/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript 1.0RC1 Released</title>
		<link>http://www.herrodius.com/blog/273</link>
		<comments>http://www.herrodius.com/blog/273#comments</comments>
		<pubDate>Mon, 01 Mar 2010 19:53:52 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Inversion of Control]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=273</guid>
		<description><![CDATA[Dear community,
I'm pleased to announce that the first release candidate for Spring ActionScript 1.0 is now available.
Download&#160;&#124;&#160;API Documentation&#160;&#124;&#160;HTML Docs&#160;&#124;&#160;Changelog
This release is considered feature complete and announces the final stage before moving to a final 1.0 release. 
Amongst the many updates and fixes, these are the most important ones:
 - Operation API (docs, blog)
 - EventBus [...]]]></description>
			<content:encoded><![CDATA[<p>Dear community,</p>
<p>I'm pleased to announce that the first release candidate for Spring ActionScript 1.0 is now available.</p>
<p align='center'><a href="http://www.springactionscript.org/downloads/spring-actionscript-1.0RC1-distribution-with-dependencies.zip">Download</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/asdoc/index.html">API Documentation</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/docs/reference/html/springactionscript.html">HTML Docs</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/changes-report.html">Changelog</a></p>
<p>This release is considered feature complete and announces the final stage before moving to a final 1.0 release. </p>
<p>Amongst the many updates and fixes, these are the most important ones:<br />
 - <strong>Operation API</strong> (<a href="http://www.springactionscript.org/docs/reference/html/the_operation_api.html">docs</a>, <a href="http://www.herrodius.com/blog/284">blog</a>)<br />
 - <strong>EventBus</strong> (<a href="http://www.springactionscript.org/docs/reference/html/the_eventbus.html">docs</a>)<br />
 - <strong>Task API</strong> (<a href="http://www.springactionscript.org/docs/reference/html/the_operation_api.html#tasks">docs</a>)<br />
 - <strong>MXML Configuration</strong> (<a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#composing_mxml_based_configuration_metadata">docs</a>)</p>
<p>These changes will be discussed in a couple of follow-up blogposts, so please check back soon for that. In the meantime, please refer to the documentation provided for more information.</p>
<p>I would like to thank all of you who have given us valuable feedback and provided interesting ideas, sent in patches, reported bugs or helped us out in whatever way possible. Your support has been priceless in the development of this framework and it would not be as rich as it is now without you.</p>
<p>Special thanks go out to Martino for mastering the Maven build system and fixing a lot of the problems that stopped us from releasing earlier, and to Roland who has written 99,9% of the AWESOME documentation and took a natural lead in the development of 1.0RC1. You guys rock!</p>
<p>Enjoy this release and have fun coding!</p>
<p><strong>Spring ActionScript 1.0RC1 Changelog</strong></p>
<ul>
<li>fixed constructor-arg type attribute was not declared in spring-actionscript-objects-1.0.xsd.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/configuration-reference.html#anchor_objectType" target="_blank">config reference link</a></li>
<li>added unregisterStageProcessor() method to the IStageProcessorRegistry interface.<br/>
<p><a href="http://www.springactionscript.org/asdoc/org/springextensions/actionscript/stage/IStageProcessorRegistry.html#unregisterStageProcessor%28%29" target="_blank">ASDoc link</a></li>
<li>added DefaultFlexAutowireProcessor that handles binding using the [Autowired(name="objectName",property="property.chain")] metadata.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#binding_a_stage_component_to_a_property_of_an_object_in_the_container" target="_blank">documentation link</a></li>
<li>added PureMVC documentation section.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/extensions-documentation.html#puremvc" target="_blank">puremvc documentation link</a></li>
<li>added autowiring support for injecting external property values using [Autowired(externalProperty="propertyName")].<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#injecting_a_stage_component_property_with_an_external_property_value" target="_blank">documentation link</a></li>
<li>added parent context support to IObjectFactory interface and AbstractObjectFactory implementation.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#instantiation_through_a_parent_factory" target="_blank">documentation link</a></li>
<li>added skip-postprocessor and skip-metadata support for ObjectDefinition.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#autowiring_stage_components" target="_blank">skip-metadata link</a><br/></p>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#customizing_objects_using_objectpostprocessors" target="_blank">skip-postprocessor link</a></li>
<li>added name and value attribute support to the property XML element, for defining external properties directly in the configuration instead of an external properties file.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#define_external_properties_explicitly" target="_blank">docs link</a></li>
<li>added parent properties support to XMLObjectFactory.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#a_simple_example_of_an_application_context_hierarchy" target="_blank">docs link</a></li>
<li>added IStageProcessorRegistry interface and FlexStageProcessorRegistry implementation to support stage wiring in a multi-module situation (Thanks to Arnoud for helping debug this).<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#the_istageprocessor_interface" target="_blank">docs link</a></li>
<li>added extra functionality to the CairngormFrontController that enables to add commands that are being created by the application context (basically using the context as a commandFactory).<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/extensions-documentation.html#using_the_application_context_as_a_command_factory" target="_blank">cairngorm docs link</a></li>
<li>renamed SASCairngormEvent to SASCairngormModuleEvent.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/extensions-documentation.html#bubbling_your_cairngorm_events_up_to_the_cairngormfrontcontroller" target="_blank">cairngorm docs link</a></li>
<li>ObjectUtils no longer has a dependency on the Flex framework.</li>
<li>added core.* package containing the Operation API.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/the_operation_api.html" target="_blank">operation docs link</a></li>
<li>added core.event.* package containing the EventBus classes.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/the_eventbus.html" target="_blank">eventbus docs link</a></li>
<li>added EventHandlerMetaDataPostProcessor for automatic handling of EventBus events.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/the_eventbus.html#eventbus_event_handling_using_metadata_annotations" target="_blank">eventbus docs link</a></li>
<li>added parallel or sequencential execution to CompositeCommand class.<br/>
<p><a href="http://www.springactionscript.org//docs/reference/html/the_operation_api.html#composite_commands" target="_blank">operation docs link</a></li>
<li>added core.task.* package.<br/>
<p><a href="http://www.springactionscript.org//docs/reference/html/the_operation_api.html#tasks" target="_blank">operation docs link</a></li>
<li>added support for property chain retrieval in the FieldRetrievingObjectFactory, for example: Application.application.systemManager.stage can now be retrieved.</li>
<li>added support for compound property names in XML config.</li>
<li>added support for factory-object in AbstractObjectFactory..<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#instantiation_using_a_factory_method_on a_different_instance" target="_blank">link</a></li>
<li>added TaskNamespaceHandler for core.task.* package.<br/>
<p><a href="http://www.springactionscript.org//docs/reference/html/the_operation_api.html#the_task_namespace_handler" target="_blank">link</a></li>
<li>added createInstance(clazz:Class, constructorArguments:Array = null) method to the IObjectFactory interface to enable a factory to create objects with only annotations and have no object definition.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#instantiating_a_class_with_autowire_annotations" target="_blank">link</a></li>
<li>added operation and service for remoting via NetConnection.<br/>
<p><a href="http://www.springactionscript.org/asdoc/org/springextensions/actionscript/rpc/net/NetConnectionOperation.html" target="_blank">link</a></li>
<li>added support for vector type in XML configuration..<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#collections" target="_blank">link</a></li>
<li>Allow adding mx.flash.Event items to EventSequence and facilitate custom trigger calculation. (Thanks Jurgen).</li>
<li>Added modulePolicy of type ModulePolicy to FlexStageProcessorRegistry that determines how modules will be handled.</li>
<li>Minor documentation fixes. (Thanks Mark).</li>
<li>added RouteEventsMetaDataPostProcessor to re-route events from arbitrary objects through the EventBus.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/the_eventbus.html#routing_other_events_through_the_eventbus" target="_blank">link</a></li>
<li>Added IApplicationDomainAware and ApplicationDomainAwarePostProcessor to automatically inject the context's application domain in objects that need a reference.</li>
<li>Added MethodInvokingFactoryObject to be able to inject method results from other objects.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#injecting_method_invocation_results_from_other_objects" target="_blank">link</a></li>
<li>Added util:invoke element as a configuration shortcut for the MethodInvokingFactoryObject.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/xml-schema-based-configuration.html#util_invoke" target="_blank">link</a></li>
<li>Added support for injecting the application context by using ref="this" in the configuration.<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#injecting_the_application_context_using_the_this_reference" target="_blank">link</a></li>
<li>Added Maven mojo to generate a flex-config file from an application context (Thanks Ryan).<br/>
<p><a href="http://www.springactionscript.org/docs/reference/html/Class-inclusion.html#using_maven" target="_blank">link</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/273/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PNGSizeExtractor</title>
		<link>http://www.herrodius.com/blog/265</link>
		<comments>http://www.herrodius.com/blog/265#comments</comments>
		<pubDate>Fri, 12 Feb 2010 21:07:58 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=265</guid>
		<description><![CDATA[I was trying to read the dimensions of some very large image files today when I bumped into the Flash Player 10 limitations regarding maximum image sizes. (More info about this is available here.) Since an image file that is too big will not be shown correctly, there is no use in uploading and using [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to read the dimensions of some very large image files today when I bumped into the Flash Player 10 limitations regarding maximum image sizes. (More info about this is available <a href="http://kb2.adobe.com/cps/496/cpsid_49662.html">here</a>.) Since an image file that is too big will not be shown correctly, there is no use in uploading and using it. I wanted to provide detailed feedback about the image dimensions and how they exceeded the allowed sizes, but that was not possible unfortunately since the width and height properties of the loaded image would remain 0. (I posted a question on StackOverflow about this issue <a href="http://stackoverflow.com/questions/2252693/get-dimension-of-locally-loaded-large-image">here</a>.)</p>
<p>The <a href="http://www.anttikupila.com/flash/getting-jpg-dimensions-with-as3-without-loading-the-entire-file/">JPGSizeExtractor</a> class by Antti Kupila enables you to read the width and height of a JPG by reading the image's bytecode. Since we also need to support PNG files, I thought I'd create a simple PNGSizeExtractor myself.</p>
<p>Here's the code:</p>
<div class="igBar"><span id="lactionscript-28"><a href="#" onclick="javascript:showPlainTxt('actionscript-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-28">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package com.<span style="color: #006600;">herrodius</span>.<span style="color: #006600;">utils</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">ByteArray</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; * Reads the width and height from a PNG image.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; *</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; * http://en.wikipedia.org/wiki/Portable_Network_Graphics</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; * http://www.libpng.org/pub/png/spec/1.2/png-1.2-pdg.html</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; *</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; * @author Christophe Herreman</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<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;">class</span> PNGSizeExtractor <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const SIGNATURE_BYTES:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span>0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A<span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const CHUNK_TYPE_SIZE:uint = <span style="color: #cc66cc;color:#800000;">4</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// --------------------------------------------------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Constructor</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// --------------------------------------------------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> PNGSizeExtractor<span style="color: #66cc66;">&#40;</span>byteArray:ByteArray<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; decode<span style="color: #66cc66;">&#40;</span>byteArray<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// --------------------------------------------------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Public Properties</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// --------------------------------------------------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ----------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// width</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ----------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">_width</span>:uint;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> <span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:uint <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">_width</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ----------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// height</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ----------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">_height</span>:uint;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> <span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:uint <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">_height</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// --------------------------------------------------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Private Methods</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// --------------------------------------------------------------------</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> decode<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>:ByteArray<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;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; readSignature<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; readIHDR<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> readSignature<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>:ByteArray<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:uint = <span style="color: #cc66cc;color:#800000;">0</span>; i&lt;SIGNATURE_BYTES.<span style="color: #0066CC;">length</span>; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>.<span style="color: #006600;">readUnsignedByte</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> != SIGNATURE_BYTES<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"File is not a PNG file."</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> readIHDR<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>:ByteArray<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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">size</span>:uint = <span style="color: #0066CC;">data</span>.<span style="color: #006600;">readUnsignedInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">type</span>:<span style="color: #0066CC;">String</span> = <span style="color: #0066CC;">data</span>.<span style="color: #006600;">readUTFBytes</span><span style="color: #66cc66;">&#40;</span>CHUNK_TYPE_SIZE<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">_width</span> = <span style="color: #0066CC;">data</span>.<span style="color: #006600;">readUnsignedInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">_height</span> = <span style="color: #0066CC;">data</span>.<span style="color: #006600;">readUnsignedInt</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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<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;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>And here's how to use it. (byteArray is the data of the loaded PNG):</p>
<div class="igBar"><span id="lactionscript-29"><a href="#" onclick="javascript:showPlainTxt('actionscript-29'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-29">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> pngDecoder:PNGSizeExtractor = <span style="color: #000000; font-weight: bold;">new</span> PNGSizeExtractor<span style="color: #66cc66;">&#40;</span>byteArray<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>pngDecoder.<span style="color: #0066CC;">width</span>, pngDecoder.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>And here is a small sample application that loads the file locally:</p>
<div class="igBar"><span id="lactionscript-30"><a href="#" onclick="javascript:showPlainTxt('actionscript-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-30">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">"1.0"</span>?&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;mx:Application xmlns:mx=<span style="color: #ff0000;">"http://www.adobe.com/2006/mxml"</span> horizontalAlign=<span style="color: #ff0000;">"left"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:Script&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">herrodius</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">PNGSizeExtractor</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _fileReference:FileReference;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> browseButton_clickHandler<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;_fileReference = <span style="color: #000000; font-weight: bold;">new</span> FileReference<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;_fileReference.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">SELECT</span>, fileReference_selectHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;_fileReference.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, fileReference_completeHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;_fileReference.<span style="color: #006600;">browse</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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> fileReference_selectHandler<span style="color: #66cc66;">&#40;</span>event:Event<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;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;_fileReference.<span style="color: #0066CC;">load</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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> fileReference_completeHandler<span style="color: #66cc66;">&#40;</span>event:Event<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;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileNameTextInput.<span style="color: #0066CC;">text</span> = _fileReference.<span style="color: #0066CC;">name</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> pngDecoder:PNGSizeExtractor = <span style="color: #000000; font-weight: bold;">new</span> PNGSizeExtractor<span style="color: #66cc66;">&#40;</span>_fileReference.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textArea.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">"Width: "</span> + pngDecoder.<span style="color: #0066CC;">width</span> + <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textArea.<span style="color: #0066CC;">text</span> += <span style="color: #ff0000;">"Height: "</span> + pngDecoder.<span style="color: #0066CC;">height</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #0066CC;">catch</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:<span style="color: #0066CC;">Error</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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">message</span>, <span style="color: #ff0000;">"Error decoding image"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/mx:Script&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:Label <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">"Browse for a PNG file."</span> fontWeight=<span style="color: #ff0000;">"bold"</span>/&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:HBox <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"100%"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;mx:TextInput id=<span style="color: #ff0000;">"fileNameTextInput"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"100%"</span> editable=<span style="color: #ff0000;">"false"</span>/&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;mx:<span style="color: #0066CC;">Button</span> id=<span style="color: #ff0000;">"browseButton"</span> label=<span style="color: #ff0000;">"..."</span> click=<span style="color: #ff0000;">"browseButton_clickHandler(event)"</span>/&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/mx:HBox&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;mx:TextArea id=<span style="color: #ff0000;">"textArea"</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">"100%"</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">"100%"</span>/&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/mx:Application&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/265/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript Devoxx slides</title>
		<link>http://www.herrodius.com/blog/255</link>
		<comments>http://www.herrodius.com/blog/255#comments</comments>
		<pubDate>Thu, 19 Nov 2009 20:50:22 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Inversion of Control]]></category>
		<category><![CDATA[Spring ActionScript]]></category>
		<category><![CDATA[Talks]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=255</guid>
		<description><![CDATA[Here are the slides of the presentation I did on Spring ActionScript at the Devoxx conference 2009. The sample application will be available in the upcoming 0.9 release, so stay tuned. A pdf version is also available here.
If you have any specific questions you can post them in the comments or check our forum.
Enjoy.

Spring Actionscript [...]]]></description>
			<content:encoded><![CDATA[<p>Here are the slides of the presentation I did on Spring ActionScript at the <a href="http://www.devoxx.com">Devoxx</a> conference 2009. The sample application will be available in the upcoming 0.9 release, so stay tuned. A pdf version is also available <a href="http://www.herrodius.com/upload/spring-actionscript-devoxx-2009.pdf">here</a>.</p>
<p>If you have any specific questions you can post them in the comments or check our <a href="http://forum.springsource.org/forumdisplay.php?f=60">forum</a>.</p>
<p>Enjoy.</p>
<p><center>
<div style="width:425px;text-align:left" id="__ss_2539723"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/herrodius/spring-actionscript-at-devoxx" title="Spring Actionscript at Devoxx">Spring Actionscript at Devoxx</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=spring-actionscript-091119143443-phpapp01&#038;stripped_title=spring-actionscript-at-devoxx" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=spring-actionscript-091119143443-phpapp01&#038;stripped_title=spring-actionscript-at-devoxx" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/herrodius">herrodius</a>.</div>
</div>
<p></center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/255/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript at the Devoxx Conference</title>
		<link>http://www.herrodius.com/blog/232</link>
		<comments>http://www.herrodius.com/blog/232#comments</comments>
		<pubDate>Mon, 19 Oct 2009 19:03:55 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=232</guid>
		<description><![CDATA[On November 18th, I'll be doing a presentation on Spring ActionScript at this year's Devoxx conference in Antwerp, Belgium. The conference formerly known as JavaPolis is the biggest European (Java) Developers conference.This 5 day conference has an impressive speaker list each year, lots of quality content and is extremely cheap compared to other conferences. So [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.herrodius.com/blog/wp-content/uploads/2009/10/devoxx.jpeg" alt="devoxx" title="devoxx" width="300" height="112" class="alignright size-full wp-image-233" />On November 18th, I'll be doing a presentation on <a href="http://www.springactionscript.org/">Spring ActionScript</a> at this year's <a href="http://www.devoxx.com">Devoxx</a> conference in Antwerp, Belgium. The conference formerly known as JavaPolis is the biggest European (Java) Developers conference.This 5 day conference has an impressive speaker list each year, lots of quality content and is extremely cheap compared to other conferences. So even with the economic crisis, there is no reason not to be there...</p>
<p>Here's the abstract of my presentation (<a href="http://www.devoxx.com/display/DV09/Spring+ActionScript">link</a>):</p>
<blockquote><p>Spring ActionScript is an offshoot of Java Spring and brings Inversion of Control to the Flash Platform. Primarily focusing on Flex and AIR development, you'll learn how this framework can be used to build testable and maintainable applications. We'll take a look at the different kinds of configuration options and will also see how the minimal MVCS infrastructure fits into an application.</p></blockquote>
<p>If you're there and are interested in Flex development, then this session is for you.</p>
<p>I'm currently preparing samples and slides, so if you have anything in particular you would like to see covered, feel free to leave something in the comments. Or if you are attending the conference and would like to meet up, leave a comment as well.</p>
<p>Looking forward to seeing you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/232/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Thoughts on Cairngorm 3 and Application Architecture</title>
		<link>http://www.herrodius.com/blog/216</link>
		<comments>http://www.herrodius.com/blog/216#comments</comments>
		<pubDate>Tue, 06 Oct 2009 20:40:25 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[AS3Commons]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Cairngorm]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Inversion of Control]]></category>
		<category><![CDATA[Lessons learned]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=216</guid>
		<description><![CDATA[Cairngorm 3 was recently announced by Tom Sugden and Alex Uhlmann and has now been released in beta on the Adobe Opensource site.
Don't expect an updated version of the Cairngorm framework as you know it though. Cairngorm 3 is not aiming to be an MVC implementation, and thus moves away from what version 1 and [...]]]></description>
			<content:encoded><![CDATA[<p>Cairngorm 3 was recently announced by <a href="http://blogs.adobe.com/tomsugden/2009/09/coming_soon_cairngorm_3_1.html">Tom Sugden</a> and <a href="http://blogs.adobe.com/auhlmann/archives/2009/10/cairngorm_3_bet.html">Alex Uhlmann</a> and has now been <a href="http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm+3">released in beta</a> on the Adobe Opensource site.</p>
<p>Don't expect an updated version of the Cairngorm framework as you know it though. Cairngorm 3 is not aiming to be an MVC implementation, and thus moves away from what version 1 and 2 were, but now consists of a set of patterns and practices, together with a series of libraries that can help to solve common problems.</p>
<p>The Patterns &#038; Practices Group at Microsoft have been promoting <a href="http://www.codeplex.com/CompositeWPF">a similar mindset</a> for quite some time actually: Prism - patterns &#038; practices Composite Application Guidance for WPF</p>
<p>I can only encourage this decision as it is exactly how I personally think about application design and architecture, especially in Flex and AIR applications. This is also what we are trying to do with <a href="http://www.springactionscript.org">Spring ActionScript</a>: our main goal is to provide a solid Inversion of Control container that supports multiple configuration options (XML, MXML, metadata driven component scanning, ...) and promote it as a foundation to build applications (and frameworks), with or without your favorite MVC framework. Although we are working on a set of base classes that provide infrastructure for your application (under the name MVCS) with Application Events, Controllers, Abstractions for service layers, ... by no means do we want to market the Spring ActionScript framework as yet another MVC implementation. (You might wonder why we are calling it MVCS then, and I'm actually wondering the same... I guess marketing and buzzwords in the opensource world are also important. All kidding aside, the name is certainly subject to change).</p>
<p><strong>What's in a name</strong></p>
<p>Since this is a complete change of direction for the Cairngorm framework (which it actually no longer is) I would have expected a new name. Continuing to use Cairngorm as a name is in my opinion a bad move and will cause major confusion amongst developers and other people involved in the development process. I think the best thing for Adobe, or at least their Technical Services department, would be to let go of the name and choose a new, fresh name that moves away from the past. (Besides that, who can pronounce "Cairngorm".)</p>
<p><strong>Dependencies</strong></p>
<p>I noticed that some of the modules that Cairngorm 3 provides depend on other libraries/frameworks, and in general the <a href="http://www.spicefactory.org/parsley/">Parsley</a> application framework. While Parsley is certainly a major player amongst the IoC/application frameworks, and I sincerely respect the author's work, I don't think this is a good decision. In case you are wondering: Yes, I would say the same thing if they decided to depend on Spring ActionScript.</p>
<p>The usage and choice of a concrete dependency will have consequences for the adoption and integration of the libraries that Cairngorm 3 provides. Think about it: Why would you want to pull in Parsley, perhaps only to use some of its Reflection API, if you are already running on Spring ActionScript or any other IoC container?</p>
<p>We, the Spring ActionScript team, have actually questioned ourselves about this in the past and have therefore decided to move all the common and reusable code from Spring ActionScript into a set of libraries known as the <a href="http://www.as3commons.org">AS3Commons</a> project. In that respect, I'm a bit disappointed that for instance the <a href="http://www.as3commons.org/as3-commons-reflect">AS3Commons Reflect</a> library is not used for reflection purposes, since I think it is more abstracted and unintrusive than a subset of an all-encompassing application framework. Perhaps this may be our fault of not promoting the libraries and the project enough. However, I certainly think that AS3Commons could be a wonderful project and would help to provide common libraries not only to Flex and AIR developers, but to ActionScript 3 developers in general, if it were embraced by the community.</p>
<p><strong>Flex and MVC</strong></p>
<p>Given that RIA technolgies are still evolving at a very fast pace, it is really remarkable to see the huge amount of MVC implementations appear. Not specifically aimed at Cairngorm (at least the previous versions), but rather at almost all MVC architectures available for Flex development, my personal feeling and experience is that the use of MVC architectures in the Adobe RIA space is almost a dogmatic thing and is not needed in most cases. The problem is that people just take an MVC framework as it is and implement it in their applications. More than often not questioning whether or not its usage is justified. Things that could easily and cleverly be solved are ripped apart across layers of the architecture, introducing levels of indirection that are in most cases not needed. The only thing they add is complexity and counter-intuitive development practices.</p>
<p>One of the main arguments for using an MVC framework is that the code is "easy to understand". Of course the code will be easy to understand if you have been developing with the framework of choice for the N-th time or if you have been digging into the code for a serious amount of time, but ask a newcomer to look at the code and try to explain to you what it is actually doing... I think you'll be surprised by the responses.</p>
<p>I'm not saying that the use of a particular MVC framework is de facto a bad thing, but the "religious" use and the blind adoption and implementation make a framework a killer for your application. I would encourage everyone to start their next project without an MVC framework and just use the Flex framework with a healthy knowledge of design and presentation patterns. And even if you are using an MVC implementation, think about each layer you introduce, why you need it and the pros and cons it brings.</p>
<p><strong>Conclusion</strong></p>
<p>It's good to see that Adobe is rethinking their approach to RIA architecture and development practices. I also hope that they will be more open to community input and feedback than they were in the past. Although they did several attempts at engaging the community, I don't think they really succeeded in that. If not open enough, people will just continue to fork the "framework" and provide extensions that will end up in alternative implementations anyway.</p>
<p>I'm looking forward to seeing how all of this evolves.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/216/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript 0.8.1 Released</title>
		<link>http://www.herrodius.com/blog/208</link>
		<comments>http://www.herrodius.com/blog/208#comments</comments>
		<pubDate>Tue, 15 Sep 2009 20:02:27 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=208</guid>
		<description><![CDATA[Dear Community,
I'm pleased to announce that the Spring ActionScript 0.8.1 release is now available.
Download&#160;&#124;&#160;API Documentation&#160;&#124;&#160;HTML Docs&#160;&#124;&#160;PDF Docs&#160;&#124;&#160;Changelog
This release includes the Spring ActionScript framework, the Cairngorm extensions and the PureMVC extensions and is mainly a bugfix release based on user feedback, for which we are very grateful.
Besides a series of bugfixes, we have also refactored the [...]]]></description>
			<content:encoded><![CDATA[<p>Dear Community,</p>
<p>I'm pleased to announce that the Spring ActionScript 0.8.1 release is now available.</p>
<p align='center'><a href="http://www.springactionscript.org/downloads/spring-actionscript-0.8.1-distribution-with-dependencies.zip">Download</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/asdoc/index.html">API Documentation</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/docs/reference/html/springactionscript.html">HTML Docs</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/docs/reference/pdf/springactionscript.pdf">PDF Docs</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/changes-report.html">Changelog</a></p>
<p>This release includes the Spring ActionScript framework, the Cairngorm extensions and the PureMVC extensions and is mainly a bugfix release based on user feedback, for which we are very grateful.</p>
<p>Besides a series of bugfixes, we have also refactored the stage wiring system a bit so it now enables you to extend it with custom functionality. Two proof-of-concept implementations were added, namely the <a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#the_localizationstageprocessor_class">LocalizationStageProcessor</a> and the <a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#the_simplesecuritystageprocessor_class">SimpleSecurityStageProcessor</a>.</p>
<p><strong>LocalizationStageProcessor</strong></p>
<p>This first processor enables you to assign resource values to components that are added to the stage, thus removing the need to add binding code for components at design-time. The values are assigned on a simple 'configuration-by-name' basis: a resource string in the form 'myButton_label=Click me' will assign the value 'Click me' to the label property of a stage component with the id 'myButton'.</p>
<p>There's a small <a href="https://src.springframework.org/svn/se-springactionscript-as/trunk/spring-actionscript-core/samples/localization/src/">sample app</a> as well showcasing the localization processor.</p>
<p><strong>SimpleSecurityStageProcessor</strong></p>
<p>The second processor is slightly more elaborate and offers runtime security/authorization functionality.</p>
<p>There's also a small <a href="https://src.springframework.org/svn/se-springactionscript-as/trunk/spring-actionscript-core/samples/security/src/">sample application</a> for this processor.</p>
<p>Basically what this processor does is create an ISecurityManager instance for a given component that is added to the stage. (Whether or not this creation will be considered is determined by the approval result of an IObjectSelector). This ISecurityManager holds a list of role and right names that are applicable for the specified stage component and is able to block access to the component after evaluation of these security rules.</p>
<p>The way to block access is determined by the AccessStrategy enum, that is part of the SimpleStageSecurityManager implementation of the ISecurityManager. It can set the enabled property to false, or visible to false, etc. The implementation of these security interfaces is SIMPLE, hence the names. For now, we didn't want to include a very elaborate implementation since security can vary very widely from application to application. These interfaces are really meant as a 'roll-your-own' package, Spring ActionScript just offers the infrastructure in this case.</p>
<p><strong>Last Words</strong></p>
<p>Although this is a minor release, we would recommend all users to upgrade.</p>
<p>Further, we are always looking for user feedback and input. Be it bug reports, patches, new ideas, etc, all help is welcome. If you think you can contribute to the project in whatever way, don't hesitate to leave something in the comments or mail me at christophe [DOT] herreman [AT] gmail [DOT] com.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/208/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Marking Deprecated Classes and Methods in Flex</title>
		<link>http://www.herrodius.com/blog/190</link>
		<comments>http://www.herrodius.com/blog/190#comments</comments>
		<pubDate>Sat, 12 Sep 2009 09:40:49 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[IntelliJ IDEA]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=190</guid>
		<description><![CDATA[A feature of the Flex SDK is that you can mark deprecated classes and methods via the [Deprecated] metadata tag. The goal of deprecating code is to inform developers that code will disappear in an upcoming release of a library or framework. Developers can then change their code to use the appropriate replacement and prevent [...]]]></description>
			<content:encoded><![CDATA[<p>A feature of the Flex SDK is that you can mark deprecated classes and methods via the [Deprecated] metadata tag. The goal of deprecating code is to inform developers that code will disappear in an upcoming release of a library or framework. Developers can then change their code to use the appropriate replacement and prevent problems when upgrading to newer versions. For more info, read <a href="http://java.sun.com/j2se/1.4.2/docs/guide/misc/deprecation/deprecation.html">How and When to Deprecate APIs</a>.</p>
<blockquote><p>The need for deprecation comes about because, as a class evolves, its API changes. Methods are renamed for consistency. New and better methods are added. Attributes change. But making such changes introduces a problem. You need to keep the old API around until people make the transition to the new one, but you don't want developers to continue programming to the old API.</p></blockquote>
<p>Here's an example:</p>
<div class="igBar"><span id="lactionscript-33"><a href="#" onclick="javascript:showPlainTxt('actionscript-33'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-33">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package org.<span style="color: #006600;">as3commons</span>.<span style="color: #006600;">reflect</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#91;</span>Deprecated<span style="color: #66cc66;">&#40;</span>replacement=<span style="color: #ff0000;">"org.as3commons.lang.ClassUtils"</span>, since=<span style="color: #ff0000;">"1.1"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ClassUtils <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Deprecated<span style="color: #66cc66;">&#40;</span>replacement=<span style="color: #ff0000;">"org.as3commons.lang.ClassUtils.forInstance()"</span>, since=<span style="color: #ff0000;">"1.1"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> forInstance<span style="color: #66cc66;">&#40;</span>instance:*, applicationDomain:ApplicationDomain = <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #000000; font-weight: bold;">Class</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ... method body ommitted</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<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;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&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;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Depending on the IDE you are using, you will even get visual hints when you are using deprecated code. Here's how <a href="http://www.jetbrains.com/idea/">IntelliJ IDEA</a> supports this. (Click to enlarge)</p>
<p><a href="http://www.herrodius.com/blog/wp-content/uploads/2009/09/intellij-idea-deprecated-hint.png" target="_blank"><img src="http://www.herrodius.com/blog/wp-content/uploads/2009/09/intellij-idea-deprecated-hint.png" alt="intellij-idea-deprecated-hint" title="intellij-idea-deprecated-hint" width="630" height="220" class="alignnone size-full wp-image-192" /></a></p>
<p>Note that I'm using an early build of the upcoming version 9 of IntelliJ IDEA, codenamed "Maia", in which Flex support has significantly been improved. You can get the prereleases <a href="http://http://www.jetbrains.net/confluence/display/IDEADEV/Maia+EAP">here</a>.</p>
<p>You can also use this on other metadata tags such as Style, but in a slightly different form:</p>
<div class="igBar"><span id="lactionscript-34"><a href="#" onclick="javascript:showPlainTxt('actionscript-34'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-34">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>Style<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">"backgroundColor"</span>, <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">"uint"</span>, format=<span style="color: #ff0000;">"Color"</span>, inherit=<span style="color: #ff0000;">"no"</span>, deprecatedReplacement=<span style="color: #ff0000;">"swatchPanelStyleName"</span>, deprecatedSince=<span style="color: #ff0000;">"3.0"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>For more info on the [Deprecated] metadata tag, see the <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=metadata_3.html#172179">Flex documentation</a>.</p>
<p>I haven't tested how deprecations are handled in Flex/Flash Builder and the ASDoc system. If anyone knows, don't hesitate to add extra info in the comments and I will update this post.</p>
<p><strong>Update</strong> The [Deprecated] metadata tag was posted about some time ago in <a href="http://nondocs.blogspot.com/2007/05/metadatadeprecated.html">this blogpost</a>, which made me believe it was undocumented or at least it was at the time of writing. Thanks to Bobby Parker for posting the link to the Flex 3 docs in which the metadata is clearly documented.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/190/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Spring ActionScript 0.8 Released</title>
		<link>http://www.herrodius.com/blog/176</link>
		<comments>http://www.herrodius.com/blog/176#comments</comments>
		<pubDate>Fri, 17 Jul 2009 16:20:56 +0000</pubDate>
		<dc:creator>Christophe</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Spring ActionScript]]></category>

		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=176</guid>
		<description><![CDATA[Dear Community,
I'm pleased to announce that the Spring ActionScript 0.8 release is now available.
Download&#160;&#124;&#160;API Documentation&#160;&#124;&#160;HTML Docs&#160;&#124;&#160;PDF Docs&#160;&#124;&#160;Changelog
This release includes the Spring ActionScript framework, the Cairngorm extensions and the PureMVC extensions.
All libraries are available for download at the following Maven repository: http://projects.yoolab.org/maven/content/repositories/
From now on, we will regularly publish new snapshots of the libraries there.
Direct links to [...]]]></description>
			<content:encoded><![CDATA[<p>Dear Community,</p>
<p>I'm pleased to announce that the Spring ActionScript 0.8 release is now available.</p>
<p align='center'><a href="http://projects.yoolab.org/maven/content/repositories/releases/org/springextensions/actionscript/spring-actionscript-core/0.8/spring-actionscript-core-0.8.swc">Download</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/asdoc/index.html">API Documentation</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/docs/reference/html/springactionscript.html">HTML Docs</a>&nbsp;|&nbsp;<a href="http://www.springactionscript.org/docs/reference/pdf/springactionscript.pdf">PDF Docs</a>&nbsp;|&nbsp;<a href="http://www.pranaframework.org/docs/0.8/changelog.txt">Changelog</a></p>
<p>This release includes the Spring ActionScript framework, the Cairngorm extensions and the PureMVC extensions.</p>
<p>All libraries are available for download at the following Maven repository: <a href="http://projects.yoolab.org/maven/content/repositories/">http://projects.yoolab.org/maven/content/repositories/</a></p>
<p>From now on, we will regularly publish new snapshots of the libraries there.</p>
<p>Direct links to the libraries:<br />
- <a href="http://projects.yoolab.org/maven/content/repositories/releases/org/springextensions/actionscript/spring-actionscript-core/0.8/spring-actionscript-core-0.8.swc">Spring ActionScript 0.8</a><br />
- <a href="http://projects.yoolab.org/maven/content/repositories/releases/org/springextensions/actionscript/spring-actionscript-cairngorm/0.8/spring-actionscript-cairngorm-0.8.swc">Spring ActionScript Cairngorm 0.8</a><br />
- <a href="http://projects.yoolab.org/maven/content/repositories/releases/org/springextensions/actionscript/spring-actionscript-puremvc-standard/0.8/spring-actionscript-puremvc-standard-0.8.swc">Spring ActionScript PureMVC 0.8</a></p>
<p>Dependencies:<br />
- <a href="http://projects.yoolab.org/maven/content/repositories/snapshots/org/as3commons/as3commons-lang/1.0.0-SNAPSHOT/as3commons-lang-1.0.0-20090716.151324-14.swc">AS3Commons Lang</a><br />
- <a href="http://projects.yoolab.org/maven/content/repositories/releases/org/as3commons/as3commons-logging/1.0.0/as3commons-logging-1.0.0.swc">AS3Commons Logging</a><br />
- <a href="http://projects.yoolab.org/maven/content/repositories/releases/org/as3commons/as3commons-reflect/1.0.0/as3commons-reflect-1.0.0.swc">AS3Commons Reflect</a></p>
<p><em>Note: AS3Commons Lang is a snapshot of 1.0. We will work with a release for the following releases of Spring ActionScript</em></p>
<p>Besides a series of bugfixes, optimizations and improvements, some of the major changes and enhancements include:</p>
<p><strong>Autowiring support</strong></p>
<p>Using autowiring allows you to inject objects managed by the container into view components and other objects. To autowire a property, annotate it with the [Autowired] metadata tag. The support we build in is pretty enhanced and allows you to customize the autowire behavior in many different ways. Within the Autowired metadata tag you can specify the object name and you can also configure the container to filter autowire candidates using your own filter specifications. Please see the <a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#autowiring_objects">documentation on autowiring</a> for more info.</p>
<p><strong>Custom Namespaces</strong></p>
<p>The XML configuration now supports namespaces and allows you to create custom namespaces yourself. A few namespaces have been added to simplify the configuration of common objects for RMI and Messaging. More info on <a href="http://www.springactionscript.org/docs/reference/html/xml-schema-based-configuration.html">available namespaces and schemas</a> and <a href="http://www.springactionscript.org/docs/reference/html/extensible_xml_authoring.html">creating custom ones</a> can be found in the documentation. The XSD schemas are available <a href="http://www.springactionscript.org/schema/">http://www.springactionscript.org/schema/</a></p>
<p><strong>MXML Configuration</strong></p>
<p>We now also support configuration through MXML. The markup is very similar to the regular XML config, but with some slight differences. Please see the documentation on <a href="http://www.springactionscript.org/docs/reference/html/container-documentation.html#composing_mxml_based_configuration_metadata">MXML Configuration</a></p>
<p><strong>AS3Commons</strong></p>
<p>As a side project, we have started the <a href="http://www.as3commons.org">AS3Commons</a> project that offers reusable ActionScript 3.0 libraries. Most of the libraries currently available in AS3Commons are build using code from the Spring ActionScript framework. This means that a lot of code has been removed from Spring ActionScript and is now available for use in projects not using Spring ActionScript. Please note that you might have to update quite some import statements to refer to AS3Commons instead of Spring ActionScript. We apologize for any inconvenience this might cause, but this is only a one-time process.</p>
<p>We hope you find the AS3Commons libraries useful. All libraries (releases and snapshots) can also be found at the <a href="https://dev.yoolab.org/maven/content/repositories/">Maven repository</a>.</p>
<p><strong>Documentation</strong></p>
<p>The documentation has been tremendously improved in this version. Next to the <a href="http://www.springactionscript.org/asdoc/index.html">API documentation</a>, we now provide a reference guide in <a href="http://www.springactionscript.org/docs/reference/html/springactionscript.html">HTML</a> and <a href="http://www.springactionscript.org/docs/reference/pdf/springactionscript.pdf">PDF</a> format. General info can be found at the project website: <a href="http://www.springactionscript.org">www.springactionscript.org</a></p>
<p><strong>Last Words</strong></p>
<p>If you feel like helping us out, we could certainly use your help. This project is entirely created on a volunteer basis and in our spare (and limited) free time so needless to say that the more people, the faster we can deliver new releases and guarantee the quality of the framework. So if you think you have someting to offer, be it as a developer, tester, documentation writer, sample creator, ... please contact me (christophe [DOT] herreman [AT] gmail [DOT] com) or leave something in the comments. All help is more than welcome.</p>
<p>Enjoy this release and have fun coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.herrodius.com/blog/176/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>
