<?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>undefined-type &#187; chain</title>
	<atom:link href="http://undefined-type.com/tag/chain/feed/" rel="self" type="application/rss+xml" />
	<link>http://undefined-type.com</link>
	<description>Flex,Flash &#38; AIR</description>
	<lastBuildDate>Wed, 18 Nov 2009 09:48:23 +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>Cairngorm &#8211; Chain Events</title>
		<link>http://undefined-type.com/2008/08/cairngorm-chain-events/</link>
		<comments>http://undefined-type.com/2008/08/cairngorm-chain-events/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 17:51:20 +0000</pubDate>
		<dc:creator>Bäcker</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[cairngorm]]></category>
		<category><![CDATA[chain]]></category>
		<category><![CDATA[event]]></category>

		<guid isPermaLink="false">http://localhost/undefined_type_/?p=166</guid>
		<description><![CDATA[Found an Example of Chain Events at http://www.cairngormdocs.org/bjorn_schultheiss/eventChaining/EventChainExample.html (right click and check source).
So I put the code to an default Cairngorm Structure that you can download here. Just make sure that you have the Cairngorm.swc package in libs.
This is what files that exist.

Important to think of:
1.) All events extends ChainEvent

public class TestAEvent extends ChainEvent

2.) All [...]]]></description>
			<content:encoded><![CDATA[<p>Found an Example of Chain Events at <a href="http://www.cairngormdocs.org/bjorn_schultheiss/eventChaining/EventChainExample.html">http://www.cairngormdocs.org/bjorn_schultheiss/eventChaining/EventChainExample.html</a> (right click and check source).</p>
<p>So I put the code to an default Cairngorm Structure that you can <a href="http://undefined-type.com/wp-content/cairngormdefault.zip">download here</a>. Just make sure that you have the Cairngorm.swc package in libs.</p>
<p>This is what files that exist.</p>
<p><a href="http://undefined-type.com/wp-content/cairngormdefault.png" rel="lightbox[166]"><img class="alignnone size-full wp-image-250" title="cairngormdefault" src="http://undefined-type.com/wp-content/cairngormdefault.png" alt="cairngormdefault" width="294" height="473" /></a></p>
<p><strong>Important to think of:</strong><br />
1.) All events extends ChainEvent</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestAEvent <span style="color: #0066CC;">extends</span> ChainEvent</pre></div></div>

<p>2.) All commands extends SequenceCommand</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestACommand <span style="color: #0066CC;">extends</span> SequenceCommand <span style="color: #0066CC;">implements</span> ICommand</pre></div></div>

<p>3.) All commands take the nextEvent and execute when done.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> execute<span style="color: #66cc66;">&#40;</span>event:CairngormEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
    nextEvent = ChainEvent<span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">nextChainedEvent</span>;
    <span style="color: #808080; font-style: italic;">// Do Command Action</span>
    <span style="color: #0066CC;">this</span>.<span style="color: #006600;">executeNextCommand</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>That&#8217;s is&#8230;<br />
Here is an example of executing a couple of commands.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> beginChain : ChainEvent = EventChainFactory.<span style="color: #006600;">chainEvents</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>
    <span style="color: #000000; font-weight: bold;">new</span> UpdateViewEvent<span style="color: #66cc66;">&#40;</span>ModelData.<span style="color: #006600;">VIEW_LOADING</span><span style="color: #66cc66;">&#41;</span>,
    <span style="color: #000000; font-weight: bold;">new</span> CheckSoftwareVersionEvent<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>,
    <span style="color: #000000; font-weight: bold;">new</span> GetLocalSettingsEvent<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>,
    <span style="color: #000000; font-weight: bold;">new</span> GlobalApplicationEvent<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>,
    <span style="color: #000000; font-weight: bold;">new</span> GetFeedListEvent<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>,
    <span style="color: #000000; font-weight: bold;">new</span> UpdatePostStatusEvent<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>,
    <span style="color: #000000; font-weight: bold;">new</span> UpdateViewEvent<span style="color: #66cc66;">&#40;</span>ModelData.<span style="color: #006600;">VIEW_POSTS</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
cgDispatcher.<span style="color: #006600;">dispatchEvent</span><span style="color: #66cc66;">&#40;</span> beginChain <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<strong>UPDATE: 2008-02-21</strong><br />
I&#8217;ve added a couple of changes for the demo files.<br />
E.g. when creating an event it&#8217;s possible to send custom data<br />
new TestAEvent( &#8220;CustomValue&#8221; )<br />
and it&#8217;s just as easy to extract it in the command</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> customEventValue:<span style="color: #66cc66;">*</span> = event.<span style="color: #0066CC;">data</span>;</pre></div></div>

<p>You can add any data to the next event in the chain from the command, maybe to pass forward the data or something new. Here is an example.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">nextEvent.<span style="color: #0066CC;">data</span> = customEventValue;</pre></div></div>

<p>You can as well runtime change the next event from a command, here is an example.</p>

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

]]></content:encoded>
			<wfw:commentRss>http://undefined-type.com/2008/08/cairngorm-chain-events/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

