<?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>Soundstep</title>
	<atom:link href="http://www.soundstep.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.soundstep.com/blog</link>
	<description>Soundstep is a blog containing resources for developers, such as open source projects, libraries, frameworks, tutorials and experiments.</description>
	<lastBuildDate>Thu, 26 Apr 2012 12:45:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>soma.js router plugin</title>
		<link>http://www.soundstep.com/blog/2012/04/26/soma-js-router-plugin/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=soma-js-router-plugin</link>
		<comments>http://www.soundstep.com/blog/2012/04/26/soma-js-router-plugin/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 12:39:48 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[soma.js]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=818</guid>
		<description><![CDATA[I wrote a router plugin for soma.js to create internal routes in a web app. The plugin is based on the amazing library davis.js (thanks a lot to the author Oliver from New Bamboo for the help). It uses the HTML5 history API and have a hash fallback for browsers that don&#8217;t support the HTML5 [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a router plugin for soma.js to create internal routes in a web app.</p>
<p>The plugin is based on the amazing library <a href="http://davisjs.com/" target="_blank">davis.js</a> (thanks a lot to the author <a href="https://twitter.com/#!/olivernn" target="_blank">Oliver</a> from <a href="http://new-bamboo.co.uk/" target="_blank">New Bamboo</a> for the help). It uses the HTML5 history API and have a hash fallback for browsers that don&#8217;t support the HTML5 API (see the davis hash routing plugin).</p>
<p><a href="http://soundstep.com/somajs/router/native/" target="_blank">Click here to see the demo</a>, the <a href="http://somajs.github.com/somajs/" target="_blank">soma.js site</a> has also been updated with the plugin and the latest version (1.0.2).</p>
<p><strong>Prepare the html</strong></p>
<p>Include the libraries in your page:</p>
<div class="igBar"><span id="lhtml-17"><a href="#" onclick="javascript:showPlainTxt('html-17'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-17">
<div class="html">
<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;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;/js/davis.js&#8221;</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;/js/davis.hashRouting.js&#8221;</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</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;"><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;/js/soma.js&#8221;</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;/js/soma-router.js&#8221;</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Create the plugin</strong></p>
<p>Creating the plugin takes only one line:</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: #000000; font-weight: bold;">var</span> router = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">createPlugin</span><span style="color: #66cc66;">&#40;</span>soma.<span style="color: #006600;">router</span>.<span style="color: #006600;">Router</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This can be done in a soma.js framework element such as the application itself or a wire:</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> SomaApplication = soma.<span style="color: #006600;">Application</span>.<span style="color: #006600;">extend</span><span style="color: #66cc66;">&#40;</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; init: <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">createPlugin</span><span style="color: #66cc66;">&#40;</span>soma.<span style="color: #006600;">router</span>.<span style="color: #006600;">Router</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; <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><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> app = <span style="color: #000000; font-weight: bold;">new</span> SomaApplication<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Create the routes</strong></p>
<p>Given some html links:</p>
<div class="igBar"><span id="lhtml-20"><a href="#" onclick="javascript:showPlainTxt('html-20'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-20">
<div class="html">
<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;"><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">&lt;li&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&#8220;/&#8221;</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Home<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">&lt;li&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&#8220;/about&#8221;</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>About<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</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;"><span style="color: #009900;"><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">&lt;li&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&#8220;/services&#8221;</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Services<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">&lt;li&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&#8220;/articles&#8221;</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Articles<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</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;"><span style="color: #009900;"><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">&lt;li&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&#8220;/articles/article1&#8243;</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Articles<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">&lt;li&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&#8220;/articles/article2&#8243;</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Articles<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</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;"><span style="color: #009900;"><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">&lt;li&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&#8220;/articles/article3&#8243;</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Articles<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/li.html"><span style="color: #000000; font-weight: bold;">&lt;li&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&#8220;/contact&#8221;</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Contact<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/li&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Here is how the routes can be created:</p>
<div class="igBar"><span id="ljavascript-21"><a href="#" onclick="javascript:showPlainTxt('javascript-21'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-21">
<div class="javascript">
<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: #003366; font-weight: bold;">var</span> routes = <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: #3366CC;">&#8216;get&#8217;</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; <span style="color: #3366CC;">&#8216;/&#8217;</span> : RouterEventTypes.<span style="color: #006600;">ROOT</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: #3366CC;">&#8216;/:nav&#8217;</span> : RouterEventTypes.<span style="color: #006600;">NAV</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: #3366CC;">&#8216;/:nav/:subnav&#8217;</span> : RouterEventTypes.<span style="color: #006600;">SUBNAV</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: #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>The variables RouterEventTypes are simple strings and will be used as event types.</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> RouterEventTypes = <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; ROOT: <span style="color: #ff0000;">&#8220;root&#8221;</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; NAV: <span style="color: #ff0000;">&#8220;nav&#8221;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; SUBNAV: <span style="color: #ff0000;">&#8220;subnav&#8221;</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>When the router will find a route, from a url change or when a link is clicked in the browser, a specific event will be dispatched through the framework. A url such as &#8220;http://site.com/about&#8221; will be matched by the rule &#8220;/:nav&#8221; and an event of type &#8220;RouterEventTypes.NAV&#8221; will be dispatched through the framework.</p>
<p>Note that I could have set a route in a static way: &#8220;/about&#8221; rather than &#8220;/:nav&#8221;.</p>
<p><strong>Register the routes to the router</strong></p>
<p>The routes object created previously can be registered to the router this way:</p>
<div class="igBar"><span id="ljavascript-23"><a href="#" onclick="javascript:showPlainTxt('javascript-23'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-23">
<div class="javascript">
<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: #003366; font-weight: bold;">var</span> router = <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">createPlugin</span><span style="color: #66cc66;">&#40;</span>soma.<span style="color: #006600;">router</span>.<span style="color: #006600;">Router</span>, routes<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Listen to route changes</strong></p>
<p>Now that everything is set up, it is only a matter of adding event listeners in the framework elements, here is an example with a wire:</p>
<div class="igBar"><span id="ljavascript-24"><a href="#" onclick="javascript:showPlainTxt('javascript-24'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-24">
<div class="javascript">
<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: #003366; font-weight: bold;">var</span> WireRouter = soma.<span style="color: #006600;">Wire</span>.<span style="color: #006600;">extend</span><span style="color: #66cc66;">&#40;</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; init: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>RouterEventTypes.<span style="color: #006600;">ROOT</span>, <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">rootHandler</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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>RouterEventTypes.<span style="color: #006600;">NAV</span>, <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">navHandler</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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>RouterEventTypes.<span style="color: #006600;">SUBNAV</span>, <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">subnavHandler</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; <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; rootHandler: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event<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; <span style="color: #009900; font-style: italic;">// do something</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; &nbsp; navHandler: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event<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; <span style="color: #009900; font-style: italic;">// do something</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: #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; subnavHandler: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event<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; <span style="color: #009900; font-style: italic;">// do something</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;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The event received contains the following information:</p>
<ul>
<li>event.params.rule -> /:nav</li>
<li>event.params.request -> Davis.Request</li>
</ul>
<p>And the <a href="http://olivernn.github.com/davis.js/docs/#Request" target="_blank">Davis.Request</a> will contains all the information you might need. Such as the link or url:</p>
<div class="igBar"><span id="ljavascript-25"><a href="#" onclick="javascript:showPlainTxt('javascript-25'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-25">
<div class="javascript">
<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;">navHandler: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event<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: #003366; font-weight: bold;">var</span> request = event.<span style="color: #006600;">params</span>.<span style="color: #006600;">request</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: #009900; font-style: italic;">// the following variable urlParameter will contain &quot;about&quot;</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: #009900; font-style: italic;">// if the link was for example http://site.com/about</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: #003366; font-weight: bold;">var</span> urlParameter = request.<span style="color: #006600;">params</span><span style="color: #66cc66;">&#91;</span>RouterEventTypes.<span style="color: #006600;">NAV</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;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Controlling and interrupting</strong></p>
<p>A global route change event can also be listened to:</p>
<div class="igBar"><span id="ljavascript-26"><a href="#" onclick="javascript:showPlainTxt('javascript-26'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-26">
<div class="javascript">
<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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>soma.<span style="color: #006600;">router</span>.<span style="color: #006600;">RouterEvent</span>.<span style="color: #006600;">CHANGED</span>, <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">changeHandler</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This is an internal framework command and can be interrupted this way:</p>
<div class="igBar"><span id="ljavascript-27"><a href="#" onclick="javascript:showPlainTxt('javascript-27'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-27">
<div class="javascript">
<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;">changeHandler:<span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event<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: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>whatever_reason<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; <span style="color: #009900; font-style: italic;">// stop the route to occur</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; event.<span style="color: #006600;">preventDefault</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; <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><strong>Hash routing fallback</strong></p>
<p>In case the browser doesn&#8217;t support the HTML5 History API, you can add a hash fallback by adding the Davis plugin <a href="https://github.com/olivernn/davis.js/blob/master/lib/extensions/davis.hashRouting.js" target="_blank">hashRounting</a> just before you create the router plugin:</p>
<div class="igBar"><span id="ljavascript-28"><a href="#" onclick="javascript:showPlainTxt('javascript-28'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-28">
<div class="javascript">
<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;">Davis.<span style="color: #006600;">extend</span><span style="color: #66cc66;">&#40;</span>Davis.<span style="color: #006600;">hashRouting</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span> prefix: <span style="color: #3366CC;">&#8220;!/&#8221;</span> <span style="color: #66cc66;">&#125;</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;"><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">createPlugin</span><span style="color: #66cc66;">&#40;</span>soma.<span style="color: #006600;">router</span>.<span style="color: #006600;">Router</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Davis handler</strong></p>
<p>When a Davis.js instance is created, an handler is passed to it and will be a <a href="http://olivernn.github.com/davis.js/docs/#App" target="_blank">Davis.App</a>.</p>
<p>For example:</p>
<div class="igBar"><span id="ljavascript-29"><a href="#" onclick="javascript:showPlainTxt('javascript-29'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-29">
<div class="javascript">
<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: #003366; font-weight: bold;">var</span> app = Davis<span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <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: #009900; font-style: italic;">// do something</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><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The creation of the Davis.App is automatically done by the plugin but you can still pass the handler to it and do more Davis.js specific operations:</p>
<div class="igBar"><span id="ljavascript-30"><a href="#" onclick="javascript:showPlainTxt('javascript-30'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-30">
<div class="javascript">
<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: #003366; font-weight: bold;">var</span> router = <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">createPlugin</span><span style="color: #66cc66;">&#40;</span>soma.<span style="color: #006600;">router</span>.<span style="color: #006600;">Router</span>, routes, <span style="color: #003366; font-weight: bold;">function</span><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; app.<span style="color: #006600;">bind</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;routeNotFound&#8217;</span>, <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// do something</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: #66cc66;">&#125;</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;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Handling non-existing route</strong></p>
<p>When you have a url and create HTML5 History routes (called states), these URLS might not exist in reality.<br />
If a user go a non-existing URL, it can be either handled by the server to the serve the correct content, or you can use the following htaccess file on an Apache Server:</p>
<div class="igBar"><span id="lactionscript-31"><a href="#" onclick="javascript:showPlainTxt('actionscript-31'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-31">
<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;">RewriteEngine <span style="color: #0066CC;">On</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteCond %<span style="color: #66cc66;">&#123;</span>REQUEST_FILENAME<span style="color: #66cc66;">&#125;</span> !-f</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;">RewriteCond %<span style="color: #66cc66;">&#123;</span>REQUEST_FILENAME<span style="color: #66cc66;">&#125;</span> !-d</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteCond %<span style="color: #66cc66;">&#123;</span>REQUEST_URI<span style="color: #66cc66;">&#125;</span> !<span style="color: #0066CC;">index</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;">RewriteRule <span style="color: #66cc66;">&#40;</span>.*<span style="color: #66cc66;">&#41;</span> <span style="color: #0066CC;">index</span>.<span style="color: #0066CC;">html</span> <span style="color: #66cc66;">&#91;</span>L<span style="color: #66cc66;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>These rules will redirect any URL that is not a file or a folder to the index.html of you site, Davis.js will then handle the routes for you to show the right content on the client side.</p>
<p>Note that you need to specify to Davis.js that you want the first page load to be handled as a route:</p>
<div class="igBar"><span id="ljavascript-32"><a href="#" onclick="javascript:showPlainTxt('javascript-32'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-32">
<div class="javascript">
<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: #003366; font-weight: bold;">var</span> router = <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">createPlugin</span><span style="color: #66cc66;">&#40;</span>soma.<span style="color: #006600;">router</span>.<span style="color: #006600;">Router</span>, routes, <span style="color: #003366; font-weight: bold;">function</span><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: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">settings</span>.<span style="color: #006600;">generateRequestOnPageLoad</span> = <span style="color: #003366; font-weight: bold;">true</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><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>To get the router plugin, you can either:<br />
- clone the repository (<a href="https://github.com/somajs/somajs" target="_blank">native</a> or <a href="https://github.com/somajs/somajs/tree/mootools" target="_blank">mootools version</a>)<br />
- grab it directly (<a href="https://github.com/somajs/somajs/blob/master/plugins/router/src/soma-router.js" target="_blank">native</a> or <a href="https://github.com/somajs/somajs/blob/mootools/plugins/router/src/soma-router.js" target="_blank">mootools</a>)<br />
- <a href="http://somajs.github.com/somajs/" target="_blank">check out the soma.js site</a></p>
<p>For more information about Davis.js, you can check:<br />
- <a href="http://davisjs.com/" target="_blank">Davis.js site</a><br />
- <a href="http://davisjs.com/docs" target="_blank">Davis.js API documentation</a><br />
- <a href="https://github.com/olivernn/davis.js" target="_blank">Davis.js code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2012/04/26/soma-js-router-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>javascript displacement mapping</title>
		<link>http://www.soundstep.com/blog/2012/04/25/javascript-displacement-mapping/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javascript-displacement-mapping</link>
		<comments>http://www.soundstep.com/blog/2012/04/25/javascript-displacement-mapping/#comments</comments>
		<pubDate>Wed, 25 Apr 2012 17:58:54 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[talking]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=800</guid>
		<description><![CDATA[I wrote a javascript displacement map filter, mostly as an experiment, this graphic technique has been widely used in Flash. Check out the following demos: - interactive demo - picture demo Displacement mapping is a simple action of shifting pixels. An image map containing color values is used as data to create the displacement and [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a javascript displacement map filter, mostly as an experiment, this graphic technique has been widely used in Flash.</p>
<p>Check out the following demos:<br />
- <a href="http://soundstep.com/blog/experiments/displacement-js/heart/" target="_blank">interactive demo</a><br />
- <a href="http://soundstep.com/blog/experiments/displacement-js/photo/" target="_blank">picture demo</a></p>
<p><a href="http://en.wikipedia.org/wiki/Displacement_mapping" target="_blank">Displacement mapping</a> is a simple action of shifting pixels. An image map containing color values is used as data to create the displacement and move pixels around.</p>
<p>The filter can be used several different effects, here are some that have been done in Flash, these might give you ideas:<br />
- <a href="http://plasticsturgeon.com/2010/06/make-a-simple-as3-fisheye-effect-with-displacementmapfilter/" target="_blank">fish eye effect</a><br />
- <a href="http://active.tutsplus.com/tutorials/effects/create-a-static-distortion-effect-using-the-displacement-map-filter/" target="_blank">distortion</a><br />
- <a href="http://gskinner.com/blog/archives/2006/10/as3_music_visua.html" target="_blank">fire</a><br />
- <a href="http://www.andysaia.com/radicalpropositions/?p=120" target="_blank">flag effect (with perlin noise)</a></p>
<p>And two great links to have a better understanding of the displacement mapping. Both links explain the Flash version of the filter, but it is almost identical (missing modes for now) to the one I wrote in javascript. I strongly recommend to read the first link.<br />
- <a href="http://www.emanueleferonato.com/2007/12/03/understanding-flash-displacement-map-filter/" target="_blank">understand displacement mapping</a><br />
- <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filters/DisplacementMapFilter.html" target="_blank">actionscript documentation</a></p>
<p>About the demo with the picture, I created an image map in Photoshop, please notice my skill with a brush <img src='http://www.soundstep.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<img src="http://soundstep.com/blog/experiments/displacement-js/photo/img/urs2.jpeg" alt="displacement map" /></p>
<p>I used the javascript displacement filter to apply it on the following picture, and finally draw it in a canvas.<br />
<img src="http://soundstep.com/blog/experiments/displacement-js/photo/img/urs1.jpeg" alt="photo" /></p>
<p>The filter itself will take different parameters that can be changed in real-time (on a time interval):<br />
- a canvas containing the image on which the filter will be applied on<br />
- a canvas containing the image map to create the displacement<br />
- a canvas where the result will be drawn<br />
- a point (x and y) where the displacement will be applied on the image source<br />
- a scale value for the X axis, this will be the amount of displacement on this axis<br />
- a scale value for the Y axis<br />
- a color channel for the X axis, the color used to create the displacement on this axis<br />
- a color channel for the Y axis</p>
<p>It will look like this:</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: #000000; font-weight: bold;">var</span> filter = <span style="color: #000000; font-weight: bold;">new</span> filters.<span style="color: #006600;">DisplacementMap</span><span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; canvasSource,</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; canvasMap,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; canvasTarget,</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: #000000; font-weight: bold;">new</span> filters.<span style="color: #006600;">Point</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">50</span>, <span style="color: #cc66cc;color:#800000;">50</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; <span style="color: #cc66cc;color:#800000;">40</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: #cc66cc;color:#800000;">40</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; filters.<span style="color: #006600;">ColorChannel</span>.<span style="color: #006600;">RED</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; filters.<span style="color: #006600;">ColorChannel</span>.<span style="color: #006600;">GREEN</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;">filter.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>When the draw method is called, the filter will loop over the pixels of the image map and find the color that has been specified to create the displacement. A color is represented by the hexadecimal value of 255 (0xFF). If the color found in the map for a specific pixel is superior to the half (0&#215;80), the pixel shifting will increase, otherwise it will decrease.</p>
<p>About the second demo, I reproduced a <a href="http://zehfernando.com/2007/tweening-a-displacement-map/" target="_blank">flash demo from Zeh Fernando</a> that I really liked. There&#8217;s a simple background with heart pattern  used as a source image, and the displacement map looks like this:<br />
<img src="http://soundstep.com/blog/experiments/displacement-js/heart/img/map.png" alt="displacement map" /></p>
<p>The gradient colors are chosen so that the displacement will create a magnifying effect. The red colors will be used to move the pixels on the X axis and the green colors will be used to move on the Y axis.</p>
<p>I also reproduced a little trick to emphasis the displacement. Ive added a simple png with transparency on top of the displacement, it contains lights and shadows:<br />
<img src="http://soundstep.com/blog/experiments/displacement-js/heart/img/heart.png" alt="heart" /></p>
<p>I also tweened the filter values with <a href="http://createjs.com/#!/TweenJS" target="_blank">TweenJS</a> to add a bit of movement (the heart bump), as in the Flash version.</p>
<p><a href="http://soundstep.com/blog/experiments/displacement-js/displacement_map.zip">Click here to download the demo and source.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2012/04/25/javascript-displacement-mapping/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>javascript motion detection</title>
		<link>http://www.soundstep.com/blog/2012/03/22/javascript-motion-detection/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javascript-motion-detection</link>
		<comments>http://www.soundstep.com/blog/2012/03/22/javascript-motion-detection/#comments</comments>
		<pubDate>Thu, 22 Mar 2012 01:00:38 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=772</guid>
		<description><![CDATA[This is a motion detection experiment in javascript, and before starting any explanation: Click here to see the demo. To see this demo with your own webcam, you will need to download a browser that enables some new features as explained in this link. To make it simple, I&#8217;ve used Google Chrome Canary, go and [...]]]></description>
			<content:encoded><![CDATA[<p>This is a motion detection experiment in javascript, and before starting any explanation:</p>
<p><a href="http://www.soundstep.com/blog/experiments/jsdetection/" target="_blank">Click here to see the demo</a>.</p>
<p>To see this demo with your own webcam, you will need to download a browser that enables some new features as explained <a href="http://www.html5rocks.com/en/tutorials/getusermedia/intro/#toc-enabling" target="_blank">in this link</a>. To make it simple, I&#8217;ve used <a href="http://tools.google.com/dlpage/chromesxs" target="_blank">Google Chrome Canary</a>, go and get it!</p>
<p>I used an html 5 API this is not released yet, the <a href="http://www.html5rocks.com/en/tutorials/getusermedia/intro/" target="_blank">html 5 getUserMedia API</a>. This API makes you able to use a webcam stream in javascript. Exiting! Paul Neave has done a very nice <a href="http://neave.com/webcam/html5/" target="_blank">webcam demo</a>.</p>
<p>So what is the demo about?</p>
<p>I use a webcam feed, I put a xylophone image on top of it and I detect the user&#8217;s movements to play the xylophone.</p>
<p>To detect the user&#8217;s movement I used a technic that is probably well-known by developers, designers and motion designers: the <a href="http://en.wikipedia.org/wiki/Blend_modes#Difference" target="_blank">blend mode difference</a>.</p>
<p>The concept is, if you put a picture on top of the same picture and blend them together using the blend mode difference, you obtain&#8230; a black screen!</p>
<p>If there&#8217;s a slight difference between the 2 pictures, the colors start to appear, showing you the &#8220;difference&#8221; between the two pictures. You get something like that:</p>
<p><a href="http://www.soundstep.com/blog/2012/03/22/javascript-motion-detection/difference/" rel="attachment wp-att-774"><img src="http://www.soundstep.com/blog/wp-content/uploads/2012/03/difference.jpg" alt="" title="difference" width="533" height="379" class="alignnone size-full wp-image-774" /></a></p>
<p>Not exactly like that actually, in this demo I made an average on each pixel between the red, the green and the blue, and turn them to white above a certain amount to get a bit more accuracy.</p>
<p>The first step is drawing the webcam feed in a canvas, grab a picture from it at a time interval, and blend the current frame to the previous one. This means that if you don&#8217;t move, the result will be black, and when you start moving some pixels will turn white.</p>
<p>To be a bit more precise, I loop over the pixels of the current frame and I subtract the pixels color from the same pixel color of the previous frame. This is what the blend mode difference is doing: &#8220;Difference subtracts the top layer from the bottom layer or the other way round, to always get a positive value.&#8221;.</p>
<p>The next step is checking in some areas (the different parts of the xylophone) if you have some white pixels in them. If you get a certain amount of non-black pixels in this area, it means that something moved since the last frame and I play a note.</p>
<p>I&#8217;ve been using the <a href="http://www.html5rocks.com/en/tutorials/webaudio/intro/" target="_blank">Web Audio API</a> to the play the notes, the demo is fully done in javascript.</p>
<p>*UPDATE*</p>
<p>Click here to see a <a href="http://www.adobe.com/devnet/html5/articles/javascript-motion-detection.html" target="_blank">more in-depth article on ADC</a> on how to create the motion detection</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2012/03/22/javascript-motion-detection/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Javascript motion tracking</title>
		<link>http://www.soundstep.com/blog/2012/03/19/javascript-motion-tracking/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javascript-motion-tracking</link>
		<comments>http://www.soundstep.com/blog/2012/03/19/javascript-motion-tracking/#comments</comments>
		<pubDate>Mon, 19 Mar 2012 14:15:28 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=748</guid>
		<description><![CDATA[It is very often that I have to do video motion tracking for interactive video campaign in my daily work. If I&#8217;m used used to do that in Flash, I made a quick experiment to do the same in javascript. Thanks to Olof Storm who made me a perfect corner pin motion tracking in After [...]]]></description>
			<content:encoded><![CDATA[<p>It is very often that I have to do video motion tracking for interactive video campaign in my daily work.</p>
<p>If I&#8217;m used used to do that in Flash, I made a quick experiment to do the same in javascript.</p>
<p>Thanks to <a href="http://vimeo.com/olofstorm" target="_blank">Olof Storm</a> who made me a perfect corner pin motion tracking in After Effects, and I&#8217;ve been using some code from <a href="http://acko.net/blog/projective-texturing-with-canvas/" target="_blank">Steven Wittens</a> to draw an image in perspective.</p>
<p><a href="http://www.soundstep.com/blog/experiments/jstracking/" target="_blank">Click here to see the motion tracking demo</a> (give it a bit of time to fully load).</p>
<p>What I&#8217;m doing in this demo is drawing a video in a canvas, and using the corner pin tracking data to draw an image on top of the video.</p>
<p>I made 2 different videos, you can switch between them using the &#8220;switch video&#8221; button.</p>
<p>In the first video, I get the current video frame number by calculation (current time by video fps). And in the second video, I get the frame number using a different technique that is know to be quite accurate when we do it in Flash, I call that a binary counter.</p>
<p>The idea behind the binary counter is to export the video with some white and black rectangle that describe graphically the real frame number of the video. We&#8217;ve been using this technique in Flash for a while in the advertising industry, and <a href="http://zehfernando.com/2011/flash-video-frame-time-woes/" target="_blank">Zeh Fernando</a> talked about it last year.</p>
<p>You can see the binary counter on the right border of the video. The code gets a pixel in each bit of the binary counter (16 bits), find out if the bit is white or black to get a 0 or 1 and calculate a number out of it.</p>
<p><a href="http://www.soundstep.com/blog/2012/03/19/javascript-motion-tracking/counter-2/" rel="attachment wp-att-756"><img src="http://www.soundstep.com/blog/wp-content/uploads/2012/03/counter1.jpg" alt="" title="counter" width="6" height="258" class="alignnone size-full wp-image-756" /></a></p>
<p>While you might not see a difference between the two frame number calculations at first glance, seeking the video with the binary counter version (using the top-right blue control) will keep the image and the video &#8220;synchronised&#8221;. Pretty cool.</p>
<p>This version is not perfect compared to what we do in Flash, some frames still seem to be a bit &#8220;out&#8221;. I also couldn&#8217;t find a way to solve &#8220;pixel snapping drawing&#8221; in a canvas, in other words, being able to draw an image on half a pixel.</p>
<p>I did really miss some powerful drawing method from the graphic API in Flash. I would love to find in javascript a &#8220;beginBitmapFill&#8221; method, apply matrix directly to a drawing method and draw triangles in an easier way to use this <a href="http://zehfernando.com/2010/the-best-drawplane-distortimage-method-ever/" target="_blank">plane drawing technic we use in Flash</a>.</p>
<p>*update*</p>
<p>I just found out that what I call a binary counter is actually a <a href="http://en.wikipedia.org/wiki/Vertical_interval_timecode" target="_blank">VITC</a>, which I didn&#8217;t know! Interesting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2012/03/19/javascript-motion-tracking/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Image loader plugin for soma.js</title>
		<link>http://www.soundstep.com/blog/2012/03/08/image-loader-plugin-for-soma-js/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=image-loader-plugin-for-soma-js</link>
		<comments>http://www.soundstep.com/blog/2012/03/08/image-loader-plugin-for-soma-js/#comments</comments>
		<pubDate>Thu, 08 Mar 2012 10:00:49 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[soma.js]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[soma]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=742</guid>
		<description><![CDATA[Now that we can easily create plugins for soma.js, I&#8217;ve created an image loader plugin. I&#8217;ve used PxLoader as a base and before any explanation, it looks like that: Image loader plugin demo. The plugin will take a url to a json config file that describes a list of images to load and dispatch some [...]]]></description>
			<content:encoded><![CDATA[<p>Now that we can easily create plugins for <a href="http://somajs.github.com/somajs/" title="soma.js" target="_blank">soma.js</a>, I&#8217;ve created an image loader plugin.</p>
<p>I&#8217;ve used <a href="http://thinkpixellab.com/pxloader/" title="pxloader" target="_blank">PxLoader</a> as a base and before any explanation, it looks like that:</p>
<p><a href="http://somajs.github.com/somajs/plugin/native/plugin/image-loader/demos/simple-image-loader/" title="image loader plugin demo" target="_blank">Image loader plugin demo</a>.</p>
<p>The plugin will take a url to a <a href="http://somajs.github.com/somajs/plugin/native/plugin/image-loader/demos/simple-image-loader/assets/config.json" target="_blank">json config file</a> that describes a list of images to load and dispatch some progress and complete events through the framework.</p>
<p>The advantage of using the plugin is that you are able to listen to these events anywhere in your application: in a wire, in the framework instance or a model.</p>
<p>Here is how to instantiate the plugin.</p>
<div class="igBar"><span id="lactionscript-41"><a href="#" onclick="javascript:showPlainTxt('actionscript-41'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-41">
<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;">this</span>.<span style="color: #006600;">createPlugin</span><span style="color: #66cc66;">&#40;</span>SomaImageLoader, <span style="color: #ff0000;">&#8220;assets/config.json&#8221;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The plugin will first load the config file, you can add an event to know when it will be loaded. And again, anywhere in the application, a model to manage your assets would make complete sense.</p>
<div class="igBar"><span id="lactionscript-42"><a href="#" onclick="javascript:showPlainTxt('actionscript-42'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-42">
<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;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>SomaImageLoaderEvent.<span style="color: #006600;">CONFIG_LOADED</span>, <span style="color: #0066CC;">this</span>.<span style="color: #006600;">configLoadedHandler</span>.<span style="color: #006600;">bind</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Once the config is loaded, you can dispatch a command to start the loading.</p>
<div class="igBar"><span id="lactionscript-43"><a href="#" onclick="javascript:showPlainTxt('actionscript-43'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-43">
<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;">this</span>.<span style="color: #006600;">dispatchEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> SomaImageLoaderEvent<span style="color: #66cc66;">&#40;</span>SomaImageLoaderEvent.<span style="color: #0066CC;">START</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The plugin will catch the start event and start the loading.<br />
To retrieve the images and use them, you can either listen to an &#8220;image complete&#8221; event, or wait that everything is loaded and listen to a &#8220;queue complete event&#8221;.</p>
<div class="igBar"><span id="lactionscript-44"><a href="#" onclick="javascript:showPlainTxt('actionscript-44'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-44">
<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;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>SomaImageLoaderEvent.<span style="color: #006600;">ITEM_COMPLETE</span>, <span style="color: #0066CC;">this</span>.<span style="color: #006600;">itemCompleteHandler</span>.<span style="color: #006600;">bind</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</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;"><span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>SomaImageLoaderEvent.<span style="color: #006600;">QUEUE_COMPLETE</span>, <span style="color: #0066CC;">this</span>.<span style="color: #006600;">completeHandler</span>.<span style="color: #006600;">bind</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lactionscript-45"><a href="#" onclick="javascript:showPlainTxt('actionscript-45'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-45">
<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;">itemCompleteHandler: <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event<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;">// notification received when an item is loaded</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; console.<span style="color: #0066CC;">log</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;&gt; item complete&#8217;</span>, event.<span style="color: #006600;">params</span>.<span style="color: #006600;">completed</span>, <span style="color: #ff0000;">&#8220;/&#8221;</span>, event.<span style="color: #006600;">params</span>.<span style="color: #006600;">total</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; console.<span style="color: #0066CC;">log</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;&nbsp; &nbsp; id:&#8217;</span>, event.<span style="color: #006600;">params</span>.<span style="color: #006600;">loader</span>.<span style="color: #006600;">id</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; console.<span style="color: #0066CC;">log</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;&nbsp; &nbsp; loader:&#8217;</span>, event.<span style="color: #006600;">params</span>.<span style="color: #006600;">loader</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; console.<span style="color: #0066CC;">log</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;&nbsp; &nbsp; data:&#8217;</span>, event.<span style="color: #006600;">params</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; <span style="color: #808080; font-style: italic;">// draw image loaded in a canvas</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: #000000; font-weight: bold;">var</span> canvas = document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;canvas&#8217;</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; <span style="color: #000000; font-weight: bold;">var</span> ctx = canvas.<span style="color: #006600;">getContext</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8217;2d&#8217;</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; ctx.<span style="color: #006600;">drawImage</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">params</span>.<span style="color: #0066CC;">data</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">0</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;"><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;">completeHandler: <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event<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; <span style="color: #808080; font-style: italic;">// notification received when all items are loaded</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;">this</span>.<span style="color: #0066CC;">log</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;&gt; complete&#8217;</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; <span style="color: #808080; font-style: italic;">// draw all images loaded in a canvas</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: #000000; font-weight: bold;">var</span> canvas = document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;canvas&#8217;</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; <span style="color: #000000; font-weight: bold;">var</span> ctx = canvas.<span style="color: #006600;">getContext</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8217;2d&#8217;</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; ctx.<span style="color: #006600;">drawImage</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">params</span>.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#8216;img1&#8242;</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">0</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; ctx.<span style="color: #006600;">drawImage</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">params</span>.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#8216;img2&#8242;</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">50</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; ctx.<span style="color: #006600;">drawImage</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">params</span>.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#8216;img3&#8242;</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #cc66cc;color:#800000;">200</span>, <span style="color: #cc66cc;color:#800000;">100</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; ctx.<span style="color: #006600;">drawImage</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">params</span>.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#8216;img4&#8242;</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #cc66cc;color:#800000;">300</span>, <span style="color: #cc66cc;color:#800000;">150</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; ctx.<span style="color: #006600;">drawImage</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">params</span>.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#8216;img5&#8242;</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #cc66cc;color:#800000;">400</span>, <span style="color: #cc66cc;color:#800000;">200</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; <span style="color: #66cc66;">&#125;</span>, </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You don&#8217;t have to use a config json, all these operation can be done manually if you wish to.</p>
<div class="igBar"><span id="lactionscript-46"><a href="#" onclick="javascript:showPlainTxt('actionscript-46'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-46">
<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> plugin = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">createPlugin</span><span style="color: #66cc66;">&#40;</span>SomaImageLoader<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: #808080; font-style: italic;">// plugin.loadConfig(&quot;assets/config.json&quot;);</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;">plugin.<span style="color: #006600;">addImage</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;myImage1&#8243;</span>, <span style="color: #ff0000;">&#8220;assets/images/img1.jpg&#8221;</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;">plugin.<span style="color: #006600;">addImage</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;myImage2&#8243;</span>, <span style="color: #ff0000;">&#8220;assets/images/img2.jpg&#8221;</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;">plugin.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You can find the plugin on the <a href="http://somajs.github.com/somajs/" title="soma.js" target="_blank">soma.js</a> site in the &#8220;plugins section&#8221; or on the <a href="https://github.com/somajs/somajs/tree/master/plugins/image-loader" target="_blank">github repo</a>.</p>
<p>You will find both a native version and a Mootools version.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2012/03/08/image-loader-plugin-for-soma-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>soma.js update 1.0.1 plugin system</title>
		<link>http://www.soundstep.com/blog/2012/03/08/soma-js-update-1-0-1-plugin-system/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=soma-js-update-1-0-1-plugin-system</link>
		<comments>http://www.soundstep.com/blog/2012/03/08/soma-js-update-1-0-1-plugin-system/#comments</comments>
		<pubDate>Thu, 08 Mar 2012 01:54:01 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[soma.js]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=738</guid>
		<description><![CDATA[I&#8217;ve added a plugin system in soma.js and a tutorial how to create a plugin on the site. It is quite simple and everything is explained in the tutorial step by step, but here is a quick overview. To create a plugin, you just need to create a function that will receive a soma framework [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added a plugin system in <a href="http://somajs.github.com/somajs/" title="soma.js" target="_blank">soma.js</a> and a tutorial how to create a plugin on the site.</p>
<p>It is quite simple and everything is explained in the tutorial step by step, but here is a quick overview.</p>
<p>To create a plugin, you just need to create a function that will receive a soma framework instance and any additional parameter.</p>
<div class="igBar"><span id="lactionscript-50"><a href="#" onclick="javascript:showPlainTxt('actionscript-50'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-50">
<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> MyPlugin = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>instance, myParam<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;">this</span>.<span style="color: #006600;">instance</span> = instance;</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;">this</span>.<span style="color: #006600;">myParam</span> = myParam;</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>Another syntax that might be helpful, especially if you want to extend the plugin later on.</p>
<div class="igBar"><span id="lactionscript-51"><a href="#" onclick="javascript:showPlainTxt('actionscript-51'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-51">
<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> MyPlugin = soma.<span style="color: #006600;">extend</span><span style="color: #66cc66;">&#40;</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;">constructor</span>: <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>instance, myParam<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; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">instance</span> = instance;</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;">this</span>.<span style="color: #006600;">myParam</span> = myParam;</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><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now that you have access to the framework instance, you can create models, wires, commands, events, and so on.</p>
<p>To use the plugin, you just need to instantiate it in either a framework instance, a wire or a command.</p>
<div class="igBar"><span id="lactionscript-52"><a href="#" onclick="javascript:showPlainTxt('actionscript-52'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-52">
<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> SomaApplication = soma.<span style="color: #006600;">Application</span>.<span style="color: #006600;">extend</span><span style="color: #66cc66;">&#40;</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; init: <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> plugin = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">createPlugin</span><span style="color: #66cc66;">&#40;</span>MyPlugin, <span style="color: #ff0000;">&#8220;my param&#8221;</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; <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><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> app = <span style="color: #000000; font-weight: bold;">new</span> SomaApplication<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>That&#8217;s it!</p>
<p>Check out a more advanced plugin with the step by step tutorial on the <a href="http://somajs.github.com/somajs/" title="soma.js" target="_blank">soma.js</a> site.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2012/03/08/soma-js-update-1-0-1-plugin-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Soma.js &#8211; lightweight MVC Javascript Framework</title>
		<link>http://www.soundstep.com/blog/2012/03/05/soma-js-lightweight-mvc-javascript-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=soma-js-lightweight-mvc-javascript-framework</link>
		<comments>http://www.soundstep.com/blog/2012/03/05/soma-js-lightweight-mvc-javascript-framework/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 15:25:46 +0000</pubDate>
		<dc:creator>Henry</dc:creator>
				<category><![CDATA[soma.js]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[soma]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=711</guid>
		<description><![CDATA[We are excited to release a new Javascript framework called soma.js. I am Henry Schmieder, London based web developer, and this is my first post on this blog. Romu and I have been working on this framework the last couple of weeks and I&#8217;m going to introduce it to you. soma.js is a Javascript model-view-controller [...]]]></description>
			<content:encoded><![CDATA[<p>
We are excited to release a new Javascript framework called <b><a href="http://somajs.github.com/somajs/" target="_blank">soma.js</a></b>. I am Henry Schmieder, London based web developer, and this is my first post on this blog. Romu and I have been working on this framework the last couple of weeks and I&#8217;m going to introduce it to you.
</p>
<p>
soma.js is a Javascript model-view-controller (MVC) framework that is meant to help developers to write loosely-coupled applications to increase scalability and maintainability.
</p>
<p>
Check the <a href="http://somajs.github.com/somajs/" target="_blank">soma.js</a> website where you can find the framework, demos, unit tests, documentation, tutorials, and so on.
</p>
<p><h5>Why another Javascript framework?</h5>
</p>
<p>
We both have a strong background in other languages and we thought it would be nice to bring our experience to the Javascript world. Javascript is evolving, and while the language is pretty powerful, its use is very different today than years ago. Applications have become more and more complex and manifold, from one page GUI driven web apps to stateless mobile applications. To keep the process of developing modern JavaScript applications easy and fun, we built soma.js.
</p>
<p>
There are many great Frameworks out there, written in different languages, that cover the basics of a structured development flow of more complex applications. The core paradigm for a lot of them is the MVC concept.
</p>
<p>
We believe in the <a href="http://en.wikipedia.org/wiki/Law_of_Demeter" target="_blank">Law of Demeter</a> to develop complex application structure, and we also believe that loose-coupling development is key. soma.js implements the Observer and Command pattern through the native javascript event system, which offered many advantages and flexibility.
</p>
<p>
There is a lot of discussion as to how much sense makes trying to project concepts of a strong OOP language like Java or ActionScript onto the loosely typed, dynamic prototype based Javascript. But there is a lot of sense in it, not at least having a background in applying the benefits of structured application design based on OOP concepts and pattern based concepts like MVC.
</p>
<p>
I used Mootools for the very first version of soma.js and Romu joined me to give the project a massive backwind towards a public release. So we worked on a complete unit test system, an automated template downloader and packer, a set of demos, a complete documentation and an interactive demo site that explains the project and allows realtime code example modification and execution and introduces into all the important concepts of the framework step by step. On top of that we decided to remove the dependency from another framework, Mootools, and created a complete native version, also entirely documented and unit test backed.
</p>
<p>Have fun with it and provide feedback to us!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2012/03/05/soma-js-lightweight-mvc-javascript-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manage multiple Git SSH key with the terminal</title>
		<link>http://www.soundstep.com/blog/2012/02/23/manage-multiple-git-ssh-key-with-the-terminal/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=manage-multiple-git-ssh-key-with-the-terminal</link>
		<comments>http://www.soundstep.com/blog/2012/02/23/manage-multiple-git-ssh-key-with-the-terminal/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 09:20:19 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=644</guid>
		<description><![CDATA[If you are like me, you might have many accounts to online project hosting services. I have 1 codesion, 2 github and 1 beanstalk. On top of this you might also work at different places: at the office, at home, and so on. I like to use git with the command line and it took [...]]]></description>
			<content:encoded><![CDATA[<p>If you are like me, you might have many accounts to online project hosting services. I have 1 codesion, 2 github and 1 beanstalk. On top of this you might also work at different places: at the office, at home, and so on.</p>
<p>I like to use git with the command line and it took me while to find out some really useful commands to manage the ssh keys.</p>
<p>All these services manage their access with ssh public key. To create them, it is easy, just follow the wonderful Github guide:<br />
<a href="http://help.github.com/mac-set-up-git/"> http://help.github.com/mac-set-up-git/</a></p>
<p>The following tips are working on a Mac, I have no idea if they would on Windows, I suspect Linux will work.</p>
<p>But sometimes you get:</p>
<blockquote><p>Permission denied (publickey,keyboard-interactive).<br />
fatal: The remote end hung up unexpectedly</p></blockquote>
<p>Even though you generated created that key last week, it doesn&#8217;t seem to be there anymore. You probably have the key in your folder (/Users/my_user/.ssh) but the terminal doesn&#8217;t use it.</p>
<p>So first command, list the identities that are in use:</p>
<blockquote><p>ssh-add -l</p></blockquote>
<p>To remove an identity:</p>
<blockquote><p>ssh-add -d /Users/my_user/.ssh/keyfile_name</p></blockquote>
<p>And to add one:</p>
<blockquote><p>ssh-add /Users/my_user/.ssh/keyfile_name</p></blockquote>
<p>That&#8217;s it, very simple, but now you can manage your keys.</p>
<p>If you have other tips, please comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2012/02/23/manage-multiple-git-ssh-key-with-the-terminal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>After effects export trackers or properties</title>
		<link>http://www.soundstep.com/blog/2011/07/29/after-effects-export-trackers-or-properties/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=after-effects-export-trackers-or-properties</link>
		<comments>http://www.soundstep.com/blog/2011/07/29/after-effects-export-trackers-or-properties/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 17:05:07 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[talking]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=639</guid>
		<description><![CDATA[Hi, I wrote 2 quick scripts for After Effects to export properties to XML. I thought it might be handy for some of you. I mainly wrote them to export motion trackers to use in Flash afterwards, but you should be able to export other properties. To use them, do the following: 1. In the [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>I wrote 2 quick scripts for After Effects to export properties to XML. I thought it might be handy for some of you.</p>
<p>I mainly wrote them to export motion trackers to use in Flash afterwards, but you should be able to export other properties.</p>
<p>To use them, do the following:<br />
1. In the menu: Preferences > General > and tick &#8220;Allow scripts to write files and access network&#8221;<br />
2. open a project<br />
3. select the properties you want to export (for example the 4 points &#8220;Feature Center&#8221; of motion trackers)<br />
4. In the menu: File > Scripts > Run script file&#8230;<br />
5. select one the following scripts</p>
<p>A file &#8220;export.txt&#8221; should have been created on your desktop (and opened), with the XML content inside.</p>
<p>You should be able to export other properties, such as Transform properties like &#8220;position&#8221;, and so on.</p>
<p>It is certainly not bug free, but it should get you started.</p>
<p><a href="http://www.soundstep.com/blog/source/after-effects/export_trackers_by_properties.jsx">Export by properties</a><br />
<a href="http://www.soundstep.com/blog/source/after-effects/export_trackers_by_time.jsx">Export by time</a></p>
<p>Hope that helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2011/07/29/after-effects-export-trackers-or-properties/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SomaAssets demo</title>
		<link>http://www.soundstep.com/blog/2011/06/06/somaassets-demo/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somaassets-demo</link>
		<comments>http://www.soundstep.com/blog/2011/06/06/somaassets-demo/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 15:00:46 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaCore]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=632</guid>
		<description><![CDATA[As requested, I Just made a quick demo how to implement the SomaAssets plugin in your application. See the demo. Download the demo. View source. Demo on github. I&#8217;ll make a quick descrition here. I&#8217;ll be using the following XML config: Plain Text XML: &#60;?xml version=&#8220;1.0&#8243; encoding=&#8220;UTF-8&#8243;?&#62; &#60;loader connection=&#8220;1&#8243;&#62; &#160; &#160; &#60;asset id=&#8220;image0&#8243; src=&#8220;assets/img/image0.jpg&#8221; smoothing=&#8220;true&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>As requested, I Just made a quick demo how to implement the SomaAssets plugin in your application.</p>
<p><a href="http://www.soundstep.com/blog/source/somacore/demos/SomaAssetsDemo" target="_blank">See the demo</a>.<br />
<a href="http://www.soundstep.com/blog/source/somacore/demos/SomaAssetsDemo/srcview/SomaAssetsDemo.zip" target="_blank">Download the demo</a>.<br />
<a href="http://www.soundstep.com/blog/source/somacore/demos/SomaAssetsDemo/srcview" target="_blank">View source</a>.<br />
<a href="https://github.com/soundstep/somacore_demos/tree/master/SomaAssetsDemo" target="_blank">Demo on github</a>.</p>
<p>I&#8217;ll make a quick descrition here. I&#8217;ll be using the following XML config:</p>
<div class="igBar"><span id="lxml-61"><a href="#" onclick="javascript:showPlainTxt('xml-61'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-61">
<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;</span>?xml <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&#8220;1.0&#8243;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&#8220;UTF-8&#8243;</span>?<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;loader</span> <span style="color: #000066;">connection</span>=<span style="color: #ff0000;">&#8220;1&#8243;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;asset</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;image0&#8243;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;assets/img/image0.jpg&#8221;</span> <span style="color: #000066;">smoothing</span>=<span style="color: #ff0000;">&#8220;true&#8221;</span> <span style="color: #000066;">transparent</span>=<span style="color: #ff0000;">&#8220;true&#8221;</span><span style="font-weight: bold; color: black;">/&gt;</span></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: #009900;"><span style="font-weight: bold; color: black;">&lt;asset</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;image1&#8243;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;assets/img/image1.jpg&#8221;</span> <span style="color: #000066;">smoothing</span>=<span style="color: #ff0000;">&#8220;true&#8221;</span> <span style="color: #000066;">transparent</span>=<span style="color: #ff0000;">&#8220;true&#8221;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;group</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;group0&#8243;</span><span style="font-weight: bold; color: black;">&gt;</span></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: #009900;"><span style="font-weight: bold; color: black;">&lt;group</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;group00&#8243;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;asset</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;image2&#8243;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;assets/img/image2.jpg&#8221;</span> <span style="color: #000066;">smoothing</span>=<span style="color: #ff0000;">&#8220;true&#8221;</span> <span style="color: #000066;">transparent</span>=<span style="color: #ff0000;">&#8220;true&#8221;</span><span style="font-weight: bold; color: black;">/&gt;</span></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: #009900;"><span style="font-weight: bold; color: black;">&lt;asset</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;image3&#8243;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;assets/img/image3.jpg&#8221;</span> <span style="color: #000066;">smoothing</span>=<span style="color: #ff0000;">&#8220;true&#8221;</span> <span style="color: #000066;">transparent</span>=<span style="color: #ff0000;">&#8220;true&#8221;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/group<span style="font-weight: bold; color: black;">&gt;</span></span></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: #009900;"><span style="font-weight: bold; color: black;">&lt;group</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;group01&#8243;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;asset</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;css&#8221;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;assets/css/stylesheet.css&#8221;</span> <span style="color: #000066;">preventCache</span>=<span style="color: #ff0000;">&#8220;true&#8221;</span> <span style="color: #000066;">weight</span>=<span style="color: #ff0000;">&#8220;352&#8243;</span><span style="font-weight: bold; color: black;">/&gt;</span></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: #009900;"><span style="font-weight: bold; color: black;">&lt;asset</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;json&#8221;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;assets/json/data.json&#8221;</span> <span style="color: #000066;">preventCache</span>=<span style="color: #ff0000;">&#8220;true&#8221;</span> <span style="color: #000066;">weight</span>=<span style="color: #ff0000;">&#8220;582&#8243;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;asset</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;sound&#8221;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;assets/sounds/sample.mp3&#8243;</span> <span style="color: #000066;">preventCache</span>=<span style="color: #ff0000;">&#8220;true&#8221;</span> <span style="color: #000066;">weight</span>=<span style="color: #ff0000;">&#8220;16718&#8243;</span><span style="font-weight: bold; color: black;">/&gt;</span></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: #009900;"><span style="font-weight: bold; color: black;">&lt;asset</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;text&#8221;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;assets/text/text.txt&#8221;</span> <span style="color: #000066;">preventCache</span>=<span style="color: #ff0000;">&#8220;true&#8221;</span> <span style="color: #000066;">weight</span>=<span style="color: #ff0000;">&#8220;574&#8243;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;asset</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;xml&#8221;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;assets/xml/sample.xml&#8221;</span> <span style="color: #000066;">preventCache</span>=<span style="color: #ff0000;">&#8220;true&#8221;</span> <span style="color: #000066;">weight</span>=<span style="color: #ff0000;">&#8220;79&#8243;</span><span style="font-weight: bold; color: black;">/&gt;</span></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: #009900;"><span style="font-weight: bold; color: black;">&lt;asset</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;video&#8221;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;assets/video/sample.flv&#8221;</span> <span style="color: #000066;">weight</span>=<span style="color: #ff0000;">&#8220;1550580&#8243;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;asset</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&#8220;zip&#8221;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&#8220;assets/zip/file.zip&#8221;</span> <span style="color: #000066;">weight</span>=<span style="color: #ff0000;">&#8220;3493&#8243;</span><span style="font-weight: bold; color: black;">/&gt;</span></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: #009900;"><span style="font-weight: bold; color: black;">&lt;/group<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/group<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/loader<span style="font-weight: bold; color: black;">&gt;</span></span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>First step, I create a SomaCore application.</p>
<div class="igBar"><span id="lactionscript-62"><a href="#" onclick="javascript:showPlainTxt('actionscript-62'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-62">
<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> Main<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; _app = <span style="color: #000000; font-weight: bold;">new</span> SomaApplication<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;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>In the application facade, I create a command from a SomaAssets just to demo how to monitor the assets loading at a framework level. I also register 3 views and 3 mediators to show how to get the assets at different moments. I create the plugin SomaAssets and I finally create a simple wire class &#8220;InitializeWire&#8221; to handle some global events (config loaded, assets loaded, etc).</p>
<div class="igBar"><span id="lactionscript-63"><a href="#" onclick="javascript:showPlainTxt('actionscript-63'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-63">
<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;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</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; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">commands</span>.<span style="color: #006600;">ExampleAssetCommand</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">SomaAssetsEvent</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">Soma</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">di</span>.<span style="color: #006600;">SomaInjector</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">ISoma</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">SomaAssets</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">views</span>.<span style="color: #006600;">ImageGroup</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">views</span>.<span style="color: #006600;">ImageGroupMediator</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">views</span>.<span style="color: #006600;">ImageWhenAllLoaded</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">views</span>.<span style="color: #006600;">ImageWhenAllLoadedMediator</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">views</span>.<span style="color: #006600;">ImageWhenNotLoaded</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">views</span>.<span style="color: #006600;">ImageWhenNotLoadedMediator</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">wires</span>.<span style="color: #006600;">InitializeWire</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">vo</span>.<span style="color: #006600;">SomaAssetsVO</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: #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;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; * @author Romuald Quantin</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> SomaApplication <span style="color: #0066CC;">extends</span> Soma <span style="color: #0066CC;">implements</span> ISoma <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: #000000; font-weight: bold;">var</span> _container:Main;</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> SomaApplication<span style="color: #66cc66;">&#40;</span>container:Main<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; _container = container;</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;">super</span><span style="color: #66cc66;">&#40;</span>_container.<span style="color: #0066CC;">stage</span>, SomaInjector<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; &nbsp; &nbsp; &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: #808080; font-style: italic;">// create a command for a demo purpose to monitor the assets that are loaded</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; override protected <span style="color: #000000; font-weight: bold;">function</span> registerCommands<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addCommand<span style="color: #66cc66;">&#40;</span>SomaAssetsEvent.<span style="color: #006600;">ASSET_LOADED</span>, ExampleAssetCommand<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; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// register mediators to views</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;">// the views won&#8217;t be created at the same moment to show how you can handle your loading </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; override protected <span style="color: #000000; font-weight: bold;">function</span> registerViews<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mediators.<span style="color: #006600;">mapView</span><span style="color: #66cc66;">&#40;</span>ImageWhenAllLoaded, ImageWhenAllLoadedMediator<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; mediators.<span style="color: #006600;">mapView</span><span style="color: #66cc66;">&#40;</span>ImageWhenNotLoaded, ImageWhenNotLoadedMediator<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; mediators.<span style="color: #006600;">mapView</span><span style="color: #66cc66;">&#40;</span>ImageGroup, ImageGroupMediator<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; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// create the plugin and register an external assets configuration to load</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; override protected <span style="color: #000000; font-weight: bold;">function</span> registerPlugins<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createPlugin<span style="color: #66cc66;">&#40;</span>SomaAssets, <span style="color: #000000; font-weight: bold;">new</span> SomaAssetsVO<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #ff0000;">&#8220;xml/assets.xml&#8221;</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; &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; </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;">// create an wire where you could handle the &quot;global&quot; loading process</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; override protected <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">start</span><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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; injector.<span style="color: #006600;">createInstance</span><span style="color: #66cc66;">&#40;</span>InitializeWire<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; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// just the document class to add some views to</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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> container<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:Main <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;">return</span> _container;</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; &nbsp; &nbsp; &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;">&#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>In the InitializeWire class, I add some event listeners to handle errors, when the XML config is loaded and when the assets are all loaded. I used it mostly to create views and mediators at different moments of the loading process to show you how to handle you loaders, events and assets.</p>
<div class="igBar"><span id="lactionscript-64"><a href="#" onclick="javascript:showPlainTxt('actionscript-64'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-64">
<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;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">wires</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; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">views</span>.<span style="color: #006600;">ImageGroup</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IWire</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">wire</span>.<span style="color: #006600;">Wire</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">SomaApplication</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">views</span>.<span style="color: #006600;">ImageWhenAllLoaded</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">views</span>.<span style="color: #006600;">ImageWhenNotLoaded</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">SomaAssetsEvent</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;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">DisplayObjectContainer</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;">import</span> org.<span style="color: #006600;">assetloader</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">IAssetLoader</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; * @author Romuald Quantin</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;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> InitializeWire <span style="color: #0066CC;">extends</span> Wire <span style="color: #0066CC;">implements</span> IWire <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; </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;">&#91;</span>Inject<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&#8220;assets&#8221;</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; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> loader:IAssetLoader;</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; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// register some SomaAssets events for monitoring</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; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> initialize<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addEventListener<span style="color: #66cc66;">&#40;</span>SomaAssetsEvent.<span style="color: #006600;">CONFIG_LOADED</span>, configLoaded<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; addEventListener<span style="color: #66cc66;">&#40;</span>SomaAssetsEvent.<span style="color: #006600;">LOADER_COMPLETE</span>, assetsComplete<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; addEventListener<span style="color: #66cc66;">&#40;</span>SomaAssetsEvent.<span style="color: #0066CC;">ERROR</span>, assetsErrorHandler<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; &nbsp; &nbsp; &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: #808080; font-style: italic;">// shortcut to get the document class</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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> container<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <img src='http://www.soundstep.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> isplayObjectContainer <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> SomaApplication<span style="color: #66cc66;">&#40;</span>instance<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">container</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;">// in case there&#8217;s an error for both the assets config or the assets</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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> assetsErrorHandler<span style="color: #66cc66;">&#40;</span>event:SomaAssetsEvent<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: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;Asset Error:&#8221;</span>, event.<span style="color: #006600;">errorMessage</span>, event.<span style="color: #006600;">errorType</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; &nbsp; &nbsp; &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: #808080; font-style: italic;">// the external XML assets config has been loaded here </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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> configLoaded<span style="color: #66cc66;">&#40;</span>event:SomaAssetsEvent<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; container.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ImageWhenNotLoaded<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; container.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ImageGroup<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;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;config loaded&#8221;</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; loader.<span style="color: #0066CC;">start</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; <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; </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;">// all assets container in the config XML have been loaded here </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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> assetsComplete<span style="color: #66cc66;">&#40;</span>event:SomaAssetsEvent<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; container.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ImageWhenAllLoaded<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; &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; <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>In the ImageWhenAllLoadedMediator mediator, I inject directly an asset (Bitmap) as everything is loaded when the mediator gets created.</p>
<div class="igBar"><span id="lactionscript-65"><a href="#" onclick="javascript:showPlainTxt('actionscript-65'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-65">
<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;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">views</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; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IMediator</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">mediator</span>.<span style="color: #006600;">Mediator</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: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Bitmap</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: #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;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; * @author Romuald Quantin</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> ImageWhenAllLoadedMediator <span style="color: #0066CC;">extends</span> Mediator <span style="color: #0066CC;">implements</span> IMediator <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: #66cc66;">&#91;</span>Inject<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; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> view:ImageWhenAllLoaded;</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; </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;">// all the assets are loaded at this point</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;">// we can inject the asset (or loaders)</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;">&#91;</span>Inject<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&#8220;image0&#8243;</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; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> image:Bitmap;</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; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> initialize<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image.<span style="color: #006600;">scaleX</span> = image.<span style="color: #006600;">scaleY</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</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; image.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;color:#800000;">130</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; view.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>image<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; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> dispose<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-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;">while</span> <span style="color: #66cc66;">&#40;</span>view.<span style="color: #006600;">numChildren</span>&gt; <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> view.<span style="color: #006600;">removeChildAt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</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; view = <span style="color: #000000; font-weight: bold;">null</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; image = <span style="color: #000000; font-weight: bold;">null</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>The ImageWhenNotLoadedMediator mediator gets created when the XML config has been loaded. The assets are not loaded yet and I show how to retrieve the loader of a specific asset to monitor when it starts, the loading progress and when it has been completed.</p>
<div class="igBar"><span id="lactionscript-66"><a href="#" onclick="javascript:showPlainTxt('actionscript-66'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-66">
<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;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">views</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; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Bitmap</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IMediator</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">mediator</span>.<span style="color: #006600;">Mediator</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: #0066CC;">import</span> org.<span style="color: #006600;">assetloader</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">ILoader</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;">import</span> org.<span style="color: #006600;">assetloader</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">AssetLoaderErrorEvent</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;">import</span> org.<span style="color: #006600;">assetloader</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">AssetLoaderEvent</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;">import</span> org.<span style="color: #006600;">assetloader</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">AssetLoaderProgressEvent</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: #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;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; * @author Romuald Quantin</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> ImageWhenNotLoadedMediator <span style="color: #0066CC;">extends</span> Mediator <span style="color: #0066CC;">implements</span> IMediator <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: #66cc66;">&#91;</span>Inject<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; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> view:ImageWhenNotLoaded;</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; </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;">// here we get the loader of an asset for monitoring purpose</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;">// this one is an ImageLoader but we keep the interface as a type</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;">&#91;</span>Inject<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&#8220;image1&#8243;</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; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> imageLoader:ILoader;</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; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// add some listeners to monitor the loading of a single loader </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; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> initialize<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imageLoader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>AssetLoaderErrorEvent.<span style="color: #0066CC;">ERROR</span>, errorHandler<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; imageLoader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>AssetLoaderEvent.<span style="color: #0066CC;">START</span>, startHandler<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; imageLoader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>AssetLoaderProgressEvent.<span style="color: #006600;">PROGRESS</span>, 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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imageLoader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>AssetLoaderEvent.<span style="color: #006600;">COMPLETE</span>, 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;">&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> errorHandler<span style="color: #66cc66;">&#40;</span>event:AssetLoaderErrorEvent<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; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;Error&#8221;</span>, event.<span style="color: #006600;">errorType</span>, event.<span style="color: #0066CC;">message</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;</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> startHandler<span style="color: #66cc66;">&#40;</span>event:AssetLoaderEvent<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; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;Loading started (&#8220;</span> + ILoader<span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">currentTarget</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">id</span> + <span style="color: #ff0000;">&#8220;)&#8221;</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;</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> progressHandler<span style="color: #66cc66;">&#40;</span>event:AssetLoaderProgressEvent<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; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;Loading progress (&#8220;</span> + ILoader<span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">currentTarget</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">id</span> + <span style="color: #ff0000;">&#8220;) progress:&#8221;</span>, event.<span style="color: #006600;">progress</span>, <span style="color: #ff0000;">&#8220;, speed:&#8221;</span>, event.<span style="color: #006600;">speed</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; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// the loader is complete, the asset is ready</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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> completeHandler<span style="color: #66cc66;">&#40;</span>event:AssetLoaderEvent<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: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;Loading completed (&#8220;</span> + ILoader<span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">currentTarget</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">id</span> + <span style="color: #ff0000;">&#8220;)&#8221;</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> image:Bitmap = event.<span style="color: #0066CC;">data</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; image.<span style="color: #006600;">scaleX</span> = image.<span style="color: #006600;">scaleY</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</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; view.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>image<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; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> dispose<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-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;">while</span> <span style="color: #66cc66;">&#40;</span>view.<span style="color: #006600;">numChildren</span>&gt; <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> view.<span style="color: #006600;">removeChildAt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</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; view = <span style="color: #000000; font-weight: bold;">null</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; imageLoader = <span style="color: #000000; font-weight: bold;">null</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>The ImageGroupMediator mediator does the same job as the mediator above but applied to an IAssetLoader (loader containing others loaders). The way to monitor the loading process is exactly the same. I also show different ways to retrieve the assets of this group, once the groupe has been loaded. You will notice the special injection name of the loader, it is a path generated from the XML config using the group and assets ids and a delimiter.</p>
<div class="igBar"><span id="lactionscript-67"><a href="#" onclick="javascript:showPlainTxt('actionscript-67'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-67">
<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;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">views</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; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Bitmap</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">SomaAssets</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IMediator</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">mediator</span>.<span style="color: #006600;">Mediator</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;">import</span> org.<span style="color: #006600;">assetloader</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">IAssetLoader</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;">import</span> org.<span style="color: #006600;">assetloader</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">ILoader</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;">import</span> org.<span style="color: #006600;">assetloader</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">AssetLoaderErrorEvent</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;">import</span> org.<span style="color: #006600;">assetloader</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">AssetLoaderEvent</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;">import</span> org.<span style="color: #006600;">assetloader</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">AssetLoaderProgressEvent</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;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">Dictionary</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: #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;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; * @author Romuald Quantin</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> ImageGroupMediator <span style="color: #0066CC;">extends</span> Mediator <span style="color: #0066CC;">implements</span> IMediator <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: #66cc66;">&#91;</span>Inject<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; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> view:ImageGroup;</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; </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;">// here we get the plugin</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;">&#91;</span>Inject<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&#8220;assets&#8221;</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; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> assets:SomaAssets;</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: #808080; font-style: italic;">// here we get a group using a path (ids + delimiter)</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;">&#91;</span>Inject<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&#8220;group0/group00&#8243;</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; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> imageGroup:IAssetLoader;</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; </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;">// add some listeners to monitor the loading of a single group </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; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> initialize<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imageGroup.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>AssetLoaderErrorEvent.<span style="color: #0066CC;">ERROR</span>, 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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imageGroup.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>AssetLoaderEvent.<span style="color: #0066CC;">START</span>, startHandler<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; imageGroup.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>AssetLoaderProgressEvent.<span style="color: #006600;">PROGRESS</span>, 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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imageGroup.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>AssetLoaderEvent.<span style="color: #006600;">COMPLETE</span>, 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; <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> errorHandler<span style="color: #66cc66;">&#40;</span>event:AssetLoaderErrorEvent<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: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;Error&#8221;</span>, event.<span style="color: #006600;">errorType</span>, event.<span style="color: #0066CC;">message</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> startHandler<span style="color: #66cc66;">&#40;</span>event:AssetLoaderEvent<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: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;Loading started (&#8220;</span> + ILoader<span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">currentTarget</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">id</span> + <span style="color: #ff0000;">&#8220;)&#8221;</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> progressHandler<span style="color: #66cc66;">&#40;</span>event:AssetLoaderProgressEvent<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: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;Loading progress (&#8220;</span> + ILoader<span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">currentTarget</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">id</span> + <span style="color: #ff0000;">&#8220;) progress:&#8221;</span>, event.<span style="color: #006600;">progress</span>, <span style="color: #ff0000;">&#8220;, speed:&#8221;</span>, event.<span style="color: #006600;">speed</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: #808080; font-style: italic;">// now the group is loaded, get the 2 images from the group </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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> completeHandler<span style="color: #66cc66;">&#40;</span>event:AssetLoaderEvent<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; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;Loading completed (&#8220;</span> + ILoader<span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">currentTarget</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">id</span> + <span style="color: #ff0000;">&#8220;)&#8221;</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; <span style="color: #000000; font-weight: bold;">var</span> images:Dictionary = event.<span style="color: #0066CC;">data</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;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;asset from dictionary&#8221;</span>, images<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#8220;image3&#8243;</span><span style="color: #66cc66;">&#93;</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; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;asset from loader:&#8221;</span>, imageGroup.<span style="color: #006600;">getAsset</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;image3&#8243;</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;asset from plugin:&#8221;</span>, assets.<span style="color: #006600;">getAssets</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;group0/group00/image3&#8243;</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> image2:Bitmap = images<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#8220;image2&#8243;</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> image3:Bitmap = images<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#8220;image3&#8243;</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; &nbsp; &nbsp; &nbsp; &nbsp; image2.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;color:#800000;">290</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; image2.<span style="color: #006600;">scaleX</span> = image2.<span style="color: #006600;">scaleY</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</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; image3.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;color:#800000;">340</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; image3.<span style="color: #006600;">scaleX</span> = image3.<span style="color: #006600;">scaleY</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</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; view.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>image2<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; view.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>image3<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; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> dispose<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-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;">while</span> <span style="color: #66cc66;">&#40;</span>view.<span style="color: #006600;">numChildren</span>&gt; <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> view.<span style="color: #006600;">removeChildAt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</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; view = <span style="color: #000000; font-weight: bold;">null</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; imageGroup = <span style="color: #000000; font-weight: bold;">null</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>The ExampleAssetCommand command is just a demo to show that you can use the SomaAssetsEvent class to directly create commands from it. In this example I used the type SomaAssetsEvent.ASSET_LOADED. The command will get created every time an asset is loaded.</p>
<div class="igBar"><span id="lactionscript-68"><a href="#" onclick="javascript:showPlainTxt('actionscript-68'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-68">
<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;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">commands</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; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">Command</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">ICommand</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">SomaAssets</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">demo</span>.<span style="color: #006600;">SomaApplication</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">plugins</span>.<span style="color: #006600;">assets</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">SomaAssetsEvent</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: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">DisplayObjectContainer</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;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</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;">import</span> flash.<span style="color: #006600;">media</span>.<span style="color: #0066CC;">Sound</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;">import</span> flash.<span style="color: #006600;">media</span>.<span style="color: #0066CC;">Video</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;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #0066CC;">NetStream</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;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</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;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">getQualifiedClassName</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; * @author Romuald Quantin</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;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExampleAssetCommand <span style="color: #0066CC;">extends</span> Command <span style="color: #0066CC;">implements</span> ICommand <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; </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;">&#91;</span>Inject<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; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> evt:SomaAssetsEvent;</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; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&#8220;assets&#8221;</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; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> assets:SomaAssets;</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; </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;">// just some examples</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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> execute<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; <span style="color: #000000; font-weight: bold;">var</span> container:DisplayObjectContainer = SomaApplication<span style="color: #66cc66;">&#40;</span>instance<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">container</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;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;Command Example (&#8220;</span> + evt.<span style="color: #006600;">path</span> + <span style="color: #ff0000;">&#8220;)&gt; &#8220;</span> + assets.<span style="color: #006600;">getLoader</span><span style="color: #66cc66;">&#40;</span>evt.<span style="color: #006600;">path</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">type</span> + <span style="color: #ff0000;">&#8221; Loaded: &#8220;</span> +&nbsp; getQualifiedClassName<span style="color: #66cc66;">&#40;</span>evt.<span style="color: #006600;">asset</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// you can use a switch to find the assets:</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;">switch</span> <span style="color: #66cc66;">&#40;</span>evt.<span style="color: #006600;">path</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">&#8220;group0/group01/css&#8221;</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: #b1b100;">break</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;">case</span> <span style="color: #ff0000;">&#8220;group0/group01/json&#8221;</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: #b1b100;">break</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;">case</span> <span style="color: #ff0000;">&#8220;group0/group01/sound&#8221;</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: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">sound</span>:<span style="color: #0066CC;">Sound</span> = evt.<span style="color: #006600;">asset</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; &nbsp; &nbsp; <span style="color: #0066CC;">sound</span>.<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</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; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</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;">case</span> <span style="color: #ff0000;">&#8220;group0/group01/text&#8221;</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: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">textfield</span>:<span style="color: #0066CC;">TextField</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</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; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">textfield</span>.<span style="color: #0066CC;">multiline</span> = <span style="color: #0066CC;">textfield</span>.<span style="color: #0066CC;">wordWrap</span> = <span style="color: #000000; font-weight: bold;">true</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;">textfield</span>.<span style="color: #0066CC;">text</span> = evt.<span style="color: #006600;">asset</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; &nbsp; &nbsp; container.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">textfield</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; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</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;">case</span> <span style="color: #ff0000;">&#8220;group0/group01/xml&#8221;</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: #b1b100;">break</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;">case</span> <span style="color: #ff0000;">&#8220;group0/group01/video&#8221;</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: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">video</span>:<span style="color: #0066CC;">Video</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Video</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; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> stream:<span style="color: #0066CC;">NetStream</span> = evt.<span style="color: #006600;">asset</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; container.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">video</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; &nbsp; &nbsp; <span style="color: #0066CC;">video</span>.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">80</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;">video</span>.<span style="color: #0066CC;">smoothing</span> = <span style="color: #000000; font-weight: bold;">true</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; &nbsp; &nbsp; <span style="color: #0066CC;">video</span>.<span style="color: #006600;">attachNetStream</span><span style="color: #66cc66;">&#40;</span>stream<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; &nbsp; &nbsp; &nbsp; stream.<span style="color: #006600;">resume</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; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</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: #b1b100;">case</span> <span style="color: #ff0000;">&#8220;group0/group01/zip&#8221;</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; &nbsp; &nbsp; <span style="color: #b1b100;">break</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; &nbsp; &nbsp; &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;">&#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>This implementation is just an example as it could be handled in very different ways, but that should get you started.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2011/06/06/somaassets-demo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SomaCore plugin to load and manage assets: SomaAssets</title>
		<link>http://www.soundstep.com/blog/2011/06/03/somacore-plugin-assets-somaassets/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somacore-plugin-assets-somaassets</link>
		<comments>http://www.soundstep.com/blog/2011/06/03/somacore-plugin-assets-somaassets/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 14:13:10 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaCore]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=622</guid>
		<description><![CDATA[Two new releases today, an asset loader and the SomaCore plugin: SomaAssets. The AssetLoader library is a port from Matan&#8217;s AssetLoader library to be event-based, it makes you able to load and manage multiple assets (image, video, xml, sound, etc) in your application. SomaAssets is a plugin based on the AssetLoader library to easily access [...]]]></description>
			<content:encoded><![CDATA[<p>Two new releases today, an asset loader and the <a href="http://www.soundstep.com/blog/downloads/somacore/">SomaCore</a> plugin: <a href="https://github.com/soundstep/somacore_plugins" target="_blank">SomaAssets</a>.</p>
<p>The <a href="https://github.com/soundstep/AssetLoader" target="_blank">AssetLoader</a> library is a port from <a href="https://github.com/Matan/AssetLoader" target="_blank">Matan&#8217;s AssetLoader</a> library to be event-based, it makes you able to load and manage multiple assets (image, video, xml, sound, etc) in your application.</p>
<p>SomaAssets is a plugin based on the AssetLoader library to easily access to your assets and effectively integrate them in your <a href="http://www.soundstep.com/blog/downloads/somacore/">SomaCore</a> application with paths and automatic mapping name generation for injection.</p>
<p>Special thanks to <a href="http://doesflash.com/" target="_blank">Matan</a> for his help with the AssetLoader and his joy in general, a pleasure to &#8220;meet&#8221; him.</p>
<p>You can read the SomaAssets wiki section to get started with it, but I&#8217;ll post below a few hints of what you can easily do with it within a SomaCore application.</p>
<p><a href="https://github.com/soundstep/AssetLoader" target="_blank">AssetLoader source</a><br />
<a href="https://github.com/soundstep/AssetLoader/wiki" target="_blank">AssetLoader wiki</a><br />
<a href="https://github.com/soundstep/somacore_plugins" target="_blank">SomaAssets source</a><br />
<a href="https://github.com/soundstep/somacore_plugins/wiki/SomaAssets" target="_blank">SomaAssets wiki</a></p>
<p>Easily <a href="https://github.com/soundstep/somacore_plugins/wiki/SomaAssets#createplugin" target="_blank">create the plugin</a> and add a <a href="https://github.com/soundstep/somacore_plugins/wiki/SomaAssets#addconfig" target="_blank">XML config file</a> for the assets.</p>
<div class="igBar"><span id="lactionscript-72"><a href="#" onclick="javascript:showPlainTxt('actionscript-72'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-72">
<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;">createPlugin<span style="color: #66cc66;">&#40;</span>SomaAssets, <span style="color: #000000; font-weight: bold;">new</span> SomaAssetsVO<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #ff0000;">&#8220;xml/assets_config.xml&#8221;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Easily <a href="https://github.com/soundstep/somacore_plugins/wiki/SomaAssets#retrievingassets" target="_blank">retrieve the assets</a> with paths through the XML config.</p>
<div class="igBar"><span id="lactionscript-73"><a href="#" onclick="javascript:showPlainTxt('actionscript-73'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-73">
<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> image:Bitmap = assets.<span style="color: #006600;">getAssets</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;group0/group00/img0&#8243;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Easily <a href="https://github.com/soundstep/somacore_plugins/wiki/SomaAssets#injection" target="_blank">retrieve the plugin, main loader, config and assets with injection</a> in a SomaCore application. The following mapping names have been automatically generated from the XML config.</p>
<div class="igBar"><span id="lactionscript-74"><a href="#" onclick="javascript:showPlainTxt('actionscript-74'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-74">
<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>Inject<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&#8220;assets&#8221;</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;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> plugin:SomaAssets;</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;">&#91;</span>Inject<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&#8220;assets&#8221;</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;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> loader:IAssetLoader;</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;">&#91;</span>Inject<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&#8220;group0/group00/img0&#8243;</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;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> loaderType1:ImageLoader;</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;">&#91;</span>Inject<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&#8220;group0/group00/img0&#8243;</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;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> assetType1:Bitmap; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2011/06/03/somacore-plugin-assets-somaassets/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>AS3 debugging interface with BinderUI</title>
		<link>http://www.soundstep.com/blog/2011/05/17/as3-debugging-interface-with-binder-ui/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=as3-debugging-interface-with-binder-ui</link>
		<comments>http://www.soundstep.com/blog/2011/05/17/as3-debugging-interface-with-binder-ui/#comments</comments>
		<pubDate>Tue, 17 May 2011 09:31:57 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=615</guid>
		<description><![CDATA[BinderUI is a debugging tools to help you create interfaces and debug values. Very often I’m sure you spend time building visual interfaces to set, to see and to debug some values. This can be useful for example to show to the creative (or even the client?) and extract the right values instead of tweaking [...]]]></description>
			<content:encoded><![CDATA[<p>BinderUI is a debugging tools to help you create interfaces and debug values.</p>
<p>Very often I’m sure you spend time building visual interfaces to set, to see and to debug some values.<br />
This can be useful for example to show to the creative (or even the client?) and extract the right values instead of tweaking thing for ages, I’m sure you know what I mean.</p>
<p>That can be time consuming and is often very annoying so I wanted to ease the process (1 line of code and a metadata tag).</p>
<p>BinderUI is a simple static class and the idea is to “bind” a value to visual components such as slider, knob, meter, text input, and so on. For the components I used the library <a href="http://www.minimalcomps.com/" target="_blank">minimalComps</a>.</p>
<p>That means that the bound values will update the components in real-time and the components will update the values (two-ways). I used the BindingUtils and ChangeWatcher classes from the mx package but as it will be for debugging, you can use it on project that will be pure AS3 as well.</p>
<p><a href="http://www.soundstep.com/blog/source/binderui/binderui.swf" class="lightwindow" params="lightwindow_width=1000,lightwindow_height=600" title="BinderUI"><img src="/blog/source/binderui/preview.png"><br />
<br clear="all"/>Click here to see the demo.</a></p>
<p>As a quick example, imagine you have a custom darkness property on your custom class, you can bind the value this way:</p>
<pre>
BinderUI.displaySliderHorizontal(this, _mySprite, "darkness", "darkness", null, 0.1, 1, -255, 255);
</pre>
<p>This will create a slider that will update (and be updated) for your darkness property.</p>
<p>You’ll also need to add a Bindable metadata in your class:</p>
<div class="igBar"><span id="lactionscript-82"><a href="#" onclick="javascript:showPlainTxt('actionscript-82'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-82">
<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>Bindable<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;">class</span> MySprite <span style="color: #0066CC;">extends</span> Sprite <span style="color: #66cc66;">&#123;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Note: in case you want to debug built-in flash properties (such as x and y), you’ll need to override the properties in your custom class even if it does nothing.</p>
<div class="igBar"><span id="lactionscript-83"><a href="#" onclick="javascript:showPlainTxt('actionscript-83'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-83">
<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;">override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> x<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</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: #b1b100;">return</span> <span style="color: #0066CC;">super</span>.<span style="color: #006600;">x</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;">override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> x<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Number</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; <span style="color: #0066CC;">super</span>.<span style="color: #006600;">x</span> = value;</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>For now you can debug only properties (getters and setters), and types that are String, Number, Boolean (and color).</p>
<p>Here is a list of component that can be used.</p>
<div class="igBar"><span id="lactionscript-84"><a href="#" onclick="javascript:showPlainTxt('actionscript-84'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-84">
<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;">BinderUI.<span style="color: #006600;">displayLabel</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, s, <span style="color: #ff0000;">&#8220;x&#8221;</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;">BinderUI.<span style="color: #006600;">displayColorChooser</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, sprite, <span style="color: #ff0000;">&#8220;color&#8221;</span>, 0xFFFF00<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;">BinderUI.<span style="color: #006600;">displayCheckBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, sprite, <span style="color: #ff0000;">&#8220;halfTransparent&#8221;</span>, <span style="color: #ff0000;">&#8220;half transparent&#8221;</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;">BinderUI.<span style="color: #006600;">displayIndicatorLight</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, sprite, <span style="color: #ff0000;">&#8220;halfTransparent&#8221;</span>, <span style="color: #ff0000;">&#8220;half transparent&#8221;</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;">BinderUII.<span style="color: #006600;">displayNumericStepper</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, sprite, <span style="color: #ff0000;">&#8220;x&#8221;</span>, <span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">900</span>, <span style="color: #cc66cc;color:#800000;">1</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;">BinderUI.<span style="color: #006600;">displayInput</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, sprite, <span style="color: #ff0000;">&#8220;x&#8221;</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;">BinderUI.<span style="color: #006600;">displaySliderHorizontal</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, sprite, <span style="color: #ff0000;">&#8220;x&#8221;</span>, <span style="color: #ff0000;">&#8220;x&#8221;</span>, <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">900</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;">BinderUI.<span style="color: #006600;">displaySliderVertical</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, sprite, <span style="color: #ff0000;">&#8220;x&#8221;</span>, <span style="color: #ff0000;">&#8220;x&#8221;</span>, <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">900</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;">BinderUI.<span style="color: #006600;">displayTextarea</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, sprite, <span style="color: #ff0000;">&#8220;x&#8221;</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;">BinderUI.<span style="color: #006600;">displayKnob</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, sprite, <span style="color: #ff0000;">&#8220;x&#8221;</span>, <span style="color: #ff0000;">&#8220;x&#8221;</span>, <span style="color: #000000; font-weight: bold;">null</span>, Knob.<span style="color: #006600;">VERTICAL</span>, <span style="color: #cc66cc;color:#800000;">20</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">900</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;">BinderUI.<span style="color: #006600;">displayMeter</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, sprite, <span style="color: #ff0000;">&#8220;x&#8221;</span>, <span style="color: #ff0000;">&#8220;x&#8221;</span>, <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">900</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>In some case, it is harder to bind values, such as when you want to update a component from what you type in a textfield. You’ll need to dispatch an event yourself (usually these events are added by the compiler with the Bindable metadata tag).</p>
<div class="igBar"><span id="lactionscript-85"><a href="#" onclick="javascript:showPlainTxt('actionscript-85'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-85">
<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;">dispatchEvent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> PropertyChangeEvent<span style="color: #66cc66;">&#40;</span>PropertyChangeEvent.<span style="color: #006600;">PROPERTY_CHANGE</span>, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #000000; font-weight: bold;">false</span>, PropertyChangeEventKind.<span style="color: #006600;">UPDATE</span>, <span style="color: #ff0000;">&#8216;text&#8217;</span>, oldValue, newValue, <span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>About colors, you can use the displayColorChooser method. The easiest is using a “color” property for example.</p>
<div class="igBar"><span id="lactionscript-86"><a href="#" onclick="javascript:showPlainTxt('actionscript-86'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-86">
<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;">BinderUI.<span style="color: #006600;">displayColorChooser</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, mySprite, <span style="color: #ff0000;">&#8220;color&#8221;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You can also use the colorTransform property but this property is not bindable, so it will work only in one way (component —> target):</p>
<div class="igBar"><span id="lactionscript-87"><a href="#" onclick="javascript:showPlainTxt('actionscript-87'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-87">
<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;">BinderUI.<span style="color: #006600;">displayColorChooser</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, mySprite.<span style="color: #006600;">transform</span>, <span style="color: #ff0000;">&#8220;color&#8221;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You can also use the <a href="http://www.minimalcomps.com/?page_id=14" target="_blank">MinimalConfigurator</a> to create your interface from an XML file.</p>
<p>Three methods are available to dispose (remove and destroy) components. You can dispose by target, by component or dispose everything.</p>
<div class="igBar"><span id="lactionscript-88"><a href="#" onclick="javascript:showPlainTxt('actionscript-88'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-88">
<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;">BinderUI.<span style="color: #006600;">disposeByTarget</span><span style="color: #66cc66;">&#40;</span>mySprite<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;">BinderUI.<span style="color: #006600;">disposeByComponent</span><span style="color: #66cc66;">&#40;</span>myComponent<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;">BinderUI.<span style="color: #006600;">dispose</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><a href="http://www.soundstep.com/blog/source/binderui/binderui.zip" target="_blank">Download source and demos.</a><br />
<a href="http://github.com/soundstep/soundstep-utils" target="_blank">Source on github.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2011/05/17/as3-debugging-interface-with-binder-ui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Knob AS3 drag on circle or ellipse</title>
		<link>http://www.soundstep.com/blog/2011/04/08/knob-as3-drag-on-circle-or-ellipse/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=knob-as3-drag-on-circle-or-ellipse</link>
		<comments>http://www.soundstep.com/blog/2011/04/08/knob-as3-drag-on-circle-or-ellipse/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 13:58:20 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=604</guid>
		<description><![CDATA[I needed some knobs for a debug interface. I share this very simple class to use so you don&#8217;t have to rebuild it from scratch, it should be pretty flexible. Click here to see the demo. Download source. The knob can be used as circle or ellipse, here is how to create one: Plain Text [...]]]></description>
			<content:encoded><![CDATA[<p>I needed some knobs for a debug interface. I share this very simple class to use so you don&#8217;t have to rebuild it from scratch, it should be pretty flexible.</p>
<p><a href="http://www.soundstep.com/blog/source/knob/knob.swf" class="lightwindow" params="lightwindow_width=550,lightwindow_height=400" title="Knob AS3"><img src="/blog/source/knob/preview.png"><br />
<br clear="all"/>Click here to see the demo.</a></p>
<p><a href="http://www.soundstep.com/blog/source/knob/knob.zip" target="_blank">Download source.</a></p>
<p>The knob can be used as circle or ellipse, here is how to create one:</p>
<div class="igBar"><span id="lactionscript-92"><a href="#" onclick="javascript:showPlainTxt('actionscript-92'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-92">
<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> knob:Knob = <span style="color: #000000; font-weight: bold;">new</span> Knob<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;">knob.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">CHANGE</span>, changeHandler<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;">addChild<span style="color: #66cc66;">&#40;</span>knob<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: #000000; font-weight: bold;">function</span> changeHandler<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; <span style="color: #000000; font-weight: bold;">var</span> knob:Knob = event.<span style="color: #006600;">currentTarget</span> as Knob;</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;">trace</span><span style="color: #66cc66;">&#40;</span>knob.<span style="color: #006600;">value</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; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>knob.<span style="color: #006600;">valuePercent</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;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Set the radius, a custom handler and a custom graphic:</p>
<div class="igBar"><span id="lactionscript-93"><a href="#" onclick="javascript:showPlainTxt('actionscript-93'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-93">
<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> customHandler:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<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;">customHandler.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xFF0000<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;">customHandler.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;color:#800000;">10</span>, -<span style="color: #cc66cc;color:#800000;">10</span>, <span style="color: #cc66cc;color:#800000;">20</span>, <span style="color: #cc66cc;color:#800000;">20</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;">customHandler.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</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;"><span style="color: #000000; font-weight: bold;">var</span> knob:Knob =&nbsp; = <span style="color: #000000; font-weight: bold;">new</span> Knob<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">50</span>, customHandler<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;">knob.<span style="color: #006600;">stylePathColor</span> = 0x00FF00;</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;">knob.<span style="color: #006600;">stylePathThickness</span> = <span style="color: #cc66cc;color:#800000;">3</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">knob.<span style="color: #006600;">stylePathAlpha</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">3</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>That&#8217;s pretty much it, here is the class:</p>
<div class="igBar"><span id="lactionscript-94"><a href="#" onclick="javascript:showPlainTxt('actionscript-94'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-94">
<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 <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; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">DisplayObject</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;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</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;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</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;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</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: #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;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; * @author Romuald Quantin</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> Knob <span style="color: #0066CC;">extends</span> Sprite <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: #000000; font-weight: bold;">var</span> _radiusX:<span style="color: #0066CC;">Number</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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _radiusY:<span style="color: #0066CC;">Number</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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _handler:DisplayObject;</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;">var</span> _sector:Sector;</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; </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;">var</span> _stylePathColor:uint = 0xCCCCCC;</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> _stylePathAlpha:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">1</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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _stylePathThickness:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</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;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Knob<span style="color: #66cc66;">&#40;</span>radiusX:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">100</span>, radiusY:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">100</span>, handler:DisplayObject = <span style="color: #000000; font-weight: bold;">null</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; setRadius<span style="color: #66cc66;">&#40;</span>radiusX, radiusY<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; setHandler<span style="color: #66cc66;">&#40;</span>handler<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; updatePositionFromDegree<span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;color:#800000;">90</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> setRadius<span style="color: #66cc66;">&#40;</span>radiusX:<span style="color: #0066CC;">Number</span>, radiusY:<span style="color: #0066CC;">Number</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; &nbsp; &nbsp; &nbsp; &nbsp; _radiusX = radiusX;</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; _radiusY = radiusY;</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;">if</span> <span style="color: #66cc66;">&#40;</span>!_sector<span style="color: #66cc66;">&#41;</span> _sector = <span style="color: #000000; font-weight: bold;">new</span> Sector<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, _radiusX, _radiusY<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; draw<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; &nbsp; updatePosition<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; <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> setHandler<span style="color: #66cc66;">&#40;</span>value:DisplayObject<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; disposeDragabble<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; _handler = <span style="color: #66cc66;">&#40;</span>!value<span style="color: #66cc66;">&#41;</span> ? createNewHandler<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : value;</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; setHandlerListeners<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; addChild<span style="color: #66cc66;">&#40;</span>_handler<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; updatePosition<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; <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> setHandlerListeners<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _handler.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_DOWN</span>, mouseDownHandler<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> removeHandlerListeners<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _handler.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_DOWN</span>, mouseDownHandler<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;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_UP</span>, mouseUpHandler<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;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_MOVE</span>, mouseMoveHandler<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;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">MOUSE_LEAVE</span>, mouseLeaveHandler<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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> mouseLeaveHandler<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; stopDragging<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;</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> mouseDownHandler<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startDragging<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;</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> mouseUpHandler<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stopDragging<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;</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> startDragging<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-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;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_UP</span>, mouseUpHandler<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;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_UP</span>, mouseUpHandler<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;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_MOVE</span>, mouseMoveHandler<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;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_MOVE</span>, mouseMoveHandler<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;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">MOUSE_LEAVE</span>, mouseLeaveHandler<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;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">MOUSE_LEAVE</span>, mouseLeaveHandler<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> stopDragging<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_UP</span>, mouseUpHandler<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;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_MOVE</span>, mouseMoveHandler<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;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">MOUSE_LEAVE</span>, mouseLeaveHandler<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> mouseMoveHandler<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; updatePosition<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; <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> updatePosition<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> ratio:<span style="color: #0066CC;">Number</span> = _radiusX / _radiusY;</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> angle:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">atan2</span><span style="color: #66cc66;">&#40;</span>mouseX, mouseY<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; updatePositionFromDegree<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">90</span> &#8211; <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">atan2</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span>, <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span>angle<span style="color: #66cc66;">&#41;</span> * ratio<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> * <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">180</span> / <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dispatchEvent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">CHANGE</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; &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> updatePositionFromDegree<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Number</span><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; _sector.<span style="color: #006600;">degree</span> = value;</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; _sector.<span style="color: #006600;">radiusX</span> = _radiusX;</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; _sector.<span style="color: #006600;">radiusY</span> = _radiusY;</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;">if</span> <span style="color: #66cc66;">&#40;</span>_handler<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; _handler.<span style="color: #006600;">x</span> = _sector.<span style="color: #006600;">x</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; _handler.<span style="color: #006600;">y</span> = _sector.<span style="color: #006600;">y</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; <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> createNewHandler<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : DisplayObject <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: #000000; font-weight: bold;">var</span> circle:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<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; &nbsp; circle.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0x434F6C<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; circle.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawCircle</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> circle;</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> draw<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; graphics.<span style="color: #0066CC;">clear</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; graphics.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span>_stylePathThickness, _stylePathColor, _stylePathAlpha<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; graphics.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span>_sector.<span style="color: #006600;">x</span>, _sector.<span style="color: #006600;">y</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> i:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</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> l:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">360</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;">for</span> <span style="color: #66cc66;">&#40;</span>; i &lt;= l; ++i<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; _sector.<span style="color: #006600;">degree</span> = i;</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; _sector.<span style="color: #006600;">radiusX</span> = _radiusX;</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; _sector.<span style="color: #006600;">radiusY</span> = _radiusY;</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; graphics.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span>_sector.<span style="color: #006600;">x</span>, _sector.<span style="color: #006600;">y</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; <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; &nbsp; &nbsp; graphics.<span style="color: #0066CC;">endFill</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;</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> radiusX<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</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; <span style="color: #b1b100;">return</span> _radiusX;</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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> radiusX<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Number</span><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; setRadius<span style="color: #66cc66;">&#40;</span>value, _radiusY<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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> radiusY<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</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; <span style="color: #b1b100;">return</span> _radiusY;</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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> radiusY<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Number</span><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; setRadius<span style="color: #66cc66;">&#40;</span>_radiusX, value<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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> handler<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : DisplayObject <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> _handler;</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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> handler<span style="color: #66cc66;">&#40;</span>value:DisplayObject<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; setHandler<span style="color: #66cc66;">&#40;</span>value<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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> value<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</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; <span style="color: #b1b100;">return</span> _sector.<span style="color: #006600;">degree</span> + <span style="color: #cc66cc;color:#800000;">90</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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> value<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Number</span><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; updatePositionFromDegree<span style="color: #66cc66;">&#40;</span>value &#8211; <span style="color: #cc66cc;color:#800000;">90</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;</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> valuePercent<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</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; <span style="color: #b1b100;">return</span> value / <span style="color: #cc66cc;color:#800000;">360</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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> valuePercent<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Number</span><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; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">value</span> = <span style="color: #cc66cc;color:#800000;">360</span> * <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">min</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">max</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, value<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; &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;">public</span> <span style="color: #000000; font-weight: bold;">function</span> disposeDragabble<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-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;">if</span> <span style="color: #66cc66;">&#40;</span>!_handler<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</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; removeHandlerListeners<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: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>_handler.<span style="color: #006600;">hasOwnProperty</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;dispose&#8221;</span><span style="color: #66cc66;">&#41;</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; _handler<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&#8216;dispose&#8217;</span><span style="color: #66cc66;">&#93;</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: #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; removeChild<span style="color: #66cc66;">&#40;</span>_handler<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; _handler = <span style="color: #000000; font-weight: bold;">null</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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> dispose<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; disposeDragabble<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; &nbsp; _sector = <span style="color: #000000; font-weight: bold;">null</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;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> stylePathColor<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:uint <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;">return</span> _stylePathColor;</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;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> stylePathColor<span style="color: #66cc66;">&#40;</span>value:uint<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; _stylePathColor = value;</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; draw<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;</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> stylePathAlpha<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</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; <span style="color: #b1b100;">return</span> _stylePathAlpha;</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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> stylePathAlpha<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Number</span><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; _stylePathAlpha = value;</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; draw<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; <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;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> stylePathThickness<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</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;">return</span> _stylePathThickness;</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;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> stylePathThickness<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Number</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; &nbsp; &nbsp; &nbsp; &nbsp; _stylePathThickness = value;</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; draw<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; <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>
<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;">class</span> Sector <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; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> degree:<span style="color: #0066CC;">Number</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;">public</span> <span style="color: #000000; font-weight: bold;">var</span> radiusX:<span style="color: #0066CC;">Number</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;">var</span> radiusY:<span style="color: #0066CC;">Number</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: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Sector<span style="color: #66cc66;">&#40;</span>degree:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>, radiusX:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">10</span>, radiusY:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">10</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; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">degree</span> = degree;</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;">this</span>.<span style="color: #006600;">radiusX</span> = radiusX;</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;">this</span>.<span style="color: #006600;">radiusY</span> = radiusY;</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;</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;">function</span> <span style="color: #0066CC;">get</span> x<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</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; <span style="color: #b1b100;">return</span> radiusX * <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span>degree * <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> / <span style="color: #cc66cc;color:#800000;">180</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; <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; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> y<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</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; <span style="color: #b1b100;">return</span> radiusY * <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span>degree * <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> / <span style="color: #cc66cc;color:#800000;">180</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; <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; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</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; <span style="color: #b1b100;">return</span> <span style="color: #ff0000;">&#8220;[Sector] degree: &#8220;</span> + degree + <span style="color: #ff0000;">&#8220;, radiusX: &#8220;</span> + radiusX + <span style="color: #ff0000;">&#8220;, radiusY: &#8220;</span> + radiusY + <span style="color: #ff0000;">&#8220;, x: &#8220;</span> + x + <span style="color: #ff0000;">&#8220;, y: &#8220;</span> + y;</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>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2011/04/08/knob-as3-drag-on-circle-or-ellipse/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SomaCore wiki and framework flow</title>
		<link>http://www.soundstep.com/blog/2011/03/14/594/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=594</link>
		<comments>http://www.soundstep.com/blog/2011/03/14/594/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 09:00:43 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaCore]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=594</guid>
		<description><![CDATA[I&#8217;ve added some more information on the SomaCore wiki. You can find some code and explanation how to use, create and remove Wires within the framework, using injection or not. I also explained how to monitor and control the application flow with methods you are used to, such as dispatchEvent, addEventListener, preventDefault and so on. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added some more information on the <a href="https://github.com/soundstep/somacore_framework/wiki" target="_blank">SomaCore wiki</a>.</p>
<p>You can find some code and explanation how to use, create and remove Wires within the framework, using injection or not. I also explained how to monitor and control the application flow with methods you are used to, such as <code>dispatchEvent</code>, <code>addEventListener</code>, <code>preventDefault</code> and so on.</p>
<p>You can also find explanation to handle the views in the framework.</p>
<p>Last addition is a diagram showing the commands flow from other framework elements, I&#8217;ve added it to the previous SomaCore diagram.</p>
<p><a href="http://www.soundstep.com/blog/source/somacore/diagram/SomaDiagram.pdf" target="_blank"><img src="/blog/source/somacore/diagram/preview.jpg" alt="SomaCore Diagram" /></a></p>
<p><br clear="all"/></p>
<p>Next step in the wiki are about commands and 2 others diagrams related to them.</p>
<p>Hope that will help to get you started.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2011/03/14/594/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SomaCore tutorial framework instance</title>
		<link>http://www.soundstep.com/blog/2011/02/09/somacore-tutorial-framework-instance/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somacore-tutorial-framework-instance</link>
		<comments>http://www.soundstep.com/blog/2011/02/09/somacore-tutorial-framework-instance/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 09:00:57 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaCore]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=583</guid>
		<description><![CDATA[I&#8217;ll be writing in the next days a series of wiki, manual, best practices with tons of code example. It should help you to get started. I will be explaining in-depth how SomaCore works and what you can do with it. The first one is about the Framework Instance. The different ways to create a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be writing in the next days a series of <a href="https://github.com/soundstep/somacore_framework/wiki">wiki, manual, best practices</a> with tons of code example. It should help you to get started. I will be explaining in-depth how SomaCore works and what you can do with it.</p>
<p>The first one is about the <a href="https://github.com/soundstep/somacore_framework/wiki/2.-Framework-instance" target="_blank">Framework Instance</a>. The different ways to create a SomaCore application, what is required, how to enable dependency injection and how to access to this instance.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2011/02/09/somacore-tutorial-framework-instance/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SomaCore AS3 MVC Framework v2 release</title>
		<link>http://www.soundstep.com/blog/2011/02/07/somacore-as3-mvc-framework-v2-release/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somacore-as3-mvc-framework-v2-release</link>
		<comments>http://www.soundstep.com/blog/2011/02/07/somacore-as3-mvc-framework-v2-release/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 10:00:56 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaCore]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=558</guid>
		<description><![CDATA[SomaCore is a lightweight AS3 MVC event-based framework that provides a very flexible structure for your Flash, Flex and AIR projects. The main addition in this version 2 is Dependency Injection, but it is up to you how you want to use SomaCore because injection is optional. Information SomaCore Main Page (tutorials, demos, source) Repository [...]]]></description>
			<content:encoded><![CDATA[<p>SomaCore is a lightweight AS3 MVC event-based framework that provides a very flexible structure for your Flash, Flex and AIR projects.</p>
<p>The main addition in this version 2 is Dependency Injection, but it is up to you how you want to use SomaCore because injection is optional.</p>
<h2>Information</h2>
<p><a href="http://www.soundstep.com/blog/downloads/somacore/" target="_blank">SomaCore Main Page (tutorials, demos, source)</a><br />
<a href="http://github.com/soundstep/somacore_framework" target="_blank">Repository SomaCore (github)</a><br />
<a href="http://github.com/soundstep/somacore_demos" target="_blank">Repository Demos (github)</a><br />
<a href="http://github.com/soundstep/somacore_plugins" target="_blank">Repository Plugins (github)</a><br />
<a href="http://www.soundstep.com/blog/source/somacore/docs" target="_blank">Documentation</a></p>
<h2>Don&#8217;t want to read, just show me some code!</h2>
<p><a href="http://www.soundstep.com/blog/source/somacore/demos/SomaCoreHelloWorld-Injection/srcview/" target="_blank">SomaCore Hello World</a><br />
<a href="http://www.soundstep.com/blog/source/somacore/demos/SomaCoreCafeTownSend-Injection/srcview/" target="_blank">SomaCore CafeTownSend (Flex)</a><br />
<a href="http://www.soundstep.com/blog/source/somacore/demos/SomaCoreTwitterSearch-Injection/srcview/" target="_blank">Twitter Search demo (pure as3)</a></p>
<h2>SomaCore is both a registry and dependency injection framework</h2>
<p>As a base, SomaCore is a registry framework, much like PureMVC. The framework makes you able to add and remove elements to the framework instance to be able to access them from anywhere (such as <code>addView</code>, <code>getView</code>, <code>addWire</code>, <code>getWire</code>, <code>addModel</code>, <code>getModel</code>, <code>addCommand</code>, and so on).</p>
<h2>Enable injection</h2>
<p>You are now able to use dependency injection. It can be enabled by sending an <code>ISomaInjector</code> class to the constructor of the <code>Soma</code> class:</p>
<div class="igBar"><span id="lactionscript-117"><a href="#" onclick="javascript:showPlainTxt('actionscript-117'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-117">
<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> SomaApplication <span style="color: #0066CC;">extends</span> Soma <span style="color: #0066CC;">implements</span> ISoma <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;">public</span> <span style="color: #000000; font-weight: bold;">function</span> SomaApplication<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>:<span style="color: #0066CC;">Stage</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; <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>, SomaInjector<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; <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>The injector is accessible from framework instances, wires and commands using the property <code>injector</code>.</p>
<p>Here is a quick example:</p>
<div class="igBar"><span id="lactionscript-118"><a href="#" onclick="javascript:showPlainTxt('actionscript-118'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-118">
<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;">injector.<span style="color: #006600;">mapToInstance</span><span style="color: #66cc66;">&#40;</span>MyModel, <span style="color: #000000; font-weight: bold;">new</span> MyModel<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;">injector.<span style="color: #006600;">mapSingleton</span><span style="color: #66cc66;">&#40;</span>MyWire<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;">injector.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span>MyWire<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lactionscript-119"><a href="#" onclick="javascript:showPlainTxt('actionscript-119'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-119">
<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&nbsp; <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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">wire</span>.<span style="color: #006600;">Wire</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IWire</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;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyWire <span style="color: #0066CC;">extends</span> Wire <span style="color: #0066CC;">implements</span> IWire <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: #66cc66;">&#91;</span>Inject<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; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> model:MyModel;</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; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> initialize<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// called when the wire has been registered to the framework</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;">trace</span><span style="color: #66cc66;">&#40;</span>model, <span style="color: #ff0000;">&#8221; is injected&#8221;</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; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> dispose<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// called when the wire has been removed from the framework</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>
<h2>Inspirations</h2>
<p>Before going further, I have to give some credits.</p>
<p>When I first tried <a href="http://www.robotlegs.org/" target="_blank">Robotlegs</a>, one part strikes me as it was solving a problem I had for a while: The mediator system: being able to build your application and add mediators regardless of any kind of structure and very easily. This workflow was so nice that it made me rethink a lot of things.</p>
<p>SomaCore has some capabilities that made me build the framework and I wasn&#8217;t ready to give them up. But I felt that this mediator workflow in SomaCore would just be amazing and a great addition.</p>
<p>I built these tools and frameworks to make my developer life easier, I then share them to other developers. If my work makes them enjoy their coding, that&#8217;s good enough for me.</p>
<p>So before asking myself too many questions, I reproduced the mediator system in SomaCore. It is now very similar to Robotlegs but <b>it can also be used without enabling injection</b>. That is the first part of the credits: a big one to Robotlegs that has been an amazing inspiration to SomaCore, as big as PureMVC has been for the version 1.</p>
<p>The second credit would go to the library <a href="https://github.com/tschneidereit/SwiftSuspenders" target="_blank">SwiftSuspenders</a>, the same one that Robolegs is using to handle its dependency injection. It is very lightweight and has good performance.</p>
<h2>Mediators</h2>
<p>Here is how it works, you can map a view to another class (the mediator), and every time this &#8220;mapped view&#8221; will be added to a display list, the mediator class will be instantiated with a reference to this view. The mediator class will also be destroyed when the view is removed from the display list. Everything is automatic and handled by the framework.</p>
<p>In SomaCore the Mediator class is extending the Wire class which gives access to everything in the framework.</p>
<p>Mapping a view (example in a wire):</p>
<div class="igBar"><span id="lactionscript-120"><a href="#" onclick="javascript:showPlainTxt('actionscript-120'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-120">
<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;">mediator.<span style="color: #006600;">mapView</span><span style="color: #66cc66;">&#40;</span>MySprite, MySpriteMediator<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The mediator get instantiated when the view is added to the display list</p>
<div class="igBar"><span id="lactionscript-121"><a href="#" onclick="javascript:showPlainTxt('actionscript-121'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-121">
<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;">addChild<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> MySprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Mediator example:</p>
<div class="igBar"><span id="lactionscript-122"><a href="#" onclick="javascript:showPlainTxt('actionscript-122'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-122">
<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 <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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IMediator</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">mediator</span>.<span style="color: #006600;">Mediator</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;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MySpriteMediator <span style="color: #0066CC;">extends</span> Mediator <span style="color: #0066CC;">implements</span> IMediator <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; </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;">&#91;</span>Inject<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; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> view:MySprite;</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; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> initialize<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// called when the mediator has been created and registered to the framework</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;">trace</span><span style="color: #66cc66;">&#40;</span>view == viewComponent<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; &nbsp; &nbsp; &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; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> dispose<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// called when the mediator has been destroyed by the framework</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; &nbsp; &nbsp; &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;">&#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>
<h2>From version 1 to version 2</h2>
<p>Only minor changes:</p>
<p>1. <code>initialize</code> and <code>dispose</code> methods in wires and models are now public.</p>
<div class="igBar"><span id="lactionscript-123"><a href="#" onclick="javascript:showPlainTxt('actionscript-123'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-123">
<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&nbsp; <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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IModel</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">model</span>.<span style="color: #006600;">Model</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;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ModelExample <span style="color: #0066CC;">extends</span> Model <span style="color: #0066CC;">implements</span> IModel <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; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> initialize<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// called when the model has been registered to the framework</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; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> dispose<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// called when the model has been removed from the framework</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; &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>2. the framework instance property has changed from <code>soma</code> to <code>instance</code>.</p>
<div class="igBar"><span id="lactionscript-124"><a href="#" onclick="javascript:showPlainTxt('actionscript-124'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-124">
<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&nbsp; <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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">wire</span>.<span style="color: #006600;">Wire</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IWire</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;">public</span> <span style="color: #000000; font-weight: bold;">class</span> WireExample <span style="color: #0066CC;">extends</span> Wire <span style="color: #0066CC;">implements</span> IWire <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; override protected <span style="color: #000000; font-weight: bold;">function</span> initialize<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// called when the wire has been registered to the framework</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;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;my framework instance:&#8221;</span>, instance<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; &nbsp; &nbsp; &nbsp; override protected <span style="color: #000000; font-weight: bold;">function</span> dispose<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// called when the wire has been removed from the framework</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; <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>3. a public <code>setup</code> method is available in your framework instance.</p>
<div class="igBar"><span id="lactionscript-125"><a href="#" onclick="javascript:showPlainTxt('actionscript-125'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-125">
<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> app:ISoma = <span style="color: #000000; font-weight: bold;">new</span> Soma<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;">app.<span style="color: #006600;">setup</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>, SomaInjector<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>4. an <code>initialize</code> and <code>start</code> protected methods have been added in the Soma instance.</p>
<div class="igBar"><span id="lactionscript-126"><a href="#" onclick="javascript:showPlainTxt('actionscript-126'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-126">
<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&nbsp; <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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">Soma</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">ISoma</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">di</span>.<span style="color: #006600;">SomaInjector</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;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">Stage</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;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SomaApplication <span style="color: #0066CC;">extends</span> Soma <span style="color: #0066CC;">implements</span> ISoma <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; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> SomaApplication<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>:<span style="color: #0066CC;">Stage</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; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>, SomaInjector<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; override protected <span style="color: #000000; font-weight: bold;">function</span> initialize<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; &nbsp; &nbsp; &nbsp; &nbsp; &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: #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; override protected <span style="color: #000000; font-weight: bold;">function</span> registerCommands<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &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; &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; override protected <span style="color: #000000; font-weight: bold;">function</span> registerModels<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; &nbsp; &nbsp; &nbsp; &nbsp; &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: #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; override protected <span style="color: #000000; font-weight: bold;">function</span> registerViews<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &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; &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; override protected <span style="color: #000000; font-weight: bold;">function</span> registerWires<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; &nbsp; &nbsp; &nbsp; &nbsp; &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: #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; override protected <span style="color: #000000; font-weight: bold;">function</span> registerPlugins<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &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; &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; override protected <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">start</span><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; &nbsp; &nbsp; &nbsp; &nbsp; &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: #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; <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>
<h2>SomaCore features</h2>
<p>Here are some features that might makes you enjoy the framework.</p>
<h3>Stage as single event dispatcher</h3>
<p>SomaCore is using a single event dispatcher: the stage, and a system of event interception to handles its commands system. As the commands in SomaCore are normal built-in events with the property <code>bubbles</code> set to true, this makes you able to dispatch commands straight from a view removing potential layers (like mediators) to handles communications from the views to the framework.</p>
<p>This also makes you able to communicate between different modules (or swf files) as they all share the same stage.</p>
<h3>Seamless commands and events integration</h3>
<p>The commands in SomaCore are normal built-in events and the framework has a seamless integration with the flash event system. Seamless meaning that the built-in syntax is in use: <code>dispatchEvent</code>, <code>addEventListener</code>, and so on.</p>
<p>Register a command:</p>
<div class="igBar"><span id="lactionscript-127"><a href="#" onclick="javascript:showPlainTxt('actionscript-127'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-127">
<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;">addCommand<span style="color: #66cc66;">&#40;</span>MyEvent.<span style="color: #006600;">DO_SOMETHING</span>, MyCommand<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Dispatch a command from a framework elements (wires, commands, models, etc) <strong>or views</strong>:</p>
<div class="igBar"><span id="lactionscript-128"><a href="#" onclick="javascript:showPlainTxt('actionscript-128'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-128">
<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;">dispatchEvent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> MyEvent<span style="color: #66cc66;">&#40;</span>MyEvent.<span style="color: #006600;">DO_SOMETHING</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Monitoring commands from wires, mediators, or models:</p>
<div class="igBar"><span id="lactionscript-129"><a href="#" onclick="javascript:showPlainTxt('actionscript-129'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-129">
<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;">addEventListener<span style="color: #66cc66;">&#40;</span>MyEvent.<span style="color: #006600;">DO_SOMETHING</span>, myEventHandler<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>Commands monitoring</h3>
<p>This capability is probably one of the most important to me. SomaCore makes you able to listen to commands from any wires and mediators, but also makes you able to stop the execution of any command (if the event is set as cancelable) using event.preventDefault().</p>
<div class="igBar"><span id="lactionscript-130"><a href="#" onclick="javascript:showPlainTxt('actionscript-130'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-130">
<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&nbsp; <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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">wire</span>.<span style="color: #006600;">Wire</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IWire</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;">public</span> <span style="color: #000000; font-weight: bold;">class</span> WireExample <span style="color: #0066CC;">extends</span> Wire <span style="color: #0066CC;">implements</span> IWire <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; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> initialize<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// called when the wire has been registered to the framework</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; addEventListener<span style="color: #66cc66;">&#40;</span>MyEvent.<span style="color: #006600;">DO_SOMETHING</span>, myEventHandler<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; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> myEventHandler<span style="color: #66cc66;">&#40;</span>event:MyEvent<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; <span style="color: #808080; font-style: italic;">// the command MyEvent.DO_SOMETHING has been dispatched</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: #808080; font-style: italic;">// I can monitor it here (possible from any wires and mediators)</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: #808080; font-style: italic;">// for some reasons, I decide to stop the execution of this command:</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; event.<span style="color: #006600;">preventDefault</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; <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; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> dispose<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// called when the wire has been removed from the framework</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; removeEventListener<span style="color: #66cc66;">&#40;</span>MyEvent.<span style="color: #006600;">DO_SOMETHING</span>, myEventHandler<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; &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>
<h3>Easy way to map a mediator to a view</h3>
<p>This is the workflow I reproduced from Robotlegs. It allows you to build you application, let&#8217;s say&#8230; complicated layouts, structure, tons of views, and so on. But at any point, if the framework needs to talk to a specific view, you can easily map a mediator to this view:</p>
<div class="igBar"><span id="lactionscript-131"><a href="#" onclick="javascript:showPlainTxt('actionscript-131'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-131">
<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;">mediator.<span style="color: #006600;">mapView</span><span style="color: #66cc66;">&#40;</span>MyView, MyViewMediator<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>For the other way around: a view needs to talk to the framework, mediators are not necessarily needed as you can dispatch commands straight from views in SomaCore. The commands are just normal events. The only requirement is that the view needs to be on the stage (added to a display list, after a <code>ADDED_TO_STAGE</code> event) in order for the stage to get the command.</p>
<h3>Flexibility (injection, not injection, or both)</h3>
<p>As the injection is optional in the framework, you are free to code the way you like, in the registry way like PureMVC way or in the injection way like Robotlegs, or even using both ways in the same time.</p>
<p>For some reasons, you might want to avoid injection, describeType, getElementByName, not comfortable yet with the concept, portability, optimal performance for games, etc. This is still possible with SomaCore.</p>
<p>Here are the built-in registry methods without injection:</p>
<div class="igBar"><span id="lactionscript-132"><a href="#" onclick="javascript:showPlainTxt('actionscript-132'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-132">
<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;">addWire<span style="color: #66cc66;">&#40;</span>MyWire.<span style="color: #0066CC;">NAME</span>, <span style="color: #000000; font-weight: bold;">new</span> MyWire<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;">getWire<span style="color: #66cc66;">&#40;</span>MyWire.<span style="color: #0066CC;">NAME</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;">addModel<span style="color: #66cc66;">&#40;</span>MyModel.<span style="color: #0066CC;">NAME</span>, <span style="color: #000000; font-weight: bold;">new</span> MyModel<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;">getModel<span style="color: #66cc66;">&#40;</span>MyModel.<span style="color: #0066CC;">NAME</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;">addView<span style="color: #66cc66;">&#40;</span>MY_SPRITE_NAME, <span style="color: #000000; font-weight: bold;">new</span> Sprite<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;">getView<span style="color: #66cc66;">&#40;</span>MY_SPRITE_NAME<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>With injection, you might do something like:</p>
<div class="igBar"><span id="lactionscript-133"><a href="#" onclick="javascript:showPlainTxt('actionscript-133'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-133">
<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;">injector.<span style="color: #006600;">mapSingleton</span><span style="color: #66cc66;">&#40;</span>MyModel<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;">injector.<span style="color: #006600;">createInstance</span><span style="color: #66cc66;">&#40;</span>MyWire<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lactionscript-134"><a href="#" onclick="javascript:showPlainTxt('actionscript-134'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-134">
<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: #808080; font-style: italic;">// MyWire injectee class</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>Inject<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> model:MyModel; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You can also use both:</p>
<div class="igBar"><span id="lactionscript-135"><a href="#" onclick="javascript:showPlainTxt('actionscript-135'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-135">
<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> wire:MyWire = <span style="color: #000000; font-weight: bold;">new</span> MyWire<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;">injector.<span style="color: #006600;">mapToInstance</span><span style="color: #66cc66;">&#40;</span>MyWire, wire<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;">addWire<span style="color: #66cc66;">&#40;</span>MyWire.<span style="color: #0066CC;">NAME</span>, wire<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Making you able to get the wire back this 2 ways:</p>
<div class="igBar"><span id="lactionscript-136"><a href="#" onclick="javascript:showPlainTxt('actionscript-136'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-136">
<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>Inject<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;">var</span> wire:MyWire; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lactionscript-137"><a href="#" onclick="javascript:showPlainTxt('actionscript-137'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-137">
<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;">getWire<span style="color: #66cc66;">&#40;</span>MyWire.<span style="color: #0066CC;">NAME</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>Plugins system</h3>
<p>An easy way to add plugins to the framework, the <a href="http://www.soundstep.com/blog/2009/11/27/somacore-debugger-update/" target="_blank">SomaDebugger</a> is the first one but I have plans to write others.</p>
<h3>Debugger</h3>
<p>The SomaDebugger especially built to work with SomaCore (even if it can be used without).</p>
<div class="igBar"><span id="lactionscript-138"><a href="#" onclick="javascript:showPlainTxt('actionscript-138'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-138">
<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;">protected <span style="color: #000000; font-weight: bold;">function</span> registerPlugins<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; createPlugin<span style="color: #66cc66;">&#40;</span>SomaDebugger, <span style="color: #000000; font-weight: bold;">new</span> SomaDebuggerVO<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, SomaDebugger.<span style="color: #006600;">NAME_DEFAULT</span>, getCommands<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #000000; font-weight: bold;">false</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;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2>Lightweight</h2>
<p>SomaCore is lightweight, here are the size compiled of the framework:</p>
<p>9.46 KB (9 693 bytes) &#8211; injector not enabled<br />
14.83 KB (15 185 bytes) &#8211; injector enabled</p>
<h2>Next steps</h2>
<p>I&#8217;ll make new documents for code examples, best practices, and so on to help you get started.<br />
Maybe a javascript version as a developer has made an amazing port of SomaCore.</p>
<p>If you&#8217;re looking for more information about the dependency injection part before I write documents, check the <a href="https://github.com/tschneidereit/SwiftSuspenders/blob/master/README.textile" target="_blank">README</a> file from the injection library: <a href="https://github.com/tschneidereit/SwiftSuspenders/blob/master/README.textile" target="_blank">SwiftSuspenders</a>.</p>
<p>Try SomaCore out, it is really easy to get started with. You&#8217;ll feel at home very quickly with its flexibility and well integrated command system with built-in events.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2011/02/07/somacore-as3-mvc-framework-v2-release/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SomaCore Twitter Search demo</title>
		<link>http://www.soundstep.com/blog/2010/10/26/somacore-twitter-search-demo/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somacore-twitter-search-demo</link>
		<comments>http://www.soundstep.com/blog/2010/10/26/somacore-twitter-search-demo/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 00:54:55 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[SomaCore]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=546</guid>
		<description><![CDATA[Another SomaCore demo is available on Githug or on the SomaCore page. This demo is relatively simple. Keywords are sent to the Twitter API using a command that is dispatched straight from the view as it is something possible with SomaCore. A command is nothing more than a flash built-in event. The views are able [...]]]></description>
			<content:encoded><![CDATA[<p>Another SomaCore demo is available on <a href="http://github.com/soundstep/somacore_demos/tree/master/SomaCoreTwitterSearch/" target="_blank">Githug</a> or on the <a href="http://www.soundstep.com/blog/downloads/somacore/" target="_blank">SomaCore</a> page.</p>
<p>This demo is relatively simple. Keywords are sent to the Twitter API using a command that is dispatched straight from the view as it is something possible with SomaCore. A command is nothing more than a flash built-in event. The views are able to dispatch commands without accessing to a mediator first and stay completely free of framework code.</p>
<p>A TwitterService dispatch a search result event after getting the data. The wire responsible of the main view is listening to the search result event and update the view. </p>
<p>The SearchWire class demonstrates that both commands and events can be listened to from any wire.</p>
<p>The control of the flow of the application is also very flexible, the SearchWire class could have stopped the search command for any reason using <code>event.preventDefault()</code> as the class is listening to the command (if the event is sent with a cancelable property set to true).</p>
<p>Any commands in SomaCore can be listened to in any wires, and can also be &#8220;default prevented&#8221;.</p>
<p><strong>Twitter Search</strong></p>
<p><a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaCoreTwitterSearch/" target="_blank"><img class=" alignnone" title="SomaCore Twitter Search" src="/blog/source/somacore/demo/Flash/SomaCoreTwitterSearch/preview.jpg" alt="SomaCore Twitter Search" width="300" height="186" /></a><br />
<br clear="all"/></p>
<p><a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaCoreTwitterSearch/" target="_blank">View Demo</a><br />
<a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaCoreTwitterSearch/srcview" target="_blank">View Source</a><br />
<a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaCoreTwitterSearch/srcview/SomaCoreTwitterSearch.zip" target="_blank">Download Source</a><br />
<br clear="all"/></p>
<p><i>Credits: Inspired by a great Flex Robotlegs demo by John Lindquist, using the AS3 API library Tweetr.</i></p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2010/10/26/somacore-twitter-search-demo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SomaCore Hello World</title>
		<link>http://www.soundstep.com/blog/2010/10/24/somacore-hello-world/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somacore-hello-world</link>
		<comments>http://www.soundstep.com/blog/2010/10/24/somacore-hello-world/#comments</comments>
		<pubDate>Sun, 24 Oct 2010 17:33:32 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[SomaCore]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=542</guid>
		<description><![CDATA[I&#8217;ve added a very simple SomaCore Hello World demo. The application creates a wire, a view and a model. The view dispatch a command to request a message, the command ask the data to the model, the model gets the data and dispatch an event to notify the framework, the wire catch the event and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added a very simple <a href="http://www.soundstep.com/blog/downloads/somacore/">SomaCore</a> Hello World demo.</p>
<p>The application creates a wire, a view and a model. The view dispatch a command to request a message, the command ask the data to the model, the model gets the data and dispatch an event to notify the framework, the wire catch the event and update the view with the message. </p>
<p>That&#8217;s all!</p>
<p>The demo is also available from the demo repository on Github:<br />
<a href="http://github.com/soundstep/somacore_demos" target="_blank">http://github.com/soundstep/somacore_demos</a></p>
<p><strong>Hello World</strong></p>
<p><a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaCoreHelloWorld/" target="_blank"><img class=" alignnone" title="SomaCore Hello World" src="/blog/source/somacore/demo/Flash/SomaCoreHelloWorld/preview.jpg" alt="SomaCore Hello World" width="300" height="186" /></a><br />
<br clear="all"/></p>
<p><a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaCoreHelloWorld/" target="_blank">View Demo</a><br />
<a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaCoreHelloWorld/srcview" target="_blank">View Source</a><br />
<a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaCoreHelloWorld/srcview/SomaCoreHelloWorld.zip" target="_blank">Download Source</a><br />
<br clear="all"/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2010/10/24/somacore-hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SomaCore AS3 MVC framework on Github</title>
		<link>http://www.soundstep.com/blog/2010/10/18/somacore-as3-mcv-framework-on-github/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somacore-as3-mcv-framework-on-github</link>
		<comments>http://www.soundstep.com/blog/2010/10/18/somacore-as3-mcv-framework-on-github/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 20:14:13 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[SomaCore]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=532</guid>
		<description><![CDATA[I&#8217;ve decided to put my framework SomaCore on Github. SomaCore is a lightweight event-based MVC framework written in AS3 that provides a structure, models, views management and commands. Somacore can be used for Flash, Flex and AIR projects. SomaCore does not use any external library and does not use dependency injection. SomaCore is completely event-based [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided to put my framework SomaCore on Github.</p>
<p>SomaCore is a lightweight event-based MVC framework written in AS3 that provides a structure, models, views management and commands. Somacore can be used for Flash, Flex and AIR projects.</p>
<p>SomaCore does not use any external library and does not use dependency injection.</p>
<p>SomaCore is completely event-based and use a concept of wires to code in an efficient decoupled way.</p>
<p>Framework<br />
<a href="http://github.com/soundstep/somacore_framework" target="_blank">http://github.com/soundstep/somacore_framework</a><br />
Demos<br />
<a href="http://github.com/soundstep/somacore_demos" target="_blank">http://github.com/soundstep/somacore_demos</a><br />
Plugins<br />
<a href="http://github.com/soundstep/somacore_plugins" target="_blank">http://github.com/soundstep/somacore_plugins</a><br />
Blog Page (with demos)<br />
<a href="http://www.soundstep.com/blog/downloads/somacore/" target="_blank">http://www.soundstep.com/blog/downloads/somacore/</a><br />
Video tutorial<br />
<a href="http://www.soundstep.com/blog/source/somacore/tutorials/getting-started/" target="_blank">http://www.soundstep.com/blog/source/somacore/tutorials/getting-started/</a><br />
Documentation<br />
<a href="http://www.soundstep.com/blog/source/somacore/docs/" target="_blank">http://www.soundstep.com/blog/source/somacore/docs/</a></p>
<p>A very handy capability of the framework among others is the way you can monitor the flow of your application. SomaCore is using the the flash model to monitor commands and even intercept them in a way so that any actionscript developer will feel at home. Example in a wire class to listen and intercept a command:</p>
<div class="igBar"><span id="lactionscript-140"><a href="#" onclick="javascript:showPlainTxt('actionscript-140'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-140">
<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: #808080; font-style: italic;">// listen to a command</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">addEventListener<span style="color: #66cc66;">&#40;</span>MyEvent.<span style="color: #006600;">DO_SOMETHING</span>, commandHandler<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: #808080; font-style: italic;">// remove a listener</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">removeEventListener<span style="color: #66cc66;">&#40;</span>MyEvent.<span style="color: #006600;">DO_SOMETHING</span>, commandHandler<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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> commandHandler<span style="color: #66cc66;">&#40;</span>event:MyEvent<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; <span style="color: #808080; font-style: italic;">// intercept (if the event is cancelable)</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;">e</span>.<span style="color: #006600;">preventDefault</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;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaColor/srcview/" target="_blank">Click here to see one of the demo code to get started.</a></p>
<p><strong>Some other things to know about the framework</strong></p>
<ul>
<li>Commands are normal built-in Flash events with the bubbles property set to true.</li>
<li>Commands can be used in the views as they are not really framework code.</li>
<li>Parallel and sequence commands are built-in.</li>
<li>Wires are the glue of the frameworks elements (models, commands, views, wires) and can be used the way you wish, as proxy/mediators or managers.</li>
<li>Wires can manage one class or multiple classes.</li>
<li>Wires and commands access to all the framework elements (stage, framework instance, wires, models, views and commands).</li>
<li>Plugins can be created for the framework (such as the SomaDebugger plugin).</li>
<li>Powerful flow control using the built-in flash event model.</li>
</ul>
<p>Here is how to get started with github:<br />
<a href="http://help.github.com/" target="_blank">http://help.github.com/</a></p>
<p>﻿</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2010/10/18/somacore-as3-mcv-framework-on-github/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SomaUI update for Flex SDK 4</title>
		<link>http://www.soundstep.com/blog/2010/09/29/somaui-update-for-flex-sdk-4/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somaui-update-for-flex-sdk-4</link>
		<comments>http://www.soundstep.com/blog/2010/09/29/somaui-update-for-flex-sdk-4/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 09:10:10 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=526</guid>
		<description><![CDATA[I&#8217;ve updated SomaUI, the AIR tool that generates the draft of a Flash website build with SomaMVC. Sorry for the late update but you can now use the generator with Flex 4 and target the Flash Player 10.1. To avoid a confusion, SomaUI is an AIR tool that generates AS3 sources build with the AS3 [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated <a href="http://www.soundstep.com/blog/downloads/somaui/" target="_blank">SomaUI</a>, the AIR tool that generates the draft of a Flash website build with SomaMVC. Sorry for the late update but you can now use the generator with Flex 4 and target the Flash Player 10.1.</p>
<p>To avoid a confusion, <a href="http://www.soundstep.com/blog/downloads/somaui/" target="_blank">SomaUI</a> is an AIR tool that generates AS3 sources build with the AS3 MVC Framework SomaMVC.</p>
<p>SomaMVC has nothing to do with <a href="http://www.soundstep.com/blog/downloads/somacore/" target="_blank">SomaCore</a>, they are 2 different frameworks and don&#8217;t share the same goal.</p>
<p>While SomaMVC (which would entered in the same category as the Gaia Framework) is meant to be generated and rely on an XML File to describe and build its content, <a href="http://www.soundstep.com/blog/downloads/somacore/" target="_blank">SomaCore</a> is a lightweight MVC framework that doesn&#8217;t build anything for you and would entered in the same category as PureMVC.</p>
<p>I intend at some point to rebuild SomaMVC using SomaCore and unify these 2 projects.</p>
<p>You can find the new SomaUI version on <a href="http://www.soundstep.com/blog/downloads/somaui/" target="_blank">this page</a> or on the <a href="http://code.google.com/p/somamvc/" target="_blank">Google code project</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2010/09/29/somaui-update-for-flex-sdk-4/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>SomaCore AS3 MVC Framework video tutorial</title>
		<link>http://www.soundstep.com/blog/2010/08/18/somacore-as3-mvc-framework-video-tutorials/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somacore-as3-mvc-framework-video-tutorials</link>
		<comments>http://www.soundstep.com/blog/2010/08/18/somacore-as3-mvc-framework-video-tutorials/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 14:32:44 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[SomaCore]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=513</guid>
		<description><![CDATA[I&#8217;ve just uploaded a new video tutorial (48 min) for my lightweight AS3 MVC Framework SomaCore. You can now get started with it. I explain how to create the framework instance, how to create a wire, create views, create commands and how to intercept them. I hope you like it!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just uploaded a new video tutorial (48 min) for my <a href="http://www.soundstep.com/blog/downloads/somacore/">lightweight AS3 MVC Framework SomaCore</a>.</p>
<p>You can now get started with it. I explain how to create the framework instance, how to create a wire, create views, create commands and how to intercept them.</p>
<p><a href="http://www.soundstep.com/blog/source/somacore/tutorials/getting-started/" target="_blank"><img title="SomaCore Getting Started Video Tutorial" src="/blog/source/somacore/tutorials/getting-started/preview.jpg" alt="SomaCore Getting Started Video Tutorial" align="top" /></a><br />
<br clear="all"/></p>
<p>I hope you like it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2010/08/18/somacore-as3-mvc-framework-video-tutorials/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Bringing life to an image</title>
		<link>http://www.soundstep.com/blog/2010/08/16/bringling-life-to-an-image/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=bringling-life-to-an-image</link>
		<comments>http://www.soundstep.com/blog/2010/08/16/bringling-life-to-an-image/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 15:20:45 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=503</guid>
		<description><![CDATA[Here is how to bring life to an image using the filter DisplacementMapFilter. Click here to see the demo. I got the idea from a video made by Chad Perkins (thanks Chad, you&#8217;re giving me a lot of inspiration!) where he is showing this effect in After Effects. My Flash nature pushed me to reproduced [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how to bring life to an image using the filter DisplacementMapFilter.</p>
<p><a href="http://www.soundstep.com/blog/experiments/displacement/main.swf" class="lightwindow" params="lightwindow_width=500,lightwindow_height=419" title="Bringing life to an image">Click here to see the demo.</a></p>
<p>I got the idea from a video made by <a href="http://twitter.com/chad_perkins" target="_blank">Chad Perkins</a> (thanks Chad, you&#8217;re giving me a lot of inspiration!) where he is showing this effect in After Effects. My Flash nature pushed me to reproduced it with AS3. The result is great even if the After Effects version is slightly better, maybe the Flash version can be tweaked a bit more.</p>
<p>Here is how it works. I used this wonderful picture from my friend <a href="http://www.flickr.com/photos/lazy_lazy_dog/" target="_blank">Ziemowit Maj</a> <img src='http://www.soundstep.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><img src="http://www.soundstep.com/blog/experiments/displacement/urs1.jpg" alt=""  target="_blank"/></p>
<p>You also need a second picture that will describe the map of the filter using luminance. The foreground areas should be whiter than the background areas. I made this picture using Photoshop, the brush tools, and of course my proven drawing skills <img src='http://www.soundstep.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><img src="http://www.soundstep.com/blog/experiments/displacement/urs2.jpg" alt=""  target="_blank"/></p>
<p>I apply the DisplacementMapFilter on a BitmapData and I move the map position over time. It is not too complicated, but you can probably spend more time than me to draw the map correctly. Be careful not to make a distortion too big or it will look weird! Here is the code:</p>
<div class="igBar"><span id="lactionscript-142"><a href="#" onclick="javascript:showPlainTxt('actionscript-142'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-142">
<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 <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;">import</span> caurina.<span style="color: #006600;">transitions</span>.<span style="color: #006600;">Tweener</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: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Bitmap</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;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">BitmapData</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;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">BitmapDataChannel</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;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">PixelSnapping</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;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</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;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">StageAlign</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;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">StageScaleMode</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;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</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;">import</span> flash.<span style="color: #006600;">filters</span>.<span style="color: #006600;">DisplacementMapFilter</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;">import</span> flash.<span style="color: #006600;">filters</span>.<span style="color: #006600;">DisplacementMapFilterMode</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;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Point</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;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Rectangle</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; * &lt;b&gt;Author:&lt;/b&gt; Romuald Quantin &#8211; &lt;a href=&quot;http://www.soundstep.com/&quot; target=&quot;_blank&quot;&gt;www.soundstep.com&lt;/a&gt;&lt;br /&gt;</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; * &lt;b&gt;Company:&lt;/b&gt; Less Rain &#8211; &lt;a href=&quot;http://www.lessrain.com/&quot; target=&quot;_blank&quot;&gt;www.lessrain.com&lt;/a&gt;&lt;br /&gt;</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; * &lt;b&gt;Class version:&lt;/b&gt; 1.0&lt;br /&gt;</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; * &lt;b&gt;Actionscript version:&lt;/b&gt; 3.0&lt;br /&gt;</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; * &lt;b&gt;Copyright:&lt;/b&gt; </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; * &lt;br /&gt;</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; * &lt;b&gt;Date:&lt;/b&gt; Aug 16, 2010&lt;br /&gt;</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; * &lt;b&gt;Usage:&lt;/b&gt;</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; * @example</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; * &lt;listing version=&quot;3.0&quot;&gt;&lt;/listing&gt;</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; </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;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #0066CC;">extends</span> Sprite <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; </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;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">&#8220;../assets/photo.jpg&#8221;</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; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> Photo:<span style="color: #000000; font-weight: bold;">Class</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;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">&#8220;../assets/map.jpg&#8221;</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; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> Map:<span style="color: #000000; font-weight: bold;">Class</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; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _photo:Bitmap;</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;">var</span> _map:Bitmap;</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> _point:Point;</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;">var</span> _photoDisplaced:Bitmap;</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> _photoDisplacedData:BitmapData;</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;">var</span> _filter:DisplacementMapFilter;</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; </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;">var</span> _range:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">17</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: #808080; font-style: italic;">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</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, protected 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;">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</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; </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;</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;">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</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;">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</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; </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; &nbsp; &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: #808080; font-style: italic;">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</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;">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</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; </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;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initialize<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; <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: #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, PROTECTED</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; </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> initialize<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// stage</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;">stage</span>.<span style="color: #006600;">frameRate</span> = <span style="color: #cc66cc;color:#800000;">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;">stage</span>.<span style="color: #0066CC;">align</span> = StageAlign.<span style="color: #006600;">TOP_LEFT</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;">stage</span>.<span style="color: #0066CC;">scaleMode</span> = StageScaleMode.<span style="color: #006600;">NO_SCALE</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: #808080; font-style: italic;">// photo</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; _photo = <span style="color: #000000; font-weight: bold;">new</span> Photo<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; &nbsp; <span style="color: #808080; font-style: italic;">// photoDisplaced</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; _photoDisplacedData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span>_photo.<span style="color: #0066CC;">width</span>, _photo.<span style="color: #0066CC;">height</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; _photoDisplaced = <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span>_photoDisplacedData, PixelSnapping.<span style="color: #006600;">AUTO</span>, <span style="color: #000000; font-weight: bold;">true</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; _photoDisplaced.<span style="color: #006600;">scaleX</span> = <span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">05</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; _photoDisplaced.<span style="color: #006600;">scaleY</span> = <span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">05</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; _photoDisplaced.<span style="color: #006600;">x</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageWidth</span> &#8211; _photo.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#41;</span>&gt;&gt; <span style="color: #cc66cc;color:#800000;">1</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; _photoDisplaced.<span style="color: #006600;">y</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageHeight</span> &#8211; _photo.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>&gt;&gt; <span style="color: #cc66cc;color:#800000;">1</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; addChild<span style="color: #66cc66;">&#40;</span>_photoDisplaced<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: #808080; font-style: italic;">// map</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; _map = <span style="color: #000000; font-weight: bold;">new</span> Map<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; &nbsp; <span style="color: #808080; font-style: italic;">// point</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; _point = <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span>-<span style="color: #66cc66;">&#40;</span>_range<span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;color:#800000;">0</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; <span style="color: #808080; font-style: italic;">// enterframe</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; addEventListener<span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>, loop<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: #808080; font-style: italic;">// scroll motion</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; move<span style="color: #66cc66;">&#40;</span>_range<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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> move<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">target</span>:<span style="color: #0066CC;">Number</span><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; Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span>_point, <span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;color:#800000;">2</span>, x:<span style="color: #0066CC;">target</span>, transition:<span style="color: #ff0000;">&#8220;linear&#8221;</span>, onComplete:move, onCompleteParams:<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">target</span>*-<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#125;</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;</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> loop<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; _filter = <span style="color: #000000; font-weight: bold;">new</span> DisplacementMapFilter<span style="color: #66cc66;">&#40;</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; _map.<span style="color: #006600;">bitmapData</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; _point,</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; BitmapDataChannel.<span style="color: #006600;">RED</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; BitmapDataChannel.<span style="color: #006600;">RED</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; _point.<span style="color: #006600;">x</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; _point.<span style="color: #006600;">y</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; DisplacementMapFilterMode.<span style="color: #006600;">WRAP</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; _photoDisplacedData.<span style="color: #006600;">applyFilter</span><span style="color: #66cc66;">&#40;</span>_photo.<span style="color: #006600;">bitmapData</span>, _photoDisplacedData.<span style="color: #006600;">rect</span>, <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>,<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>, _filter<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; _photoDisplaced.<span style="color: #006600;">bitmapData</span>.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span>_photoDisplacedData, <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #000000; font-weight: bold;">new</span> Rectangle<span style="color: #66cc66;">&#40;</span> _point.<span style="color: #006600;">x</span>, _point.<span style="color: #006600;">y</span>, _photo.<span style="color: #0066CC;">width</span>, _photo.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #000000; font-weight: bold;">true</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; &nbsp; &nbsp; &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: #808080; font-style: italic;">// PUBLIC</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; &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; &nbsp; &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; </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>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2010/08/16/bringling-life-to-an-image/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Super White Effect</title>
		<link>http://www.soundstep.com/blog/2010/08/13/super-white-effect/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=super-white-effect</link>
		<comments>http://www.soundstep.com/blog/2010/08/13/super-white-effect/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 10:37:09 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=481</guid>
		<description><![CDATA[Let&#8217;s start by a Flash demo here and a bit of explanation below. While training myself to get better with After Effects, I stumble on a very interesting thing about color. I was watching a Chad Perkins video about HDRI and color depth, more precisely, 32 bits rendering. He showed what was happening with a [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s start by a <a href="http://www.soundstep.com/blog/experiments/superwhite/main.swf" class="lightwindow" params="lightwindow_width=670,lightwindow_height=750" title="Super White Effect">Flash demo here</a> and a bit of explanation below.</p>
<p>While training myself to get better with After Effects, I stumble on a very interesting thing about color.</p>
<p>I was watching a <a href="http://twitter.com/chad_perkins">Chad Perkins</a> video about <a href="http://en.wikipedia.org/wiki/High_dynamic_range_imaging">HDRI</a> and <a href="http://en.wikipedia.org/wiki/Color_depth">color depth</a>, more precisely, 32 bits rendering.</p>
<p>He showed what was happening with a Fast Blur effect (which is a 32 bits effect), and a white text in a 32 bits After Effects project.</p>
<p>Here is the rendering in a 8 bits project, just a normal blur.</p>
<p><a href="http://www.soundstep.com/blog/wp-content/sw-sc1.png"><img src="http://www.soundstep.com/blog/wp-content/sw-sc1.png" alt="" title="sw-sc1" width="603" height="424" class="alignnone size-full wp-image-482" /></a></p>
<div style="clear:both"></div>
<p>And here is the result is you set the project to be 32 bits.</p>
<p><a href="http://www.soundstep.com/blog/wp-content/sw-sc2.png"><img src="http://www.soundstep.com/blog/wp-content/sw-sc2.png" alt="" title="sw-sc2" width="630" height="441" class="alignnone size-full wp-image-483" /></a></p>
<div style="clear:both"></div>
<p>So what&#8217;s happening here? We can see there is some kind of halo, or glow, but there&#8217;s just a blur. I found the result pretty nice, a lot of luminance, and they call that &#8220;superwhite&#8221;. I didn&#8217;t find a lot of information, maybe there is another term for that. I found that very intriguing.</p>
<p>I&#8217;ve started to think how to get this effect in flash. The problem is Flash is only rendering 8 bits. I quote a details I found about Pixel Bender:</p>
<p><em>Although Pixel Bender images have 32-bits per channel, graphics in Flash Player and AIR only have 8-bits per channel. When a kernel is run, the input image data is converted to 32-bits per channel and then converted back to 8-bits per channel when kernel execution is complete.</em></p>
<p>But I wanted to have a try anyway and even if I don&#8217;t have the exact same effect in Flash, I found out that something is happening. Here is what I&#8217;ve done.</p>
<p>1. I put a white text on the stage (2 actually for other tests)<br />
2. I&#8217;ve added a Blur effect (15 and 15)</p>
<p>Here is the result, again just a normal blur.</p>
<p><a href="http://www.soundstep.com/blog/wp-content/sw-sc3.png"><img src="http://www.soundstep.com/blog/wp-content/sw-sc3.png" alt="" title="sw-sc3" width="665" height="396" class="alignnone size-full wp-image-485" /></a></p>
<div style="clear:both"></div>
<p>Then I&#8217;ve changed the alpha multiplier value (ColorTransform property) from 1 to 2.5, nothing happened obviously, alpha 1 or 2.5 is the same isn&#8217;t it? But here is the effect coming, if you add a bit of color, for example by setting the blue multiplier from 1 to 0.99, you then get a (fake?) superwhite. Here is the result:</p>
<p><a href="http://www.soundstep.com/blog/wp-content/sw-sc4.png"><img src="http://www.soundstep.com/blog/wp-content/sw-sc4.png" alt="" title="sw-sc4" width="663" height="397" class="alignnone size-full wp-image-486" /></a></p>
<div style="clear:both"></div>
<p>Again, there&#8217;s no glow of anything, it is just a color and alpha effect. The amount of &#8220;superwhite&#8221; is changed with the value of the alpha multiplier, at least from 1 to&#8230; 20 or something.</p>
<p>Pretty cool huh? It is a fake superwhite because if I trust After Effect, it can happen only with 32 bits rendering, and I also don&#8217;t get exactly the same result as in After Effect, the color halo around is missing. But still, I found that quite intriguing. I&#8217;m not that good with colors, but I believe that what&#8217;s happening is the alpha channel that is multiplied by each color channel. Maybe someone will have a more in-depth explanation of what&#8217;s happening? I would be curious.</p>
<p>To check out the demo, <a href="http://www.soundstep.com/blog/experiments/superwhite/main.swf" class="lightwindow" params="lightwindow_width=670,lightwindow_height=750" title="Super White Effect">click here</a>.</p>
<p>You can click the button at the bottom to applied values. You can see the difference between the &#8220;Normal Blur&#8221; and the &#8220;Super White&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2010/08/13/super-white-effect/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>AS3 Layout Manager BaseUI v4 finally released</title>
		<link>http://www.soundstep.com/blog/2010/07/05/as3-layout-manager-baseui-v4-finally-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=as3-layout-manager-baseui-v4-finally-released</link>
		<comments>http://www.soundstep.com/blog/2010/07/05/as3-layout-manager-baseui-v4-finally-released/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 13:40:54 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=457</guid>
		<description><![CDATA[Finally, BaseUI version 4 is released! If you don&#8217;t know what is BaseUI, it is a lightweight layout manager written in pure AS3 that is helping you to handle the position and size of your elements in a Flash layout (a site, an application and or whatever you can build with AS3). More specifically, it [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, BaseUI version 4 is released!</p>
<p>If you don&#8217;t know what is BaseUI, it is a lightweight layout manager written in pure AS3 that is helping you to handle the position and size of your elements in a Flash layout (a site, an application and or whatever you can build with AS3).</p>
<p>More specifically, it is calculating positions and size when you resize your browser to update your elements. BaseUI makes you able to use layout properties (such as top, bottom, horizontalCenter, and so on) on any DisplayObject instance, much like you would do in a Flex environment.</p>
<p>You can use BaseUI with a single DisplayOBject instance, with tons of DisplayObject instances or in a more complex system with layout classes (such as canvas, horizontal and vertical box, and tile).</p>
<p>Before showing you how it works with some simple examples, I&#8217;d like to mention that BaseUI has been completely rebuilt from scratch. I did that because I wasn&#8217;t happy at all with a lot of things in the previous version. I wanted a very clean and effective library, with no hacks to make things works, which would make it very reliable.</p>
<p>The library is now contained in a com.soma.ui package, it will be part of the next Soma MVC Framework version.</p>
<p>I removed two things from the previous version:</p>
<p>- the width and height ElementUI properties, as it wasn&#8217;t making sense, you can now just set the width and height on your own DisplayObject instances.<br />
- the percentage values for width and height, that is not possible anymore, I might add specific properties in the future if requested</p>
<p>Enough talk, you will get everything you need on the <a href="http://www.soundstep.com/blog/downloads/baseui/" target="_self">BaseUI page</a>:</p>
<p><a href="http://www.soundstep.com/blog/source/baseuiv4/demo/" target="_blank">demo</a></p>
<p><a href="http://www.soundstep.com/blog/source/baseuiv4/baseuiv4.zip" target="_self">source</a></p>
<p><a href="http://www.soundstep.com/blog/source/baseuiv4/docs/" target="_blank">documentation</a></p>
<p><strong>Concept and the need of a reference</strong></p>
<p>The important concept to understand is that you need to specify a reference to a BaseUI instance, or to the class that will handle the DisplayObject (which is the ElementUI class). A reference is what will be used to calculate size and position. For example, if you want your DisplayObject to be at 10 pixels from the bottom, you need to tell the library from what object. That&#8217;s what a reference is.</p>
<p>The reference can be any DisplayObjectContainer, such as the stage, a sprite, a layout, etc. Once you understand completely the need of having a reference, it is good to know that is doesn&#8217;t have to be a parent of your DisplayObject, it can be anything, anywhere. The only important things is that the reference must have a proper width and height, the stage or a layout class will always have it, but an empty Sprite instance won&#8217;t, the values will be 0.</p>
<p>All the following example will use the stage as a reference, but again, you can use anything you want.</p>
<p><strong>Create a BaseUI instance</strong></p>
<div class="igBar"><span id="lactionscript-163"><a href="#" onclick="javascript:showPlainTxt('actionscript-163'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-163">
<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> baseUI:BaseUI = <span style="color: #000000; font-weight: bold;">new</span> BaseUI<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Adding and removing DisplayObject instances</strong></p>
<div class="igBar"><span id="lactionscript-164"><a href="#" onclick="javascript:showPlainTxt('actionscript-164'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-164">
<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> baseUI:BaseUI = <span style="color: #000000; font-weight: bold;">new</span> BaseUI<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</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> mySprite:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<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;"><span style="color: #000000; font-weight: bold;">var</span> element:ElementUI = baseUI.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>mySprite<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;">element.<span style="color: #006600;">refresh</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;">addChild<span style="color: #66cc66;">&#40;</span>mySprite<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lactionscript-165"><a href="#" onclick="javascript:showPlainTxt('actionscript-165'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-165">
<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;">baseUI.<span style="color: #006600;">remove</span><span style="color: #66cc66;">&#40;</span>mySprite<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;">baseUI.<span style="color: #006600;">removeAll</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Getting ElementUI instances</strong></p>
<div class="igBar"><span id="lactionscript-166"><a href="#" onclick="javascript:showPlainTxt('actionscript-166'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-166">
<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> element:ElementUI = baseUI.<span style="color: #006600;">getElement</span><span style="color: #66cc66;">&#40;</span>mySprite<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> arrayOfElements:<span style="color: #0066CC;">Array</span> = baseUI.<span style="color: #006600;">getElements</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// note that this is a copy of the real array</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: #000000; font-weight: bold;">var</span> dictionaryOfElements:Dictionary = baseUI.<span style="color: #006600;">getElementsAsDictionary</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// note that this is a copy of the real dictionary </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Setting ElementUI properties</strong></p>
<div class="igBar"><span id="lactionscript-167"><a href="#" onclick="javascript:showPlainTxt('actionscript-167'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-167">
<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> element:ElementUI = baseUI.<span style="color: #006600;">getElement</span><span style="color: #66cc66;">&#40;</span>mySprite<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;">element.<span style="color: #006600;">bottom</span> = <span style="color: #cc66cc;color:#800000;">10</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;">element.<span style="color: #0066CC;">right</span> = <span style="color: #cc66cc;color:#800000;">10</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">element.<span style="color: #006600;">refresh</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lactionscript-168"><a href="#" onclick="javascript:showPlainTxt('actionscript-168'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-168">
<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> element:ElementUI = baseUI.<span style="color: #006600;">getElement</span><span style="color: #66cc66;">&#40;</span>mySprite<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;">element.<span style="color: #006600;">horizontalCenter</span> = <span style="color: #cc66cc;color:#800000;">0</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;">element.<span style="color: #006600;">verticalCenter</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">element.<span style="color: #006600;">refresh</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lactionscript-169"><a href="#" onclick="javascript:showPlainTxt('actionscript-169'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-169">
<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> element:ElementUI = baseUI.<span style="color: #006600;">getElement</span><span style="color: #66cc66;">&#40;</span>mySprite<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;">element.<span style="color: #006600;">ratio</span> = ElementUI.<span style="color: #006600;">RATIO_IN</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;">element.<span style="color: #006600;">refresh</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Reset ElementUI properties</strong></p>
<p>You can reset the Number properties of the ElementUI instance by using NaN or null for the others:</p>
<div class="igBar"><span id="lactionscript-170"><a href="#" onclick="javascript:showPlainTxt('actionscript-170'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-170">
<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;">element.<span style="color: #006600;">top</span> = <span style="color: #cc66cc;color:#800000;">10</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">element.<span style="color: #006600;">top</span> = <span style="color: #0066CC;">NaN</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;">element.<span style="color: #006600;">ratio</span> = ElementUI.<span style="color: #006600;">RATIO_IN</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;">element.<span style="color: #006600;">ratio</span> = <span style="color: #000000; font-weight: bold;">null</span>; <span style="color: #808080; font-style: italic;">// or Element.RATIO_NONE</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;">element.<span style="color: #006600;">rect</span> = <span style="color: #000000; font-weight: bold;">new</span> Rectangle<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">50</span>, <span style="color: #cc66cc;color:#800000;">50</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;">element.<span style="color: #006600;">rect</span> = <span style="color: #000000; font-weight: bold;">null</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Or reset all of them:</p>
<div class="igBar"><span id="lactionscript-171"><a href="#" onclick="javascript:showPlainTxt('actionscript-171'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-171">
<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;">element.<span style="color: #006600;">reset</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Using ratio</strong></p>
<p>The ratio is a kind of mode. You can use with a DisplayObject instance that keeps its proportion (<a href="http://en.wikipedia.org/wiki/Aspect_ratio_(image)" target="_blank">Aspect Ratio</a>) when it gets resized. Especially useful with pictures or backgrounds for example.</p>
<p>There is two ratio mode, a mode &#8220;in&#8221; and a mode &#8220;out&#8221;.</p>
<p>The mode &#8220;in&#8221; will always display all the surface of the DisplayObject instance in its reference, you might get empty area if the reference has a different ratio.<br />
The mode &#8220;out&#8221; will always cover the surface of the reference, you might miss some part of the DisplayObject if the reference has a different ratio.</p>
<p><img class="alignnone" title="ratio" src="http://www.soundstep.com/blog/wp-content/ratio.jpg" alt="ElementUI aspect ratio" width="401" height="201" /><br />
<br style="clear:both;"/></p>
<div class="igBar"><span id="lactionscript-172"><a href="#" onclick="javascript:showPlainTxt('actionscript-172'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-172">
<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> element:ElementUI = baseUI.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>mySprite<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;">element.<span style="color: #006600;">ratio</span> = ElementUI.<span style="color: #006600;">RATIO_IN</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;">element.<span style="color: #006600;">alignX</span> = ElementUI.<span style="color: #006600;">ALIGN_RIGHT</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">element.<span style="color: #006600;">alignY</span> = ElementUI.<span style="color: #006600;">ALIGN_BOTTOM</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>DisplayObject boundaries (optional)</strong></p>
<p>When you use some ElementUI properties (such as right, bottom, horizontalCenter, etc), BaseUI will use the width and height of your DisplayObject instance to make its position calculation. For example, if you want the object to be at 10 pixels from the bottom, BaseUI needs to use the height.</p>
<p>This might prove difficult in some cases, for example if you have a specific &#8220;center point&#8221; or if the size of the DisplayObject instance changes all the time (if it is animated).</p>
<p>To solve this kind of problem, you can specify the boundaries of your DisplayObject to be used as a size in BaseUI instead of its real size. You can do that by using the &#8220;rect&#8221; and a Rectangle instance.</p>
<p>For example, if you draw a square in a sprite width 100 and height 100, but starting at x -50 and y -50 so it is centered. You can specify the boundaries like this:</p>
<div class="igBar"><span id="lactionscript-173"><a href="#" onclick="javascript:showPlainTxt('actionscript-173'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-173">
<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> element:ElementUI = baseUI.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>myCenteredSprite<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;">element.<span style="color: #006600;">rect</span> = <span style="color: #000000; font-weight: bold;">new</span> Rectangle<span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;color:#800000;">50</span>, -<span style="color: #cc66cc;color:#800000;">50</span>, <span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>And you can remove it this way:</p>
<div class="igBar"><span id="lactionscript-174"><a href="#" onclick="javascript:showPlainTxt('actionscript-174'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-174">
<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;">element.<span style="color: #006600;">rect</span> = <span style="color: #000000; font-weight: bold;">null</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>ElementUI Listeners</strong></p>
<p>An ElementUI instance can dispatch three events, in this order:</p>
<p>1. EventUI.WILL_CALCULATE (dispatched before any calculation)<br />
2. EventUI.WILL_UPDATE (dispatched after calculation and before updating the DisplayObject)<br />
3. EventUI.UPDATED (dispatched after that the DisplayObject has been updated)</p>
<p>You can stop the ElementUI process in the EventUI.WILL_CALCULATE and EventUI.WILL_UPDATE handlers using &#8220;event.preventDefault()&#8221;.</p>
<div class="igBar"><span id="lactionscript-175"><a href="#" onclick="javascript:showPlainTxt('actionscript-175'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-175">
<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> baseUI:BaseUI = <span style="color: #000000; font-weight: bold;">new</span> BaseUI<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</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> element:ElementUI = baseUI.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>mySprite<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;">element.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>EventUI.<span style="color: #006600;">WILL_CALCULATE</span>, willCalculateHandler<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;">element.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>EventUI.<span style="color: #006600;">WILL_UPDATE</span>, willUpdateHandler<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;">element.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>EventUI.<span style="color: #006600;">UPDATED</span>, updatedHandler<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;">element.<span style="color: #0066CC;">right</span> = <span style="color: #cc66cc;color:#800000;">10</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;">element.<span style="color: #006600;">bottom</span> = <span style="color: #cc66cc;color:#800000;">10</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">element.<span style="color: #006600;">refresh</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;">addChild<span style="color: #66cc66;">&#40;</span>mySprite<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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> willCalculateHandler<span style="color: #66cc66;">&#40;</span>event:EventUI<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; <span style="color: #808080; font-style: italic;">//event.preventDefault(); // stop the process before the calculation</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;">trace</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">element</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// trace the ElementUI instance</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;">trace</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">element</span>.<span style="color: #0066CC;">object</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// trace the DisplayObject instance</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;">trace</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">element</span>.<span style="color: #006600;">baseUI</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// trace the BaseUI instance</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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> willUpdateHandler<span style="color: #66cc66;">&#40;</span>event:EventUI<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; <span style="color: #808080; font-style: italic;">//event.preventDefault(); // stop the process before new properties are applied to the DisplayObject</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;">trace</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">element</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// trace the ElementUI instance</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;">trace</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">element</span>.<span style="color: #0066CC;">object</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// trace the DisplayObject instance</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;">trace</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">element</span>.<span style="color: #006600;">baseUI</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// trace the BaseUI instance</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;">trace</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">properties</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// trace the properties that will be applied to the DisplayObject</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: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> updatedHandler<span style="color: #66cc66;">&#40;</span>event:EventUI<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; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">element</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// trace the ElementUI instance</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;">trace</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">element</span>.<span style="color: #0066CC;">object</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// trace the DisplayObject instance</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;">trace</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">element</span>.<span style="color: #006600;">baseUI</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// trace the BaseUI instance</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;">trace</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">properties</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// trace the properties that have been applied to the DisplayObject</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><strong>Refreshing an element</strong></p>
<p>When you create an element, the position and size will be calculated when an Event.RESIZE occurs, which might not happen unless you resize your browser. For a performance matter, the calculation is not done when you change a property. To make the calculation and update your element, you might need to use the refresh method of your ElementUI instance (or BaseUI instance for all the ElementUI).</p>
<div class="igBar"><span id="lactionscript-176"><a href="#" onclick="javascript:showPlainTxt('actionscript-176'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-176">
<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;">element.<span style="color: #006600;">refresh</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;">baseUI.<span style="color: #006600;">refresh</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Disposing and garbage collection</strong></p>
<p>Both BaseUI and ElementUI classes have a dispose method to destroy variables and make the instance eligible for the garbage collection. The only one you have to care about is the BaseUI one, as the ElementUI will be properly destroyed when you use the remove and removeAll BaseUI methods.</p>
<div class="igBar"><span id="lactionscript-177"><a href="#" onclick="javascript:showPlainTxt('actionscript-177'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-177">
<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;">baseUI.<span style="color: #006600;">dispose</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;">baseUI = <span style="color: #000000; font-weight: bold;">null</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Using layouts</strong></p>
<p>Five layouts classes are built in BaseUI, all of them have ElementUI properties directly accessible.</p>
<p>- The LayoutUI class: the super class of all the other layouts classes, only a container, children stay un-touched<br />
- The CanvasUI class: handle the children with ElementUI properties<br />
- The HBoxUI class: display the children, one after the other, in a horizontal direction<br />
- The VBoxUI class: display the children, one after the other, in a vertical direction<br />
- The TileUI class: display the children, one after the other, and is in both direction and in a &#8220;multiline&#8221; way</p>
<p>All the layouts classes will have some common properties, such as background color, background transparency, rounded values, and if the content that goes outside of the boundaries of the layouts should be displayed or hidden.</p>
<p>You can also use layouts in other layouts, like adding canvas in tiles that are added in vertical boxes, etc. Be aware that we&#8217;re still using flash here, and even if the library is efficient, it might get slower if you add thousands of tiles in thousands of other tiles with thousands of bitmaps. Calculation are made and everything has limits, especially Flash. Beside that, I got good performance with the library, you will be fine unless you do crazy things <img src='http://www.soundstep.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>The LayoutUI class</strong></p>
<p>The LayoutUI class extends the MovieClip class and is nothing else that a container that will always have a size (width and height), even if there&#8217;s nothing inside. Another difference with another built-in flash container (like Sprite, MovieClip, etc), is that the width and height will always be the one of the container regardless of what it contains.</p>
<p>For example, a layout instance (width 100 and height 100), that contains another DisplayObject (width 200 and height 200). The width and height values returned by a normal Sprite or MovieClip would be 200, while the layouts classes will return 100 (see getRealWidth and getRealHeight methods).</p>
<p>And that is true for all the layouts in the library, it is something to be aware of.</p>
<div class="igBar"><span id="lactionscript-178"><a href="#" onclick="javascript:showPlainTxt('actionscript-178'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-178">
<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> layout:LayoutUI = <span style="color: #000000; font-weight: bold;">new</span> LayoutUI<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>, <span style="color: #cc66cc;color:#800000;">400</span>, <span style="color: #cc66cc;color:#800000;">300</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;">layout.<span style="color: #0066CC;">backgroundColor</span> = 0xFF0000;</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;">layout.<span style="color: #006600;">backgroundAlpha</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">layout.<span style="color: #006600;">bottom</span> = <span style="color: #cc66cc;color:#800000;">10</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;">layout.<span style="color: #0066CC;">right</span> = <span style="color: #cc66cc;color:#800000;">10</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">layout.<span style="color: #006600;">refresh</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;">addChild<span style="color: #66cc66;">&#40;</span>layout<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>The CanvasUI class</strong></p>
<p>The behavior of the CanvasUI class is very close to its super class (LayoutUI), with the different that an ElementUI instance is created (or removed) when you add children to its display list. Makes you able to handle the children of the CanvasUI instance with ElementUI properties.</p>
<div class="igBar"><span id="lactionscript-179"><a href="#" onclick="javascript:showPlainTxt('actionscript-179'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-179">
<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> canvas:CanvasUI = <span style="color: #000000; font-weight: bold;">new</span> CanvasUI<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>, <span style="color: #cc66cc;color:#800000;">400</span>, <span style="color: #cc66cc;color:#800000;">300</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;">canvas.<span style="color: #0066CC;">backgroundColor</span> = 0xFF0000;</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;">canvas.<span style="color: #006600;">backgroundAlpha</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">canvas.<span style="color: #006600;">ratio</span> = ElementUI.<span style="color: #006600;">RATIO_IN</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;">addChild<span style="color: #66cc66;">&#40;</span>canvas<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: #000000; font-weight: bold;">var</span> sprite:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<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;">sprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xFF0000, .<span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sprite.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">100</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: #000000; font-weight: bold;">var</span> element:ElementUI = canvas.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>sprite<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;">element.<span style="color: #0066CC;">right</span> = <span style="color: #cc66cc;color:#800000;">10</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;">element.<span style="color: #006600;">bottom</span> = <span style="color: #cc66cc;color:#800000;">10</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;">canvas.<span style="color: #006600;">refresh</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>The HBoxUI class (horizontal box)</strong></p>
<p>The goal of the HBoxUI class is that it will take from the positioning of its children, and align them in an horizontal way and only one row. Properties such as children gap, children align and children padding are introduced.</p>
<div class="igBar"><span id="lactionscript-180"><a href="#" onclick="javascript:showPlainTxt('actionscript-180'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-180">
<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> hbox:HBoxUI = <span style="color: #000000; font-weight: bold;">new</span> HBoxUI<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>, <span style="color: #cc66cc;color:#800000;">400</span>, <span style="color: #cc66cc;color:#800000;">300</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;">hbox.<span style="color: #0066CC;">backgroundColor</span> = 0xFF0000;</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;">hbox.<span style="color: #006600;">backgroundAlpha</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">hbox.<span style="color: #006600;">ratio</span> = ElementUI.<span style="color: #006600;">RATIO_IN</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;">hbox.<span style="color: #006600;">childrenGap</span> = <span style="color: #000000; font-weight: bold;">new</span> GapUI<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">5</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;">hbox.<span style="color: #006600;">childrenPadding</span> = <span style="color: #000000; font-weight: bold;">new</span> PaddingUI<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">hbox.<span style="color: #006600;">childrenAlign</span> = HBoxUI.<span style="color: #006600;">ALIGN_BOTTOM_RIGHT</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">addChild<span style="color: #66cc66;">&#40;</span>hbox<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: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;color:#800000;">0</span>; i&amp;lt;<span style="color: #cc66cc;color:#800000;">8</span>; ++i<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;"><span style="color: #000000; font-weight: bold;">var</span> sprite:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<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;">sprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xFF0000, .<span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sprite.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">100</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;">hbox.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>sprite<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>
<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;">hbox.<span style="color: #006600;">refresh</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>The VBoxUI class (vertical box)</strong></p>
<p>The VBoxUI class is much like the HBoxUI one, but you found out, in a vertical way.</p>
<div class="igBar"><span id="lactionscript-181"><a href="#" onclick="javascript:showPlainTxt('actionscript-181'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-181">
<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> vbox:VBoxUI = <span style="color: #000000; font-weight: bold;">new</span> VBoxUI<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>, <span style="color: #cc66cc;color:#800000;">400</span>, <span style="color: #cc66cc;color:#800000;">300</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;">vbox.<span style="color: #0066CC;">backgroundColor</span> = 0xFF0000;</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;">vbox.<span style="color: #006600;">backgroundAlpha</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">vbox.<span style="color: #006600;">ratio</span> = ElementUI.<span style="color: #006600;">RATIO_IN</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;">vbox.<span style="color: #006600;">childrenGap</span> = <span style="color: #000000; font-weight: bold;">new</span> GapUI<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">5</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;">vbox.<span style="color: #006600;">childrenPadding</span> = <span style="color: #000000; font-weight: bold;">new</span> PaddingUI<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">vbox.<span style="color: #006600;">childrenAlign</span> = VBoxUI.<span style="color: #006600;">ALIGN_BOTTOM_RIGHT</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">addChild<span style="color: #66cc66;">&#40;</span>vbox<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: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;color:#800000;">0</span>; i&amp;lt;<span style="color: #cc66cc;color:#800000;">8</span>; ++i<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;"><span style="color: #000000; font-weight: bold;">var</span> sprite:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<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;">sprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xFF0000, .<span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sprite.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">100</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;">vbox.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>sprite<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>
<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;">vbox.<span style="color: #006600;">refresh</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>The TileUI class</strong></p>
<p>A kind of mix between the HBoxUI and VBoxUI classes, Flex developer are used to it as well. It will show the children in multiple lines, in any direction depending of the setting used.</p>
<div class="igBar"><span id="lactionscript-182"><a href="#" onclick="javascript:showPlainTxt('actionscript-182'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-182">
<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> tile:TileUI = <span style="color: #000000; font-weight: bold;">new</span> TileUI<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>, <span style="color: #cc66cc;color:#800000;">400</span>, <span style="color: #cc66cc;color:#800000;">300</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;">tile.<span style="color: #0066CC;">backgroundColor</span> = 0xFF0000;</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;">tile.<span style="color: #006600;">backgroundAlpha</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tile.<span style="color: #006600;">ratio</span> = ElementUI.<span style="color: #006600;">RATIO_IN</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;">tile.<span style="color: #006600;">childrenGap</span> = <span style="color: #000000; font-weight: bold;">new</span> GapUI<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">5</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;">tile.<span style="color: #006600;">childrenPadding</span> = <span style="color: #000000; font-weight: bold;">new</span> PaddingUI<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tile.<span style="color: #006600;">childrenAlign</span> = TileUI.<span style="color: #006600;">ALIGN_BOTTOM_RIGHT</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tile.<span style="color: #006600;">childrenDirection</span> = TileUI.<span style="color: #006600;">DIRECTION_HORIZONTAL</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;">addChild<span style="color: #66cc66;">&#40;</span>tile<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: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;color:#800000;">0</span>; i&amp;lt;<span style="color: #cc66cc;color:#800000;">16</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;"><span style="color: #000000; font-weight: bold;">var</span> sprite:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<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;">sprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xFF0000, .<span style="color: #cc66cc;color:#800000;">5</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;">sprite.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">100</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;">tile.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>sprite<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;">tile.<span style="color: #006600;">refresh</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>I&#8217;m sure you will enjoy the library, it is very easy to use. Please send me some feedback <img src='http://www.soundstep.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Happy development!</p>
<p>Romuald</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2010/07/05/as3-layout-manager-baseui-v4-finally-released/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Badge AIR runtime installation bug with Firefox</title>
		<link>http://www.soundstep.com/blog/2010/06/29/badge-air-runtime-installation-bug-with-firefox/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=badge-air-runtime-installation-bug-with-firefox</link>
		<comments>http://www.soundstep.com/blog/2010/06/29/badge-air-runtime-installation-bug-with-firefox/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 09:22:01 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[as3]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=448</guid>
		<description><![CDATA[I found out that there&#8217;s a bug with the badge used to install an AIR application with Firefox from version 3.6.4 until today&#8217;s version (3.6.6). If you don&#8217;t have the AIR runtime installed a Adobe UI should pop up to show a progress bar and install the runtime. The trouble is that nothing happened at [...]]]></description>
			<content:encoded><![CDATA[<p>I found out that there&#8217;s a bug with the badge used to install an AIR application with Firefox from version 3.6.4 until today&#8217;s version (3.6.6).</p>
<p>If you don&#8217;t have the AIR runtime installed a Adobe UI should pop up to show a progress bar and install the runtime. The trouble is that nothing happened at all after clicking on the YES button.</p>
<p><a href="http://www.soundstep.com/blog/wp-content/Screen-shot-2010-06-29-at-10.02.35.png"><img class="alignnone size-full wp-image-449" title="Badge AIR runtime installation" src="http://www.soundstep.com/blog/wp-content/Screen-shot-2010-06-29-at-10.02.35.png" alt="Badge AIR runtime installation" width="217" height="180" /></a></p>
<div style="height: 10px; clear: both;">
<p>To test the bug, uninstall your AIR runtime and test the badge in <a href="http://www.soundstep.com/blog/2008/06/01/chromeless-air-application/" target="_blank">this page</a>.</div>
<p>The problems is very inconsistent, sometimes it works and sometimes it doesn&#8217;t.</p>
<p>I haven&#8217;t been able to find out what&#8217;s going on, so I reported the bug in <a href="http://bugs.adobe.com/jira/browse/FP-4903" target="_blank">this page</a>.</p>
<p>Romu</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2010/06/29/badge-air-runtime-installation-bug-with-firefox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SomaCore update AS3 MVC Minimal Framework</title>
		<link>http://www.soundstep.com/blog/2010/05/14/somacore-update-as3-mvc-minimal-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somacore-update-as3-mvc-minimal-framework</link>
		<comments>http://www.soundstep.com/blog/2010/05/14/somacore-update-as3-mvc-minimal-framework/#comments</comments>
		<pubDate>Fri, 14 May 2010 13:48:12 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>
		<category><![CDATA[SomaCore]]></category>
		<category><![CDATA[SomaUI]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=442</guid>
		<description><![CDATA[Hi everyone, In case you didn&#8217;t notice that I released an new minimal AS3 MVC Framework some time ago, SomaCore is available on this page. I call it minimal because it is very lightweight, yet powerful and non-intrusive. You don&#8217;t have much to learn if you&#8217;re used to MVC framework of any sort. I made [...]]]></description>
			<content:encoded><![CDATA[<p>Hi everyone,</p>
<p>In case you didn&#8217;t notice that I released an new minimal AS3 MVC Framework some time ago, SomaCore is available on <a href="http://www.soundstep.com/blog/downloads/somacore/">this page</a>.</p>
<p>I call it minimal because it is very lightweight, yet powerful and non-intrusive. You don&#8217;t have much to learn if you&#8217;re used to MVC framework of any sort.</p>
<p>I made an update today, the second one in months because it won&#8217;t change a lot, the structure is there. All the <a href="http://www.soundstep.com/blog/downloads/somacore/">sources and demo</a> have been updated.</p>
<p>You can also replace any kind of previous use of the framework, the only feature added is a dispose method that will remove everything that has been created in the framework. Mostly useful in case you&#8217;re creating several instance of the framework, it will now be correctly garbage collected.</p>
<p>Once you&#8217;ve created a instance of the framework:</p>
<div class="igBar"><span id="lactionscript-186"><a href="#" onclick="javascript:showPlainTxt('actionscript-186'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-186">
<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> app:ISoma = <span style="color: #000000; font-weight: bold;">new</span> Application<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The only things you need to do is</p>
<div class="igBar"><span id="lactionscript-187"><a href="#" onclick="javascript:showPlainTxt('actionscript-187'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-187">
<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;">app.<span style="color: #006600;">dispose</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;">app = <span style="color: #000000; font-weight: bold;">null</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Here is what it is doing to the components that have been added to the frameworks:</p>
<p>- all wires will be removed. On each wire, the dispose method will be called. You can overwrite this dispose method in your wires subclasses.</p>
<p>- all models will be removed. On each model, the dispose method will be called. You can overwrite this dispose method in your models subclasses.</p>
<p>- all commands will be removed</p>
<p>- all views will be removed but not removed from the display list, that&#8217;s your job. On each view, a dispose method will be called if it exists. You can create this dispose method in your views:</p>
<div class="igBar"><span id="lactionscript-188"><a href="#" onclick="javascript:showPlainTxt('actionscript-188'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-188">
<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> dispose<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// dispose objects, graphics and events listeners</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>It important to say that all the components will be removed from the framework, but that&#8217;s your matter to properly destroyed what you&#8217;re creating in order to be garbage collected.</p>
<p>A quick info for my plans because I&#8217;ve silent lately (busy).</p>
<p>I&#8217;ll make a <a href="http://www.soundstep.com/blog/downloads/baseui/">BaseUI</a> release in the next weeks, a completely rebuilt and optimized version 4. It is ready but I need to finish the documentation. </p>
<p>After that I plan to make more examples and screen cast about the SomaCore Framework.</p>
<p>I just wanted to say that I&#8217;m rarely happy about what I&#8217;m producing, because I like things to be&#8230; perfect. Of course, perfection can&#8217;t be reached, but that is pushing me to create the better code I can, at my level.</p>
<p>I&#8217;m now using SomaCore in some projects. One is a relatively complicated AIR Modular Application for children. And for once, I&#8217;m very happy with what I&#8217;ve done with SomaCore. It has been a great help really, I should say that it saves me a lot of troubles when changes happened because I built the application how I wanted it, without &#8220;framework-fight&#8221; and as much flexible as I could. It just made me more responsive to any kind of changes in the project.</p>
<p>For this reason, I&#8217;ll try to push SomaCore further by making more demos, videos, examples, documentation, wires concept and so on.</p>
<p>I still have plans to create a new version of the first <a href="http://www.soundstep.com/blog/downloads/somaui/">automated framework Soma MVC</a>, and its source generator, based on SomaCore.</p>
<p>Happy development!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2010/05/14/somacore-update-as3-mvc-minimal-framework/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Firefox 3.6 Mac bug with MouseEvent</title>
		<link>http://www.soundstep.com/blog/2010/03/02/firefox-3-6-mac-bug-with-mouseevent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=firefox-3-6-mac-bug-with-mouseevent</link>
		<comments>http://www.soundstep.com/blog/2010/03/02/firefox-3-6-mac-bug-with-mouseevent/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 12:36:27 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=433</guid>
		<description><![CDATA[Firefox 3.6 introduced a very annoying bug, and only on a Mac. If you&#8217;re using somewhere a MouseEvent.ROLL_OUT or MouseEvent.MOUSE_OUT, this event will fired even if you only click on a object without leave the object with the mouse. Example there The select box in the middle of the page doesn&#8217;t work because a roll [...]]]></description>
			<content:encoded><![CDATA[<p>Firefox 3.6 introduced a very annoying bug, and only on a Mac.</p>
<p>If you&#8217;re using somewhere a <code>MouseEvent.ROLL_OUT</code> or <code>MouseEvent.MOUSE_OUT</code>, this event will fired even if you only click on a object without leave the object with the mouse.</p>
<p><a href="http://www.nokiamusic.co.uk/musicwelike/" target="_blank">Example there</a></p>
<p>The select box in the middle of the page doesn&#8217;t work because a roll out event is fired when you click on it.</p>
<p>I didn&#8217;t try yet to find a fix with MOUSE_UP and MOUSE_DOWN, but the problem is, all the existing sites that are using those events might be broken&#8230;</p>
<p>I believe Firefox is, or not firing the right event, or removing and putting back the flash so it loses the focus, meaning roll out is fired&#8230; A friend told me that the same things happen with java applet, didn&#8217;t verify it yet.</p>
<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=549600" target="_blank">Bug report</a></p>
<p>To test it, paste this as a document class:</p>
<div class="igBar"><span id="lactionscript-190"><a href="#" onclick="javascript:showPlainTxt('actionscript-190'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-190">
<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;">soundstep</span>.<span style="color: #006600;">baseui</span>.<span style="color: #006600;">demo</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;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</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;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</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;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #0066CC;">extends</span> Sprite <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; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Main<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; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> s:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<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; s.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xFF0000<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; s.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">100</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; s.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_OUT</span>, test<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; addChild<span style="color: #66cc66;">&#40;</span>s<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; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> test<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>: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; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;ok&#8221;</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; &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>Click on the square and you&#8217;ll see that the MOUSE_OUT is fired&#8230;</p>
<p>I hope they&#8217;ll fix soon or I&#8217;ll have to find a hack and change everything that is live.</p>
<p>Romu</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2010/03/02/firefox-3-6-mac-bug-with-mouseevent/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>AS3 garbage collection monitor</title>
		<link>http://www.soundstep.com/blog/2010/01/18/as3-garbage-collection-monitor/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=as3-garbage-collection-monitor</link>
		<comments>http://www.soundstep.com/blog/2010/01/18/as3-garbage-collection-monitor/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 11:26:50 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[SomaCore]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=423</guid>
		<description><![CDATA[I needed to watch objects to know if they were properly garbage collected or not, so I&#8217;ve added a GC Monitor in the SomaCore Debugger. It is pretty easy to use and I think very useful if you start to care about the memory that the Flash Player is using and global performance. Demo Flash [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to watch objects to know if they were properly garbage collected or not, so I&#8217;ve added a GC Monitor in the <a href="http://www.soundstep.com/blog/downloads/somacore/">SomaCore</a> Debugger. It is pretty easy to use and I think very useful if you start to care about the memory that the Flash Player is using and global performance.</p>
<p><strong>Demo Flash (garbage collection monitor)</strong></p>
<p><a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaCoreGC/" target="_blank"><img class=" alignnone" title="SomaCore Flash AS3 Demo - Garbage Collection" src="/blog/source/somacore/demo/Flash/SomaCoreGC/preview.jpg" alt="SomaCore Flash AS3 Demo - Garbage Collection" width="300" height="186" /></a><br clear="all"/></p>
<p><a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaCoreGC/" target="_blank">View Demo</a><br />
<a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaCoreGC/srcview" target="_blank">View Source</a><br />
<a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaCoreGC/srcview/SomaCoreGC.zip" target="_blank">Download Source</a></p>
<p>The concept to use it is to &#8220;register&#8221; an object, such as a Sprite or anything, with a name.</p>
<p>The first step is to create the debugger. If you&#8217;re using the framework SomaCore, you&#8217;ll find some demo by <a href="http://www.soundstep.com/blog/downloads/somacore/">clicking here</a>.<br />
And if you want to use the debugger without using SomaCore, here is a snippet to create the application and debugger:</p>
<div class="igBar"><span id="lactionscript-195"><a href="#" onclick="javascript:showPlainTxt('actionscript-195'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-195">
<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 <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;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">Soma</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">ISoma</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">debugger</span>.<span style="color: #006600;">SomaDebugger</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">debugger</span>.<span style="color: #006600;">vo</span>.<span style="color: #006600;">SomaDebuggerVO</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">debugger</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">SomaDebuggerEvent</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;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #0066CC;">extends</span> Sprite <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; <span style="color: #000000; font-weight: bold;">function</span> Main<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; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// create soma application</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> app:ISoma = <span style="color: #000000; font-weight: bold;">new</span> Soma<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</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: #808080; font-style: italic;">// create debugger options</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> vo:SomaDebuggerVO = <span style="color: #000000; font-weight: bold;">new</span> SomaDebuggerVO<span style="color: #66cc66;">&#40;</span>app, SomaDebugger.<span style="color: #006600;">NAME_DEFAULT</span>, <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #000000; font-weight: bold;">false</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: #808080; font-style: italic;">// create debugger</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> debugger:SomaDebugger = app.<span style="color: #006600;">createPlugin</span><span style="color: #66cc66;">&#40;</span>SomaDebugger, vo<span style="color: #66cc66;">&#41;</span> as SomaDebugger;</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: #808080; font-style: italic;">// use debugger</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; debug<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;Hello Debugger&#8221;</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; debug<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debug<span style="color: #66cc66;">&#40;</span>app<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; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> debug<span style="color: #66cc66;">&#40;</span>obj:<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// use app.dispatchEvent() from a class that is not in the display list</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; dispatchEvent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> SomaDebuggerEvent<span style="color: #66cc66;">&#40;</span>SomaDebuggerEvent.<span style="color: #0066CC;">PRINT</span>, obj<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// events available:</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: #808080; font-style: italic;">// SomaDebuggerEvent.SHOW_DEBUGGER;</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: #808080; font-style: italic;">// SomaDebuggerEvent.CLEAR;</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: #808080; font-style: italic;">// SomaDebuggerEvent.PRINT;</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: #808080; font-style: italic;">// SomaDebuggerEvent.HIDE_DEBUGGER;</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: #808080; font-style: italic;">// SomaDebuggerEvent.MOVE_TO_TOP;</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; &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>Register an object to watch it:</p>
<div class="igBar"><span id="lactionscript-196"><a href="#" onclick="javascript:showPlainTxt('actionscript-196'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-196">
<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;">dispatchEvent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> SomaDebuggerGCEvent<span style="color: #66cc66;">&#40;</span>SomaDebuggerGCEvent.<span style="color: #006600;">ADD_WATCHER</span>, <span style="color: #ff0000;">&#8220;my sprite&#8221;</span>, mySprite<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You can dispatch this event from anywhere in an DisplayObject in the display list (Sprite, MovieClip, etc), from the document class, the stage or the SomaCore instance.</p>
<p>In the debugger window, there is a &#8220;garbage collection bar&#8221; where you can click to see the registered objects, they can be either &#8220;retained&#8221; or &#8220;released&#8221;. A released object means it has been garbage collected and doesn&#8217;t exist anymore. The memory used by this object will be free to use.</p>
<p>A &#8220;force&#8221; button will trigger the garbage collection, it will call System.gc() twice with a small interval. This should only works in a Flash Player Debugger version, but useful for debugging.</p>
<p>Here is a list of events you can use for the garbage collection monitor:</p>
<div class="igBar"><span id="lactionscript-197"><a href="#" onclick="javascript:showPlainTxt('actionscript-197'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-197">
<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;">SomaDebuggerGCEvent.<span style="color: #006600;">REMOVE_ALL_WATCHERS</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">SomaDebuggerGCEvent.<span style="color: #006600;">REMOVE_WATCHER</span> <span style="color: #808080; font-style: italic;">// pass the name of he object as parameter</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;">SomaDebuggerGCEvent.<span style="color: #006600;">ADD_WATCHER</span> <span style="color: #808080; font-style: italic;">// pass the name of the objects and the object itself as parameter</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">SomaDebuggerGCEvent.<span style="color: #006600;">FORCE_GC</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Note: by default SomaDebugger is now using a weak reference to the objects that you want to inspect. You can turn off this option to inspect everything in the debugger, but the objects will never be released, making the garbage collection monitor useless.</p>
<p>Here is how to force the inspection of any objects:</p>
<div class="igBar"><span id="lactionscript-198"><a href="#" onclick="javascript:showPlainTxt('actionscript-198'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-198">
<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;">SomaDebugger.<span style="color: #006600;">WEAK_REFERENCE</span> = <span style="color: #000000; font-weight: bold;">false</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Any feedback appreciated!</p>
<p>Romu</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2010/01/18/as3-garbage-collection-monitor/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SomaCore Debugger update</title>
		<link>http://www.soundstep.com/blog/2009/11/27/somacore-debugger-update/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somacore-debugger-update</link>
		<comments>http://www.soundstep.com/blog/2009/11/27/somacore-debugger-update/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 14:35:25 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=417</guid>
		<description><![CDATA[I&#8217;ve updated the debugger used in SomaCore. You can know click on everything to parse the objects and I&#8217;ve added a FPS + Memory meter. I&#8217;ll continue to improve the debugger with my needs, next step might be a Garbage Collection monitor. Click here to see the debugger in action. Tips: if you close the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated the debugger used in <a href="http://www.soundstep.com/blog/downloads/somacore/">SomaCore</a>. You can know click on everything to parse the objects and I&#8217;ve added a FPS + Memory meter. I&#8217;ll continue to improve the debugger with my needs, next step might be a Garbage Collection monitor.</p>
<p><a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaColor/" target="_blank">Click here to see the debugger in action.</a></p>
<p>Tips: if you close the debugger, type &#8220;debug&#8221; to get it back.</p>
<p>Here is a little bit of code in case you want to want to use the debugger without using the SomaCore Framework.</p>
<div class="igBar"><span id="lactionscript-200"><a href="#" onclick="javascript:showPlainTxt('actionscript-200'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-200">
<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 <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;">display</span>.<span style="color: #006600;">Sprite</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">Soma</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">core</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">ISoma</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">debugger</span>.<span style="color: #006600;">SomaDebugger</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">debugger</span>.<span style="color: #006600;">vo</span>.<span style="color: #006600;">SomaDebuggerVO</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;">import</span> com.<span style="color: #006600;">soma</span>.<span style="color: #006600;">debugger</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">SomaDebuggerEvent</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; </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;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #0066CC;">extends</span> Sprite <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; </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: #000000; font-weight: bold;">function</span> Main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// create soma application</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> app:ISoma = <span style="color: #000000; font-weight: bold;">new</span> Soma<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</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; <span style="color: #808080; font-style: italic;">// create debugger options</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> vo:SomaDebuggerVO = <span style="color: #000000; font-weight: bold;">new</span> SomaDebuggerVO<span style="color: #66cc66;">&#40;</span>app, SomaDebugger.<span style="color: #006600;">NAME_DEFAULT</span>, <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #000000; font-weight: bold;">false</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; <span style="color: #808080; font-style: italic;">// create debugger</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> debugger:SomaDebugger = app.<span style="color: #006600;">createPlugin</span><span style="color: #66cc66;">&#40;</span>SomaDebugger, vo<span style="color: #66cc66;">&#41;</span> as SomaDebugger;</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: #808080; font-style: italic;">// use debugger</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; debug<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;Hello Debugger&#8221;</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; debug<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</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; debug<span style="color: #66cc66;">&#40;</span>app<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; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> debug<span style="color: #66cc66;">&#40;</span>obj:<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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// use app.dispatchEvent() from a class that is not in the display list</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; dispatchEvent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> SomaDebuggerEvent<span style="color: #66cc66;">&#40;</span>SomaDebuggerEvent.<span style="color: #0066CC;">PRINT</span>, obj<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// events available:</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: #808080; font-style: italic;">// SomaDebuggerEvent.SHOW_DEBUGGER;</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: #808080; font-style: italic;">// SomaDebuggerEvent.CLEAR;</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: #808080; font-style: italic;">// SomaDebuggerEvent.PRINT;</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: #808080; font-style: italic;">// SomaDebuggerEvent.HIDE_DEBUGGER;</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: #808080; font-style: italic;">// SomaDebuggerEvent.MOVE_TO_TOP;</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; &nbsp; &nbsp; &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;">&#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; </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>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/11/27/somacore-debugger-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SomaCore AS3 MVC Framework event-based</title>
		<link>http://www.soundstep.com/blog/2009/11/20/somacore-as3-mvc-framework-event-based/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somacore-as3-mvc-framework-event-based</link>
		<comments>http://www.soundstep.com/blog/2009/11/20/somacore-as3-mvc-framework-event-based/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 12:06:30 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=410</guid>
		<description><![CDATA[Following my previous post about MVC design philosophy and an AS3 MVC Framework that suit my needs and expectations, I&#8217;ve started using SomaCore in a relatively complicated AIR modular application, and I&#8217;m really enjoying it. I made some small changes to the code and I thought it would be a good idea to provide you [...]]]></description>
			<content:encoded><![CDATA[<p>Following my previous post about <a href="http://www.soundstep.com/blog/2009/10/06/mvc-design-philosophy/">MVC design philosophy</a> and an AS3 MVC Framework that suit my needs and expectations, I&#8217;ve started using SomaCore in a relatively complicated AIR modular application, and I&#8217;m really enjoying it.</p>
<p>I made some small changes to the code and I thought it would be a good idea to provide you the sources. SomaCore was a missing tool in my actionscript work.</p>
<p>I&#8217;ve started to feel the power of the native Flash event system (even if criticized!) by being able to listen to commands independently of the commands itself (and what the command is doing), or being able to &#8220;preventDefault&#8221; any command, or to monitor very easily everything that is going on in the framework. The wires have been a good help to keep my code very clean without tons of classes, while keeping my models and views completely free of framework code.</p>
<p>I also found out some kind of hidden capabilities I didn&#8217;t think about while making it. One of them is an &#8220;easy module communication&#8221;, so easy that, you have absolutely nothing to do to enable it. When I say module, it could be another SomaCore instance, a loaded SWF, another SomaCore instance in a loaded SWF, and so on. But I&#8217;ll give more details later.</p>
<p>You can now find the (updated) SomaCore resources on the <a href="http://www.soundstep.com/blog/downloads/somacore/">SomaCore Page</a>.</p>
<p>Special thanks to Henry for his testing and feedback!</p>
<p>Feel free to use the sources and give me some feedback. I&#8217;ll try later to give more explanation on how to use SomaCore and the Wires, new demos and tutorials.</p>
<p>Romu</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/11/20/somacore-as3-mvc-framework-event-based/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MVC design philosophy</title>
		<link>http://www.soundstep.com/blog/2009/10/06/mvc-design-philosophy/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mvc-design-philosophy</link>
		<comments>http://www.soundstep.com/blog/2009/10/06/mvc-design-philosophy/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 11:05:14 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[data management]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=371</guid>
		<description><![CDATA[Hi Everyone, This is not exactly a &#8220;Soma release&#8221;, but I would like to share with you my last work so we can talk about: A new AS3 MVC Framework with its own design philosophy. Why another AS3 MVC Framework? I&#8217;ve been working with different Frameworks in the last years, such as PureMVC, Cairngorm and Mate [...]]]></description>
			<content:encoded><![CDATA[<p>Hi Everyone,</p>
<p>This is not exactly a &#8220;Soma release&#8221;, but I would like to share with you my last work so we can talk about: A new AS3 MVC Framework with its own design philosophy.</p>
<p><strong>Why another AS3 MVC Framework?</strong></p>
<p>I&#8217;ve been working with different Frameworks in the last years, such as <a href="http://puremvc.org/" target="_blank">PureMVC</a>, <a href="http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm" target="_blank">Cairngorm</a> and <a href="http://mate.asfusion.com/" target="_blank">Mate</a> for the well-known. I&#8217;ve always knew that I would write my own &#8220;MVC design philosophy&#8221;, without taking big words, because I would have some needs that existing Frameworks wouldn&#8217;t completely fill.</p>
<p>That&#8217;s what happened. I needed a Flash lightweight framework, not DI, event based, working both for Flex or Pure AS3. The biggest inspirations have been PureMVC for the proxies and mediators, and Mate for their event system.</p>
<p>I&#8217;ll be starting an interesting AIR Modular app and I needed something that will easily allow me to have views and models free of Framework code, without creating tons of files or use any injection. I also wanted a Framework very flexible, so I can use it even for smaller project, being sure I&#8217;ll be effective in terms of development time.</p>
<p><strong>Free the views and models</strong></p>
<p>First problem, free the views and models of Framework code (loose-coupling). It seems there&#8217;s a wave of DI Framework but&#8230; I&#8217;ve never really been into DI Framework, because they tend to control the way you&#8217;re doing things. If you stick to it, it is fine, but I&#8217;ve always felt more freedom with framework like PureMVC. I might be wrong, it is just an opinion and not even entirely true as I didn&#8217;t felt that problem with Mate.</p>
<p>So, to solve this problem, I used the events Mate concept. A basic Flash Events that has a bubble property set to true can become Commands when they are mapped to a Command class. Those events can be intercepted, stopped and processed by the Framework (execute Commands). The great thing is, views and models are free of Framework code and can use Commands because they are just Flash native events.</p>
<p><strong>Wires introduction</strong></p>
<p>Second problem, was to &#8220;update&#8221; data or states in the views and models. PureMVC is using proxies and mediators and I like that approach. However, you end up by creating tons of files for the sake of loose-coupling pratice. So I&#8217;ve created something that I call &#8220;Wire&#8221;. Now software engineers or PureMVC adept might say that what I&#8217;m doing is wrong. I have no idea, I&#8217;m no computer scientist, I do what I feel and I&#8217;m sharing it with you.</p>
<p>Wire are classes that can contain Framework code and they will be the links between the models, the views, the Framework and&#8230; whatever you like. Wire can be proxies, they can be mediators, but they can also be both and handle more than one view or model.</p>
<p>Basically, they are as free as you want them to be. They can even be optional if you don&#8217;t care about good practice or loose-coupling programming. Wires have easy access to all the framework, models, commands and views. They can register create models, views, register commands or create other wires.</p>
<p><i>Update from comment:</p>
<p>So far I saw two ways to inject/update information into views without having framework code inside:</p>
<p>- Dependency Injection<br />
- Buffer classes (such as Mediators and Proxies in PureMVC for the analogy, respectively for Views and Models). I mean &#8220;buffer&#8221; by classes that act as steward of other classes.</p>
<p>I&#8217;ve chosen the second way, and I&#8217;ve created a &#8220;buffer&#8221; class that I called a Wire.</p>
<p>Wires are completely free classes. I won&#8217;t tell you how to use them (because that&#8217;s up to you) but I can tell what you can do with them. Wires can be used to update views and models but they are not tight to anything. They are not even only tight to one tier. To create a wire class you extend Wire and implements IWire, and here are the roles they can take:</p>
<p>- a wire can act as steward of a view (such as Mediator in PureMVC)<br />
- a wire can act as steward of a model (such as Proxies in PureMVC)<br />
- a wire can manage both a view and a model<br />
- a wire can manage multiple views and/or multiple models<br />
- a wire can be considered as a subdivision of the framework and create its own views, create its own models and register its own commands. Much like you would create a specific package to hold a specific matter.</p>
<p>When I build something, I always try to keep a good level of freedom to handle problems how I like but most importantly, how they should be. If you like to have the framework telling you (or forcing you) how to build your application, fair enough but you won&#8217;t like it.</p>
<p>The wires are the free elements that will let you built your application the way you like or the way it is required to be. They can make your application rigid, segmented, flexible or centralized, depending of the role you are going to give them. They are so free that I believe remove (or lesser) what I call &#8220;Framework Fight&#8221;.</p>
<p>Let&#8217;s take an example, the Cafe TownSend below.</p>
<p>There are 2 wires: the LoginWire and the Employee Wire. They both register their own commands to control their views and models.</p>
<p>The Login Wire only handles a Login View.</p>
<p>The EmployeeWire handles 2 views: a list of employees and an employee details. But also 1 model (the employees data), all of them only related to employees matter.</i></p>
<p><strong>SomaCore</strong></p>
<p>I temporarily named this framework SomaCore and it has nothing to do with the Framework I released on this blog (Soma). However, this framework might become the core of what will be Soma v3.</p>
<p>I post this code hoping to get your feedback or point of view of what might be great or wrong in this framework.</p>
<p>Here is a diagram:</p>
<p><a href="http://www.soundstep.com/blog/source/somacore/diagram/SomaDiagram.pdf"><img class=" alignnone" title="SomaCore MVC Diagram" src="/blog/source/somacore/diagram/preview.jpg" alt="SomaCore MVC Diagram" width="300" height="225" /></a></p>
<p><br clear="all"/></p>
<p><a href="http://www.soundstep.com/blog/source/somacore/somacore.zip" target="_blank">Click here to download a zip file containing the Framework sources code (classes and SWC).</a></p>
<p>And here are some demos. I made a Flex Cafe TownSend demo and a pure AS3 demo.</p>
<table border="0">
<tbody>
<tr>
<td><a href="http://www.soundstep.com/blog/source/somacore/demo/Flex/CafeTownSend/" target="_blank"><img class=" alignnone" title="SomaCore Flex Cafe TownSend" src="/blog/source/somacore/demo/Flex/CafeTownSend/preview.jpg" alt="SomaCore Flex Cafe TownSend" width="300" height="186" /></a></td>
<td><a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaColor/" target="_blank"><img class=" alignnone" title="SomaCore Flash AS3 Demo" src="/blog/source/somacore/demo/Flash/SomaColor/preview.jpg" alt="SomaCore Flash AS3 Demo" width="300" height="186" /></a></td>
</tr>
<tr>
<td><a href="http://www.soundstep.com/blog/source/somacore/demo/Flex/CafeTownSend/" target="_blank">View Demo</a><br />
<a href="http://www.soundstep.com/blog/source/somacore/demo/Flex/CafeTownSend/srcview" target="_blank">View Source</a><br />
<a href="http://www.soundstep.com/blog/source/somacore/demo/Flex/CafeTownSend/srcview/SomaCafeTownSend.zip" target="_blank">Download Source</a></td>
<td><a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaColor/" target="_blank">View Demo</a><br />
<a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaColor/srcview" target="_blank">View Source</a><br />
<a href="http://www.soundstep.com/blog/source/somacore/demo/Flash/SomaColor/srcview/SomaColor.zip" target="_blank">Download Source</a></td>
</tr>
</tbody>
</table>
<p>This is a very early state, this Framework has not been used yet in a real project beside the demos above. Have a look and please comment what you feel is good or wrong in the core concept.</p>
<p>Romu</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/10/06/mvc-design-philosophy/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Soma MVC v2.0.2 minor update</title>
		<link>http://www.soundstep.com/blog/2009/09/07/soma-mvc-v2-0-2-minor-update/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=soma-mvc-v2-0-2-minor-update</link>
		<comments>http://www.soundstep.com/blog/2009/09/07/soma-mvc-v2-0-2-minor-update/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 12:55:07 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=362</guid>
		<description><![CDATA[A minor update for Soma and SomaUI, mostly bug fixes. The source are available available on the SomaUI page. SomaUI v2.0.2 -bug fixed: page selection in the page tab wasn&#8217;t working properly -bug fixed: layout tab and layout properties wasn&#8217;t correctly updating the XML -bug fixed: Flash Player wasn&#8217;t correctly updated in Page Settings tab [...]]]></description>
			<content:encoded><![CDATA[<p>A minor update for Soma and SomaUI, mostly bug fixes. The source are available available on the <a href="http://www.soundstep.com/blog/downloads/somaui" target="_self">SomaUI page</a>.</p>
<p><strong>SomaUI v2.0.2</strong></p>
<p>-bug fixed: page selection in the page tab wasn&#8217;t working properly<br />
-bug fixed: layout tab and layout properties wasn&#8217;t correctly updating the XML<br />
-bug fixed: Flash Player wasn&#8217;t correctly updated in Page Settings tab when opening a project<br />
-update: new page auto-name renamed to Page1, Page2, etc<br />
-update: Soma v2.0.2</p>
<p><strong>Soma v2.0.2</strong></p>
<p>-bug fixed: layout with a background alpha 0 wasn&#8217;t displayed</p>
<p>Note: to update sources already exported with a version 2.0.x, just grab the com.soma package (or SWC) and replace, or in SomaUI, in the export tab and under Soma Framework, select &#8220;overwrite all&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/09/07/soma-mvc-v2-0-2-minor-update/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Soma MVC MovieClip Page Mode video tutorial</title>
		<link>http://www.soundstep.com/blog/2009/09/02/soma-mvc-movieclip-page-mode-video-tutorial/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=soma-mvc-movieclip-page-mode-video-tutorial</link>
		<comments>http://www.soundstep.com/blog/2009/09/02/soma-mvc-movieclip-page-mode-video-tutorial/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 15:11:23 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=356</guid>
		<description><![CDATA[Here is a new Video Tutorial about the MovieClip Page Mode in Soma, it might remind you the Flash Catalyst workflow. This mode is only for Flash IDE user. I&#8217;m creating a designed site in few minutes by importing Photohop Files in MovieClip that wll be managed by Soma. The PageManager will instantiate MovieClip instead [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a new Video Tutorial about the MovieClip Page Mode in Soma, it might remind you the Flash Catalyst workflow. This mode is only for Flash IDE user. I&#8217;m creating a designed site in few minutes by importing Photohop Files in MovieClip that wll be managed by Soma.</p>
<p>The PageManager will instantiate MovieClip instead or pure actionscript class. It is a very useful mode if you want to build your site with the Flash IDE with a minimum of code, and very quickly.</p>
<p><a href="http://www.soundstep.com/blog/source/somaui/tutorials/page-mode-movieclip/" target="_blank"><img title="SomaUI MovieClip Page Mode Video Tutorial" src="http://www.soundstep.com/blog/source/somaui/tutorials/page-mode-movieclip/preview.jpg" alt="SomaUI MovieClip Page Mode Video Tutorial" align="top" /></a></p>
<p><br clear="all"/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/09/02/soma-mvc-movieclip-page-mode-video-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Soma MVC minor update 2.0.1</title>
		<link>http://www.soundstep.com/blog/2009/09/01/soma-mvc-minor-update-2-0-1/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=soma-mvc-minor-update-2-0-1</link>
		<comments>http://www.soundstep.com/blog/2009/09/01/soma-mvc-minor-update-2-0-1/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 17:57:42 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=353</guid>
		<description><![CDATA[New version available (v2.0.1), small bugs solved with the Page Manager. Here is how I will update Soma and SomaUI. There is 3 numbers in the version number: 1. the first is a major update, where possibly everything change, probably not usable with previous sources. 2. the second is a medium update, the structure might [...]]]></description>
			<content:encoded><![CDATA[<p>New version available (v2.0.1), small bugs solved with the Page Manager.</p>
<p>Here is how I will update Soma and SomaUI. There is 3 numbers in the version number:</p>
<p>1. the first is a major update, where possibly everything change, probably not usable with previous sources.<br />
2. the second is a medium update, the structure might slightly change and it might need refinement to match with a previous medium version.<br />
3. the third is a minor update, totally transparent for the user, you can update the framework and the generator without breaking what you have already done.</p>
<p>So this is a minor update, meaning it doesn&#8217;t change anything for what you are doing. You can just update the framework and the generator. SVN and source (zip) have been updated, you can get them in the <a href="http://www.soundstep.com/blog/downloads/somaui/" target="_self">SomaUI page</a>.</p>
<p>Romu</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/09/01/soma-mvc-minor-update-2-0-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Soma MVC tips and tutorials</title>
		<link>http://www.soundstep.com/blog/2009/08/24/soma-mvc-tips-and-tutorials/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=soma-mvc-tips-and-tutorials</link>
		<comments>http://www.soundstep.com/blog/2009/08/24/soma-mvc-tips-and-tutorials/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 14:39:56 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=347</guid>
		<description><![CDATA[Beside having Soma Protest to learn how Soma MVC is working, I will add in the future (to the Google code wiki) some tutorials and tips that will help you during your development. I will also &#8220;centralized&#8221; any Video Tutorial I will make in this wiki. First one today, how to control the page flow [...]]]></description>
			<content:encoded><![CDATA[<p>Beside having <a href="http://www.soundstep.com/somaprotest" target="_blank">Soma Protest</a> to learn how Soma MVC is working, I will add in the future (to the <a href="http://code.google.com/p/somamvc/w/" target="_blank">Google code wiki</a>) some tutorials and tips that will help you during your development.</p>
<p>I will also &#8220;centralized&#8221; any <a href="http://www.soundstep.com/blog/source/somaui/tutorials/getting-started/" target="_blank">Video Tutorial</a> I will make in this wiki.</p>
<p>First one today, <a href="http://code.google.com/p/somamvc/wiki/ControlPageFlow" target="_blank">how to control the page flow in Soma</a>.</p>
<p>Romu</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/08/24/soma-mvc-tips-and-tutorials/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Soma v2 AS3 MVC Framework released!</title>
		<link>http://www.soundstep.com/blog/2009/08/21/soma-v2-as3-mvc-framework-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=soma-v2-as3-mvc-framework-released</link>
		<comments>http://www.soundstep.com/blog/2009/08/21/soma-v2-as3-mvc-framework-released/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 13:13:45 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=334</guid>
		<description><![CDATA[I finally release the version 2 of the framework Soma MVC and its source code generator SomaUI. It has been a long run since the last release, months of works and nights spent to make your life easier! But here we are. Firstly, I&#8217;d like to thanks Less Rain. Not only they are amazing and [...]]]></description>
			<content:encoded><![CDATA[<p>I finally release the version 2 of the framework Soma MVC and its source code generator SomaUI. It has been a long run since the last release, months of works and nights spent to make your life easier! But here we are.</p>
<p>Firstly, I&#8217;d like to thanks <a href="http://www.lessrain.com/" target="_blank">Less Rain</a>. Not only they are amazing and skilled people, but they also have been very supportive to me. Thanks again!</p>
<p>Soma v2 have been already used for many projects and it has been a joy to work with it. I first built this framework for myself, as a tool. I wouldn&#8217;t release it if I didn&#8217;t think that Soma could help you with a minimum of learning and &#8220;framework fights&#8221;, and I hope&#8230; with a lot of fun!</p>
<p>If the concept, compare to the version 2, is similar, a lot have been improved and added.</p>
<h3><strong>First a SomaUI demo!</strong></h3>
<p>SomaUI is a tool that is generate source code, a Flash site based on Soma.</p>
<p><a href="http://www.soundstep.com/blog/source/somaui/tutorials/getting-started/" target="_blank"><img title="SomaUI Getting Started Video Tutorial" src="http://www.soundstep.com/blog/source/somaui/tutorials/getting-started/preview.jpg" alt="SomaUI Getting Started Video Tutorial" align="top" /></a></p>
<p><br clear="all"/></p>
<h3><strong>Soma, the AS3 MVC Framework</strong></h3>
<p>The framework is more consistent and is simpler to use, ease of use has always been my goal. And for this, the transitions proxies don&#8217;t exist anymore and the template system has been removed.</p>
<p>Paradoxically, the framework is a lot more powerful and stronger that the version 1, especially in terms of automation.</p>
<p><strong>What&#8217;s new?</strong></p>
<p>Some libraries have been added and they can also be used without the framework, such as a loader library <a href="http://www.soundstep.com/blog/downloads/somaloader/" target="_blank">SomaLoader</a> (already released as a standalone) to manage loading processes, queue management and loading display.</p>
<p>I also built a video player &#8220;SomaVideoPlayer&#8221; (not released yet as a standalone), very easy to use and with a powerful skin system to alter built-in controls or create new ones.</p>
<p>I also built an <a href="http://www.soundstep.com/somaprotest/www/#/assets/" target="_blank">assets system</a> to dynamically create images, video, or anything, positioned them, describe layout behaviors, and a lot more&#8230; and just from an XML file, no code required! The process is amazingly quick. For example to create a video player on screen, it takes not more than a single XML node. This assets system can be used to dynamically create your own assets (custom display objects) at run-time from an XML.</p>
<p>There a new special &#8220;page mode movieclip&#8221; that works with the Flash IDE, that can make simple development of a whole site a matter of minutes (depending on what you want you want to reach). This will be my next tutorial.</p>
<p>I&#8217;ve never wanted Soma to impose rules to a developer, at least not too much. A big point in Soma (and SomaUI), it is never handling physical files or assets files. You can still embed images, fonts or anything the way you like (with SWC, in Flash IDE, metadata tags, or whatever). I did break some encapsulation rules though, and it was to reach a very high level of freedom and flexibility.</p>
<h3><strong>SomaUI, the source code generator</strong></h3>
<p>The first version has always been in beta and was more a kind of &#8220;concept&#8221;.</p>
<p>The version 2 is going a lot further and its purpose is:</p>
<p>- building an XML file required in order to make Soma working<br />
- exporting deploy files (html, css, etc)<br />
- exporting source (actinscript, Flash file, XML, etc)<br />
- compile with the Flex SDK</p>
<p>If you know how to build the XML file that is required by Soma, you can avoid to use SomaUI. So the whole point of SomaUI is helping you building that XML and create files to spare time.</p>
<p>Through screens you can set up your project, configure it, create pages, create assets, backgrounds, and export!</p>
<h3><strong>Finally</strong></h3>
<p>I hope you will have nice time with those tools. To download the sources, get the documentation, samples, explanation or more help&#8230; everything is starting on the <a href="http://www.soundstep.com/blog/downloads/somaui/" target="_self">SomaUI Page</a>.</p>
<p>Any feedback (good or bad) are always welcomed!</p>
<p>Happy development!</p>
<p>Romu</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/08/21/soma-v2-as3-mvc-framework-released/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>SomaUI v2 small update</title>
		<link>http://www.soundstep.com/blog/2009/08/18/somaui-v2-small-update/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somaui-v2-small-update</link>
		<comments>http://www.soundstep.com/blog/2009/08/18/somaui-v2-small-update/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 07:22:45 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=318</guid>
		<description><![CDATA[Hi, Small update about my work on SomaUI v2 and Soma v2. I can say that: - Soma v2 is done (the as3 framework) - Soma Documentation is done (asdoc) - Soma Protest is ready (site demo) - SomaUI v2 is done (the source generator, AIR-java application) - SomaUI Demo is done (a SomaUI project [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>Small update about my work on SomaUI v2 and Soma v2. I can say that:</p>
<p>- Soma v2 is done (the as3 framework)<br />
- Soma Documentation is done (asdoc)<br />
- Soma Protest is ready (site demo)<br />
- SomaUI v2 is done (the source generator, AIR-java application)<br />
- SomaUI Demo is done (a SomaUI project demo)</p>
<p>It has been a huge amount of work, especially with the generator, I can&#8217;t count the nights I passed on it. But we&#8217;re almost there. I&#8217;ve already used the framework and generator on many projects here at <a href="http://www.lessrain.com/" target="_blank">Less Rain</a>.</p>
<p>So good news, the framework is (I think and hope) very enjoyable. I always had fun with it and it made my life far easier on common tasks.</p>
<p>The last step before I release the v2 is a screencast to get you started with the new generator. I should be able to do that this week.</p>
<p>Thanks for following me!</p>
<p>Romu</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/08/18/somaui-v2-small-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac and SVN to merge folder</title>
		<link>http://www.soundstep.com/blog/2009/07/21/mac-and-svn-to-merge-folder/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mac-and-svn-to-merge-folder</link>
		<comments>http://www.soundstep.com/blog/2009/07/21/mac-and-svn-to-merge-folder/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 13:50:14 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[data management]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=310</guid>
		<description><![CDATA[This is not Flash related but I had to post something about as I&#8217;m really annoyed. I&#8217;m now working all the time on Mac, I believe I couldn&#8217;t bear anymore spywares and other Windows annoyances. Anyway, I&#8217;m almost fine on the Mac but there&#8217;s one thing I can&#8217;t understand is that they didn&#8217;t implement a [...]]]></description>
			<content:encoded><![CDATA[<p>This is not Flash related but I had to post something about as I&#8217;m really annoyed. I&#8217;m now working all the time on Mac, I believe I couldn&#8217;t bear anymore spywares and other Windows annoyances.</p>
<p>Anyway, I&#8217;m almost fine on the Mac but there&#8217;s one thing I can&#8217;t understand is that they didn&#8217;t implement a &#8220;merge folders&#8221; capability when you copy and paste something. On a Mac, if you copy a source folder containing folder and files to paste it to a target folder, if you choose replace, the content of the folders will disappear and be replaced by the source. meaning if you have files on the folder target that doesn&#8217;t exist in the source folder, they will just disappear. On Windows, it asks you if you want to overwrite or not because anyway, it is always going to merge.</p>
<p>I could use the Unix command ditto and the terminal, but wow, how is it possible something as simple as that is not implemented? People from windows will know what I&#8217;m talking about. Actually, there&#8217;s a lot people complaining and tons of app that does the job.</p>
<p>So I tried to find a simple and quick app, which actually wasn&#8217;t really easy as they all want to merge the content of the files. I don&#8217;t want to do that at all, that&#8217;s more a code matter to merge the content of a file. I found 2 or 3 that does the job but kind of heavy for such a common task, I want to do that as quickly as I could do on windows.</p>
<p>The best I found is: <a href="http://scriptbuilders.net/files/mergefolders1.0.1.html" target="_blank">Merge Folders</a></p>
<p>You select the source, the target, if you want to overwrite and that&#8217;s it. Perfect? Almost&#8230;</p>
<p>My problem was mostly related to SVN, copy file from local copy to other local copy, or whatever. This app would have been perfect if I could choose &#8220;include hidden files, yes or not&#8221;.</p>
<p>So I need first to export a package not to have the hidden folders .svn and then merge my exported copy to a repo or local copy. That&#8217;s ok but again, on a Mac, things are not that easy when it comes to development, maybe I passed too much time on Windows? I&#8217;m sorry but Windows and tortoiseSVN is kind of wonderful compare to a what I get on the Mac. So as I can&#8217;t make an export with the &#8220;SVN-finder-integrated&#8221; (<a href="http://scplugin.tigris.org/" target="_blank">scplugin</a>), I use mostly SynchroSVN, great but still a lot slower than on Windows. When you have some delicate actions to make like merging branches, tortoiseSVN on Windows is really great.</p>
<p>I&#8217;m sure some of you have the same problem, what are you solutions? What do you use? Is there something simple and quick that I missed?</p>
<p>Romu</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/07/21/mac-and-svn-to-merge-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make Flash Switcher working</title>
		<link>http://www.soundstep.com/blog/2009/07/17/make-flash-switcher-working/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=make-flash-switcher-working</link>
		<comments>http://www.soundstep.com/blog/2009/07/17/make-flash-switcher-working/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 14:28:49 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=303</guid>
		<description><![CDATA[Flash Switcher Firefox extension allows you to easily switch from one flash player version to another. It works great but unfortunately only after some tweaking. Flash Switcher still works with the last Firefox version, at the time I&#8217;m talking (Firefox 3.5). There are already some posts about Vista and Flash Switcher, to solve some bugs [...]]]></description>
			<content:encoded><![CDATA[<p>Flash Switcher Firefox extension allows you to easily switch from one flash player version to another. It works great but unfortunately only after some tweaking. Flash Switcher still works with the last Firefox version, at the time I&#8217;m talking (Firefox 3.5).</p>
<p>There are already some posts about Vista and Flash Switcher, to solve some bugs that are related to folders permissions. I had some trouble to find the folders on Mac and as I still see people asking how to make it work, I&#8217;m going to tell you the paths and what to do on Vista and Mac.</p>
<p>First you can install Flash Switcher there:<br />
<a href="http://www.sephiroth.it/firefox/flash_switcher/" target="_blank">http://www.sephiroth.it/firefox/flash_switcher/</a></p>
<p>Restart Firefox.</p>
<p>You need to change the permissions on some folders before you start using it. On the following folders, right click + get info on Mac and right click + properties on windows, and give full access. Your paths will be different, those ones contains my user name and generated Firefox profile string, but you&#8217;ll find out.</p>
<p><strong>Vista</strong></p>
<p>Plugin path:<br />
<i>C:\Windows\System32\Macromed</i></p>
<p>Firefox Plugin path:<br />
<i>C:\Users\romuald\AppData\Roaming\Mozilla\Firefox\Profiles\squnf11y.default\extensions\flash_switcher@sephiroth.it\plugins\win</i></p>
<p><strong>Mac</strong></p>
<p>Plugin path:<br />
<i>/Library/Internet Plug-Ins</i></p>
<p>Firefox Plugin path:<br />
<i>/Users/romuald/Library/Application Support/Firefox/Profiles/9ly9womf.default/extensions/flash_switcher@sephiroth.it/plugins/mac</i></p>
<p>Once done, click on the Flash Switcher icon in the status bar. Save your current Flash Player (or it will be removed the first time you use it, I don&#8217;t know why), by selecting it and click on &#8220;save as&#8221;.</p>
<p>Now it should just work, at least that&#8217;s what I&#8217;ve done this morning and it is working for me. You should get a javascript alert saying &#8220;ok, the new plugin has been installed&#8221;, or something similar. And if you still get an error, it is probably still the paths permissions, try to re-apply the permissions (I had to do it twice, don&#8217;t ask me why).</p>
<p>To get more players in the list, just uninstall and install other versions, or you can get the plugins files straight from there:</p>
<p><a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14266&amp;sliceId=2" target="_blank">Archive Flash Players</a></p>
<p>Hope it helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/07/17/make-flash-switcher-working/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SomaUI v2 Beta Testing</title>
		<link>http://www.soundstep.com/blog/2009/07/08/somaui-v2-beta-testing/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somaui-v2-beta-testing</link>
		<comments>http://www.soundstep.com/blog/2009/07/08/somaui-v2-beta-testing/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 10:00:44 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=297</guid>
		<description><![CDATA[Hi everyone, As I&#8217;m close to release Soma v2 (AS3 MVC Framework) and SomaUI v2 (application to generate actionscript source code and deploy files based on Soma), I&#8217;d like to share an earlier version with some beta-testers who are interested to help me debug both the framework and the generator. Mac and Windows available, I [...]]]></description>
			<content:encoded><![CDATA[<p>Hi everyone,</p>
<p>As I&#8217;m close to release Soma v2 (AS3 MVC Framework) and SomaUI v2 (application to generate actionscript source code and deploy files based on Soma), I&#8217;d like to share an earlier version with some beta-testers who are interested to help me debug both the framework and the generator.</p>
<p>Mac and Windows available, I didn&#8217;t have time to make the Linux one. The generator is in a beta state but the framework and code generated are pretty stable as it has been already used many times in real projects.</p>
<p>I will not send it to everyone, or I will not have time to manage this properly (depending of the feedback), sorry about that.</p>
<p>You can <a href="http://www.soundstep.com/blog/contact/" target="_self">drop me an email</a> from this blog to ask me. Please, participate only to give me a hand and by helping me with your feedback and bug reports. I can provide support, depending of my time if you wish to use it for real projects. For the curious, just be patient, the release will available very soon <img src='http://www.soundstep.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Thanks and, happy development!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/07/08/somaui-v2-beta-testing/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Hexosearch Actionscript search engine</title>
		<link>http://www.soundstep.com/blog/2009/07/06/hexosearch-actionscript-search-engine/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hexosearch-actionscript-search-engine</link>
		<comments>http://www.soundstep.com/blog/2009/07/06/hexosearch-actionscript-search-engine/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 10:24:23 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[as2]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=289</guid>
		<description><![CDATA[I found a nice actionscript search engine: http://www.hexosearch.com/ It looks like a beta for now, but I like the concept. Basically you can register your blog so the search engine will easily find actionscript talks. You can even choose AS2, AS3 or Flex. Worth trying By the way, if some of you want a bit [...]]]></description>
			<content:encoded><![CDATA[<p>I found a nice actionscript search engine:</p>
<p><a href="http://www.hexosearch.com/" target="_blank">http://www.hexosearch.com/</a></p>
<p>It looks like a beta for now, but I like the concept. Basically you can register your blog so the search engine will easily find actionscript talks. You can even choose AS2, AS3 or Flex.</p>
<p>Worth trying <img src='http://www.soundstep.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>By the way, if some of you want a bit more (direct) news about my work, and probably Soma, I&#8217;m trying to tweet a bit!</p>
<p><a href="http://twitter.com/soundstep" target="_blank">http://twitter.com/soundstep</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/07/06/hexosearch-actionscript-search-engine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Neoderma release and Soma v2 progress</title>
		<link>http://www.soundstep.com/blog/2009/04/06/neoderma-release-and-soma-v2-progress/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=neoderma-release-and-soma-v2-progress</link>
		<comments>http://www.soundstep.com/blog/2009/04/06/neoderma-release-and-soma-v2-progress/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 16:32:31 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=284</guid>
		<description><![CDATA[Hi everyone, I&#8217;ve been working on the version 2 of Soma and its generator. I&#8217;m pretty busy so I didn&#8217;t post for a while, but I&#8217;m going to give you some news today. We&#8217;ve just released at Less Rain the Neoderma international website. It is not a &#8220;crazy-kick-your-ass-3D-website&#8221;, nothing is complicated there, but it has [...]]]></description>
			<content:encoded><![CDATA[<p>Hi everyone,</p>
<p>I&#8217;ve been working on the version 2 of <a href="http://www.soundstep.com/somaprotest/" target="_blank">Soma</a> and its generator. I&#8217;m pretty busy so I didn&#8217;t post for a while, but I&#8217;m going to give you some news today.</p>
<p>We&#8217;ve just released at <a href="http://www.lessrain.com/" target="_blank">Less Rain</a> the <a href="http://www.neoderma.com/" target="_blank">Neoderma international website</a>. It is not a &#8220;crazy-kick-your-ass-3D-website&#8221;, nothing is complicated there, but it has a very nice and clean &#8220;look and feel&#8221; and a complex CMS where everything can be changed (structure, content, animations, language, and so on). The content is pretty big so it is a complicated site in terms of data. Neoderma is a multi-language site (translations are not done yet but will appear in the future).</p>
<p>I&#8217;m talking about Neoderma here because it has fully been built with <a href="http://www.soundstep.com/somaprotest/" target="_blank">Soma</a> v1 and the framework has been a great help (and also a joy) to keep a strong and solid structure. Soma has been very effective in responding to (almost) whatever I needed, and because <a href="http://www.soundstep.com/somaprotest/" target="_blank">Soma</a> is very flexible, it worked perfectly with a site where everything can be  changed via a CMS.</p>
<p>I&#8217;m not allowed to give any source code of course, but I can advice Soma users if they wonder how to do something. Soma v1 is lacking documentation and examples but this will be greatly improved in the v2.</p>
<p>About the v2 I&#8217;m working on, it is in a pretty good shape. The framework is almost done. I&#8217;ll make the full documentation before releasing it. It is easier to use and more consistent, not at all completely different though. Templates disappeared as we could do without them, a real node parser has been built to dynamically instantiate classes (custom or built-in) straight from the XML, a new page mode appears for Flash IDE users making you able to build something in no time, <a href="http://www.soundstep.com/blog/downloads/somaloader/" target="_self">SomaLoader</a> implemented, and more features we&#8217;ll see at the release.</p>
<p><a href="http://www.soundstep.com/blog/downloads/somaui/" target="_self">SomaUI</a>, the generator is done at 80% and will make you able to build the XML Site definition with a friendly user interface, as well as exporting and compile the sources created. You&#8217;ll even be able to build something very quickly from SomaUI, without knowing the framework and opening a documentation.</p>
<p>Thanks for your patience, it is on its way <img src='http://www.soundstep.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Hopefully, I&#8217;ll post more if I can get a bit more time!</p>
<p>Happy development.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/04/06/neoderma-release-and-soma-v2-progress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SomaLoader release</title>
		<link>http://www.soundstep.com/blog/2009/03/03/somaloader-release/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somaloader-release</link>
		<comments>http://www.soundstep.com/blog/2009/03/03/somaloader-release/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 01:49:30 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=277</guid>
		<description><![CDATA[SomaLoader is a lightweight loading manager written in AS3. You can load many types such as images, swf, xml, text, xml, css, fonts in a swf, mp3, variables and binary data. Items can be added, removed and changed in position from the queue even while loading. SomaLoader provides a simple and unique interface for massive [...]]]></description>
			<content:encoded><![CDATA[<p>SomaLoader is a lightweight loading manager written in AS3. You can load many types such as images, swf, xml, text, xml, css, fonts in a swf, mp3, variables and binary data. Items can be added, removed and changed in position from the queue even while loading.</p>
<p>SomaLoader provides a simple and unique interface for massive loading, to listen to events and access to data.</p>
<p>SomaLoader has some specific features such as targeting before loading, easy loading progress display, caching system and binary loading for &#8220;silent loading&#8221;.</p>
<p>I&#8217;m working on the version 2 of <a href="http://www.soundstep.com/blog/downloads/somaui/">Soma (AS3 MVC Flash Framework)</a> and SomaLoader will be part of the framework, this is a pre-release as it can be used as a standalone.</p>
<p>More information on the <a href="http://www.soundstep.com/blog/downloads/somaloader/">SomaLoader page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/03/03/somaloader-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Soma 1.6.4 and urlfriendly</title>
		<link>http://www.soundstep.com/blog/2009/01/27/soma-164-and-urlfriendly/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=soma-164-and-urlfriendly</link>
		<comments>http://www.soundstep.com/blog/2009/01/27/soma-164-and-urlfriendly/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 16:33:22 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=260</guid>
		<description><![CDATA[I&#8217;ve made a minor update that brings us to Soma 1.6.4 and SomaUI 1.0.6, you can get the new versions from the SomaUI page. In the XML Site Definition, the attribute urlfriendly in a page node builds the URL for the deep-linking and in previous version this attribute had to be unique through the XML. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve made a minor update that brings us to Soma 1.6.4 and SomaUI 1.0.6, you can get the new versions from the <a href="http://www.soundstep.com/blog/downloads/somaui/">SomaUI page</a>.</p>
<p>In the XML Site Definition, the attribute urlfriendly in a page node builds the URL for the deep-linking and in previous version this attribute had to be unique through the XML. It is no longer the case, you can now have identical parts in the URL.</p>
<p>This wasn&#8217;t possible before:</p>
<p>/#/page1/common-urlfriendly/</p>
<p>/#/page2/common-urlfriendly/</p>
<p>/#/page3/common-urlfriendly/</p>
<p>Only the PageManager changed, you can update your sources from the previous version without problem.</p>
<p>And by the way, from now, I&#8217;ll be release only minor update for Soma and SomaUI as I&#8217;m working on the v2 for both of them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/01/27/soma-164-and-urlfriendly/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SomaText update and TextField bad behavior</title>
		<link>http://www.soundstep.com/blog/2009/01/19/somatext-update-and-textfield-bad-behavior/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somatext-update-and-textfield-bad-behavior</link>
		<comments>http://www.soundstep.com/blog/2009/01/19/somatext-update-and-textfield-bad-behavior/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 19:06:00 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[talking]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[soma]]></category>
		<category><![CDATA[SomaUI]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=256</guid>
		<description><![CDATA[I made a small update in the SomaText class (also Soma and SomaUI) because of a bad behavior with the TextField class. The TextField instance is losing the HTML formatting in case you set the htmlText and then set the multiline property to true (the other way keeps the formatting). To reproduce the behavior: 1. [...]]]></description>
			<content:encoded><![CDATA[<p>I made a small update in the <a href="http://www.soundstep.com/blog/downloads/somatext/" target="_self">SomaText</a> class (also <a href="http://www.soundstep.com/blog/downloads/somaui/">Soma and SomaUI</a>) because of a bad behavior with the TextField class. The TextField instance is losing the HTML formatting in case you set the htmlText and then set the multiline property to true (the other way keeps the formatting).</p>
<p>To reproduce the behavior:</p>
<p>1. create a next TextField instance<br />
2. set some htmlText with formatting (like P and BR)<br />
3. set the multiline property to true</p>
<p>Not a big deal but SomaText solves this behavior (working either way). I&#8217;ve also updated <a href="http://www.soundstep.com/blog/downloads/somaui/">Soma and SomaUI</a> as the framework can process TextField properties in the XML you might have found formatting problems with some SomaUI Templates (or when using the TemplateParser). The <a href="http://www.soundstep.com/somaprotest/" target="_blank">Soma Protest</a> sources are using styles from a CSS, not TextField property in the XML, so no problem).</p>
<p>Anyway, everything should work as expected now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/01/19/somatext-update-and-textfield-bad-behavior/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Soma Tutorial &#8211; From SomaUI to Flash Develop</title>
		<link>http://www.soundstep.com/blog/2009/01/09/soma-tutorial-from-somaui-to-flash-develop/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=soma-tutorial-from-somaui-to-flash-develop</link>
		<comments>http://www.soundstep.com/blog/2009/01/09/soma-tutorial-from-somaui-to-flash-develop/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 12:46:27 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=250</guid>
		<description><![CDATA[Another tutorial but for the Flash Develop users this time. I explain how to create a Flash Develop project and compile the site after exporting a project from SomaUI. The tutorial is available in the SomaUI page or here. Thanks to Keita for this one]]></description>
			<content:encoded><![CDATA[<p>Another tutorial but for the <a href="http://www.flashdevelop.org/" target="_blank">Flash Develop</a> users this time. I explain how to create a Flash Develop<a onclick="javascript:pageTracker._trackPageview('/outgoing/fdt.powerflasher.com/');" href="http://fdt.powerflasher.com/" target="_blank"></a> project and compile the site after exporting a project from SomaUI.</p>
<p>The tutorial is available in the <a href="http://www.soundstep.com/blog/downloads/somaui/" target="_self">SomaUI page</a> or <a href="http://www.soundstep.com/blog/tutorials/somaui/fd-project/" target="_blank">here</a>.</p>
<p>Thanks to <a href="http://labs.hellokeita.com/" target="_blank">Keita</a> for this one <img src='http://www.soundstep.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/01/09/soma-tutorial-from-somaui-to-flash-develop/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Soma Tutorial &#8211; From SomaUI to FDT</title>
		<link>http://www.soundstep.com/blog/2009/01/08/soma-tutorial-from-somaui-to-fdt/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=soma-tutorial-from-somaui-to-fdt</link>
		<comments>http://www.soundstep.com/blog/2009/01/08/soma-tutorial-from-somaui-to-fdt/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 18:11:53 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=237</guid>
		<description><![CDATA[A new tutorial is available for Soma (Flash AS3 MVC Framework), I explain how to create a FDT project in eclipse and compile the site after exporting a project from SomaUI. It also shows you how I use a SWC file as a Flash Library for a pure actionscript project. Hope it is useful for [...]]]></description>
			<content:encoded><![CDATA[<p>A new tutorial is available for Soma (Flash AS3 MVC Framework), I explain how to create a <a href="http://fdt.powerflasher.com/" target="_blank">FDT</a> project in eclipse and compile the site after exporting a project from SomaUI.</p>
<p>It also shows you how I use a SWC file as a Flash Library for a pure actionscript project.</p>
<p>Hope it is useful for all the FDT user (thanks <a href="http://fdt.powerflasher.com/" target="_blank">Powerflasher</a>!).</p>
<p>The tutorial is available in the <a href="http://www.soundstep.com/blog/downloads/somaui/" target="_self">SomaUI page</a> or <a href="http://www.soundstep.com/blog/tutorials/somaui/fdt-project/" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/01/08/soma-tutorial-from-somaui-to-fdt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SomaText standalone</title>
		<link>http://www.soundstep.com/blog/2009/01/07/somatext-standalone/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somatext-standalone</link>
		<comments>http://www.soundstep.com/blog/2009/01/07/somatext-standalone/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 16:54:40 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=217</guid>
		<description><![CDATA[I recently built for my framework Soma a subclass of the TextField Flash built-in class to be able to easily use styles with a textfield: SomaText. I&#8217;ve extracted SomaText from the framework to be able to use it without Soma. It has powerful features such as default values, default stylesheet and styles. SomaText is able [...]]]></description>
			<content:encoded><![CDATA[<p>I recently built  for my framework <a href="http://www.soundstep.com/blog/downloads/somaui/" target="_self">Soma </a>a subclass of the TextField Flash built-in class to be able to easily use styles with a textfield: SomaText.</p>
<p>I&#8217;ve extracted SomaText from the framework to be able to use it without Soma. It has powerful features such as default values, default stylesheet and styles. SomaText is able to parse the stylesheet to apply TextField and TextFormat properties straight from the stylesheet. You can also get a full description of the properties and styles applied by tracing the SomaText instance.</p>
<p>SomaText can be used as a label or as a more complicated TextField with HTML tags.</p>
<p>You will be fine with SomaText as it is extending the TextField class and SomaText also shorten the syntax when you create instances.</p>
<p>You can download the SomaText sources and documentation in the <a href="http://www.soundstep.com/blog/downloads/somatext/" target="_self">SomaText page</a>.</p>
<p>The SomaText standalone is slightly different than the one in the framework (the global stylesheet registration is different), but you can find some explanation in the <a href="http://www.soundstep.com/somaprotest/www/#/stylesheet/" target="_blank">SomaProtest stylesheet page</a>.</p>
<p>See a full list of <a href="http://www.soundstep.com/somaprotest/www/#/stylesheet/css-properties/" target="_blank">CSS properties</a> you can use with SomaText.</p>
<p>As a quick example, here are some SomaText syntax:</p>
<div class="igBar"><span id="lactionscript-203"><a href="#" onclick="javascript:showPlainTxt('actionscript-203'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-203">
<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;">SomaText.<span style="color: #006600;">globalStyleSheet</span> = _globalStylesheetLoaded;</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;">// text</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: #000000; font-weight: bold;">var</span> s1:SomaText = <span style="color: #000000; font-weight: bold;">new</span> SomaText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;simple text&#8221;</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;">addChild<span style="color: #66cc66;">&#40;</span>s1<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: #808080; font-style: italic;">// text with style from the global stylesheet</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> s2:SomaText = <span style="color: #000000; font-weight: bold;">new</span> SomaText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;text with style from the global stylesheet&#8221;</span>, <span style="color: #ff0000;">&#8220;simpleStyle&#8221;</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;">addChild<span style="color: #66cc66;">&#40;</span>s2<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: #808080; font-style: italic;">// text with style from another stylesheet</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: #000000; font-weight: bold;">var</span> s3:SomaText = <span style="color: #000000; font-weight: bold;">new</span> SomaText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;text with style from another stylesheet&#8221;</span>, <span style="color: #ff0000;">&#8220;simpleStyle&#8221;</span>, _customStylesheet<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;">addChild<span style="color: #66cc66;">&#40;</span>s3<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: #808080; font-style: italic;">// multiline text with properties set in actionscript</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> s4:SomaText = <span style="color: #000000; font-weight: bold;">new</span> SomaText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;multiline text with textfield properties modified in the actionscript: width, multiline, wordWrap, selectable, and so on.&#8221;</span>, <span style="color: #ff0000;">&#8220;defaultText&#8221;</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;">s4.<span style="color: #0066CC;">width</span> = <span style="color: #cc66cc;color:#800000;">220</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">s4.<span style="color: #0066CC;">multiline</span> = <span style="color: #000000; font-weight: bold;">true</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;">s4.<span style="color: #0066CC;">wordWrap</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">s4.<span style="color: #0066CC;">selectable</span> = <span style="color: #000000; font-weight: bold;">true</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;">// can be set in the constructor or using the setProperties method:</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;">//s4.setProperties({width: 220, multiline: true, wordWrap: true, selectable: true});</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;">addChild<span style="color: #66cc66;">&#40;</span>s4<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: #808080; font-style: italic;">// multiline text with properties set in the stylesheet</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: #000000; font-weight: bold;">var</span> s5:SomaText = <span style="color: #000000; font-weight: bold;">new</span> SomaText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8220;multiline text with textfield properties set in the stylesheet: width, multiline, word-wrap, selectable, and so on.&#8221;</span>, <span style="color: #ff0000;">&#8220;defaultTextMultiline&#8221;</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;">addChild<span style="color: #66cc66;">&#40;</span>s5<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>And the global stylesheet used:</p>
<div class="igBar"><span id="lcss-204"><a href="#" onclick="javascript:showPlainTxt('css-204'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-204">
<div class="css">
<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: #6666ff;">.defaultTextMultiline </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;"><span style="color: #000000; font-weight: bold;">font-family</span>: <span style="color: #ff0000;">&#8220;Arial&#8221;</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: #000000; font-weight: bold;">font-size</span>: <span style="color: #cc66cc;color:#800000;">11</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;">color</span>: #2C384E;</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;">width</span>: <span style="color: #cc66cc;color:#800000;">220</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">multiline: true;</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;">word-wrap: true;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">selectable: true;</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;">a <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">color</span>: #002F7D;</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;">a<span style="color: #3333ff;">:hover </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;"><span style="color: #000000; font-weight: bold;">color</span>: #5C2E2E;</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;">text-decoration</span>: <span style="color: #993333;">underline</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;"><span style="color: #6666ff;">.simpleStyle </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;"><span style="color: #000000; font-weight: bold;">font-family</span>: <span style="color: #ff0000;">&#8220;Arial&#8221;</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: #000000; font-weight: bold;">font-size</span>: <span style="color: #cc66cc;color:#800000;">16</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;">color</span>: #8DA0C0;</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;"><span style="color: #6666ff;">.defaultText </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;"><span style="color: #000000; font-weight: bold;">font-family</span>: <span style="color: #ff0000;">&#8220;Arial&#8221;</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;">font-size</span>: <span style="color: #cc66cc;color:#800000;">11</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: #000000; font-weight: bold;">color</span>: #2C384E;</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;"><span style="color: #6666ff;">.para </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;"><span style="color: #000000; font-weight: bold;">font-family</span>: <span style="color: #ff0000;">&#8220;Arial&#8221;</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: #000000; font-weight: bold;">font-size</span>: <span style="color: #cc66cc;color:#800000;">18</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;">color</span>: #004040;</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;"><span style="color: #6666ff;">.color1 </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;"><span style="color: #000000; font-weight: bold;">color</span>: #C1540B;</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>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2009/01/07/somatext-standalone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SomaTween proxy for Tweener TweenMax and GTween</title>
		<link>http://www.soundstep.com/blog/2008/12/19/somatween-proxy-for-tweener-tweenmax-and-gtween/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somatween-proxy-for-tweener-tweenmax-and-gtween</link>
		<comments>http://www.soundstep.com/blog/2008/12/19/somatween-proxy-for-tweener-tweenmax-and-gtween/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 14:35:31 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=206</guid>
		<description><![CDATA[SomaTween is a optional tool in the Soma framework to centralize transitions. Soma Tween is not a tween library. It is working with proxy for a real tween library and it makes you able to debug all the transitions of your site in one place. For example you can set to 0 all the times [...]]]></description>
			<content:encoded><![CDATA[<p>SomaTween is a optional tool in the Soma framework to centralize transitions. Soma Tween is not a tween library.</p>
<p>It is working with proxy for a real tween library and it makes you able to debug all the transitions of your site in one place. For example you can set to 0 all the times and delays of your site and be able to see it without transitions or animations.</p>
<p>You can find in the <a href="http://www.soundstep.com/blog/downloads/somaui/" target="_self">Soma source</a> a transitions proxies folder, with 3 transition proxy classes for <a href="http://code.google.com/p/tweener/" target="_blank">Tweener</a>, <a href="http://blog.greensock.com/tweenmaxas3/" target="_blank">TweenMax</a> and <a href="http://gskinner.com/libraries/gtween/" target="_blank">GTween</a>.</p>
<p>More information in the <a href="http://www.soundstep.com/somaprotest/www/#/basics/start-soma/transitions-file/" target="_blank">Transitions proxy page</a> and the <a href="http://www.soundstep.com/somaprotest/www/#/basics/shortcuts/somatween/" target="_blank">SomaTween page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2008/12/19/somatween-proxy-for-tweener-tweenmax-and-gtween/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SomaText and StyleManager</title>
		<link>http://www.soundstep.com/blog/2008/12/17/somatext-and-stylemanager/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=somatext-and-stylemanager</link>
		<comments>http://www.soundstep.com/blog/2008/12/17/somatext-and-stylemanager/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 02:45:52 +0000</pubDate>
		<dc:creator>Romuald</dc:creator>
				<category><![CDATA[SomaUI]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[soma]]></category>

		<guid isPermaLink="false">http://www.soundstep.com/blog/?p=199</guid>
		<description><![CDATA[A StyleManager and SomaText classes have been added to the Soma Framework. You can handle your text fields with external extended stylesheets for a better style management without the need to recompile. SomaText is a class that is extending the Flash built-in class TextField with many features to make you life easier with texts and [...]]]></description>
			<content:encoded><![CDATA[<p>A StyleManager and SomaText classes have been added to the Soma Framework.</p>
<p>You can handle your text fields with external extended stylesheets for a better style management without the need to recompile.</p>
<p>SomaText is a class that is extending the Flash built-in class TextField with many features to make you life easier with texts and styles.</p>
<p>A global default stylesheet can easily be loaded in Soma with a single line.</p>
<p><a href="http://www.soundstep.com/somaprotest/" target="_blank">SomaProtest</a> has been updated, all the texts and styles are managed with a CSS stylesheet. A page explaining how to use the new style and text features is available <a href="http://www.soundstep.com/somaprotest/www/#/stylesheet/" target="_blank">here</a>.</p>
<p>SomaText makes you able to use TextField and TextFormat properties straight from the CSS file, properties such as: embed-fonts, anti-alias-type, auto-size, multiline, font-family, text-decoration, grid-fit-type, and many others.</p>
<p>A full list of properties you can use is available on the <a href="http://www.soundstep.com/somaprotest/www/#/stylesheet/css-properties/" target="_blank">CSS properties page</a>.</p>
<p>Soma, SomaUI, sources and the SVN have been updated on the <a href="http://www.soundstep.com/blog/downloads/somaui/" target="_self">SomaUI page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundstep.com/blog/2008/12/17/somatext-and-stylemanager/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

