<?xml version="1.0" encoding="UTF-8"?>
<rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>FlashFuck.it</title>
	
	<link>http://www.flashfuck.it</link>
	<description>flash platform, gaming and 3D</description>
	<lastBuildDate>Thu, 12 Aug 2010 10:34:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/FlashFuckIt" /><feedburner:info uri="flashfuckit" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Install Flash Switcher extension on unsupported versions of Firefox</title>
		<link>http://feedproxy.google.com/~r/FlashFuckIt/~3/csFeJvHZCho/</link>
		<comments>http://www.flashfuck.it/2010/08/12/install-flash-switcher-extension-on-unsupported-versions-of-firefox/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 10:28:37 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=181</guid>
		<description><![CDATA[Today I had to install the must-have flash switcher extension for firefox (by Alessandro Crugnola) and I found that it&#8217;s not compatible with firefox versions after 3.0 &#8230; I trust in sephiroth&#8217;s extension going to work properly even in unsupported firefox versions, and however it&#8217;s worth the attempt, so, how to install it anyway? First [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had to install the must-have <a href="https://addons.mozilla.org/en-US/firefox/addon/5044/">flash switcher extension for firefox</a> (by <a href="http://www.sephiroth.it/">Alessandro Crugnola</a>) and I found that it&#8217;s not compatible with firefox versions after 3.0 &#8230;</p>
<p>I trust in sephiroth&#8217;s extension going to work properly even in unsupported firefox versions, and however it&#8217;s worth the attempt, so, how to install it anyway?</p>
<p style="text-align: center;"><img class="size-medium wp-image-182 aligncenter" title="ffflsh" src="http://www.flashfuck.it/wp-content/uploads/2010/08/ffflsh-300x157.png" alt="" width="300" height="157" /></p>
<p>First of all, download the flash switcher extension from the mozilla addons site ( https://addons.mozilla.org/en-US/firefox/addon/5044/ ) and save it on your hard drive.</p>
<p>Now that you have the .xpi file rename it to .zip and decompress it, you&#8217;re getting a <em>plugin</em> and <em>content</em> folders, <em>chrome.manifest</em> and <em>install.rdf</em> files.</p>
<p>Open install.rdf with a text editor and examine this tag</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p181code2'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1812"><td class="code" id="p181code2"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;RDF:Description</span> <span style="color: #000066;">RDF:about</span>=<span style="color: #ff0000;">&quot;rdf:#$uFrJ3&quot;</span></span>
<span style="color: #009900;">                   <span style="color: #000066;">em:id</span>=<span style="color: #ff0000;">&quot;{ec8030f7-c20a-464f-9b0e-13a3a9e97384}&quot;</span></span>
<span style="color: #009900;">                   <span style="color: #000066;">em:minVersion</span>=<span style="color: #ff0000;">&quot;3.0a1&quot;</span></span>
<span style="color: #009900;">                   <span style="color: #000066;">em:maxVersion</span>=<span style="color: #ff0000;">&quot;3.0pre&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>here min and max versions are defined for the extension, so just change em:maxVersion from 3.0pre to 3.8 (or whatever) and save the file.</p>
<p>Now select all files and folders (not the parent folder!!!) (plugin, content, chrome.manifest, install.rdf) and zip all together, then change the extension from .zip to .xpi.</p>
<p>Open firefox, File>Open, browse to the .xpi file, install&#8230; done and working!! w00t! <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>My unsupported (but properly working) version of firefox is 3.6.8, the flash switcher extension version is 2.0.2.</p>
<p>enjoy <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2010/08/12/install-flash-switcher-extension-on-unsupported-versions-of-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.flashfuck.it/2010/08/12/install-flash-switcher-extension-on-unsupported-versions-of-firefox/</feedburner:origLink></item>
		<item>
		<title>Air 2 Multitouch and YouTube subtitles failure</title>
		<link>http://feedproxy.google.com/~r/FlashFuckIt/~3/gu1r4sH9Td4/</link>
		<comments>http://www.flashfuck.it/2010/04/27/air-2-multitouch-and-youtube-subtitles-failure/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 12:52:05 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[AIR]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=174</guid>
		<description><![CDATA[I just found a very exciting demo from Ryan Stewart on how to mash up Google Maps 3D APIs and Air 2 multitouch gestures. You can find his experiment&#8217;s source code on his blog here with a great video demo. By the way, I started looking at the video from YouTube and noticed a new [...]]]></description>
			<content:encoded><![CDATA[<p>I just found a very exciting demo from <a href="http://blog.digitalbackcountry.com">Ryan Stewart</a> on how to mash up Google Maps 3D APIs and Air 2 multitouch gestures.<br />
You can find his experiment&#8217;s source code on his blog <a href="http://blog.digitalbackcountry.com/2010/04/air-2-multitouch-gestures-and-the-3d-google-maps-flash-api/">here</a> with a great video demo.</p>
<p><img src="http://www.flashfuck.it/wp-content/uploads/2010/04/Screen-shot-2010-04-27-at-14.52.12-300x191.png" alt="" title="Ryan Stewart on Iraq war" width="300" height="191" class="alignnone size-medium wp-image-176" /></p>
<p>By the way, I started looking at <a href="http://www.youtube.com/watch?v=VLvURtka3TY">the video from YouTube</a> and noticed a new awesome feature: audio transcription and audio translation! w00t!<br />
I tried out that wonderful piece of technology. I am Italian, so I tried to translate it on the fly&#8230;the result was ASTONISHING: no word was translated correctly, no sentence had a real meaning, if you run a Math.random() on the italian dictionary and start making a speech you&#8217;re likely having something better.</p>
<p>I guessed the problem was with the translation, but I was wrong :\<br />
at 1&#8217;46&#8221; you can find out that &#8220;To change the rules the perspective of a man San Diego freemen will concede you and all of the police on the street is the ability to going to fly over the map, she&#8217;s the perspective&#8221;&#8230; wtf!?<br />
at 2&#8217;25&#8221; is even better: &#8220;but combining the there to gestures and grownups three the FBI a critic of the Iraq war unique way to browse and that&#8217;s really true that Bosnia really customize how the contents of the views that no one of the three demoted from a player and disturbing experience&#8221;&#8230;.</p>
<p>Cool! An Adobe evangelist talking about Iraq war, FBI and Bosnia while free men will concede to you in San Diego&#8230;<br />
Please, don&#8217;t trust that feature.<br />
#google #fail</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2010/04/27/air-2-multitouch-and-youtube-subtitles-failure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.flashfuck.it/2010/04/27/air-2-multitouch-and-youtube-subtitles-failure/</feedburner:origLink></item>
		<item>
		<title>Speaking at IGDA Switzerland 25th february 2010</title>
		<link>http://feedproxy.google.com/~r/FlashFuckIt/~3/DNyJ0B40poE/</link>
		<comments>http://www.flashfuck.it/2010/02/08/speaking-at-igda-switzerland-25th-february-2010/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 09:25:56 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Speaking]]></category>
		<category><![CDATA[igda]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=172</guid>
		<description><![CDATA[I&#8217;ll be speaking at IGDA Switzerland in Bern in few weeks, a great opportunity for me to talk about the Flash Platform as a gaming platform, to share the experience I had making the engine of Wazzamba and to meet new people I only &#8220;met&#8221; in twitter or in their blogs The meeting will take [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be speaking at <a href="http://www.igda.ch">IGDA Switzerland</a> in Bern in few weeks,<br />
<img src="http://www.igda.org/sites/all/themes/igda_black/logo.png" alt="Piergiorgio Niero IGDA Switzerland" /><br />
a great opportunity for me to talk about the Flash Platform as a gaming platform, to share the experience I had making the engine of <a href="http://www.wazzamba.com">Wazzamba</a> and to meet new people I only &#8220;met&#8221; in twitter or in their blogs <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The meeting will take place in february 25th at &#8220;<a href="http://www.nothing.ch/">Nothing</a>&#8221; (great name guys <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) hq in Wabern, you can find more info <a href="http://www.igda.ch/archives/225">here in IGDA Switzerland blog</a>.<br />
See you there <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2010/02/08/speaking-at-igda-switzerland-25th-february-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.flashfuck.it/2010/02/08/speaking-at-igda-switzerland-25th-february-2010/</feedburner:origLink></item>
		<item>
		<title>Spring Actionscript : Autowire new instances of non visual objects</title>
		<link>http://feedproxy.google.com/~r/FlashFuckIt/~3/tHV9Stvb0jQ/</link>
		<comments>http://www.flashfuck.it/2010/01/21/spring-actionscript-autowire-objects-not-defined-in-context/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 11:04:38 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[IoC]]></category>
		<category><![CDATA[PureMVC]]></category>
		<category><![CDATA[Spring Actionscript]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=166</guid>
		<description><![CDATA[UPDATE!!! A new method has just been added to IObjectFactory committed on spring actionscript svn repo in order to let autowire non visual classes!! w00t!:) Take a look at ?View Code ACTIONSCRIPTIObjectFactory.createInstance&#40;clazz:Class, constructorArguments:Array = null&#41;:*; this solves the problem and we have no longer to extend AutowiringObjectBase Take a look to the commit http://bit.ly/dmhZWd and [...]]]></description>
			<content:encoded><![CDATA[<p><b>UPDATE!!!</b></p>
<p>A new method has just been added to IObjectFactory committed on spring actionscript svn repo in order to let autowire non visual classes!! w00t!:)</p>
<p>Take a look at</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p166code5'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1665"><td class="code" id="p166code5"><pre class="actionscript" style="font-family:monospace;">IObjectFactory.<span style="color: #006600;">createInstance</span><span style="color: #66cc66;">&#40;</span>clazz:<span style="color: #000000; font-weight: bold;">Class</span>, constructorArguments:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #66cc66;">*</span>;</pre></td></tr></table></div>

</p>
<p>this solves the problem and we have no longer to extend AutowiringObjectBase</p>
<p>Take a look to the commit <a href="http://bit.ly/dmhZWd">http://bit.ly/dmhZWd</a> and <a href="http://www.springactionscript.org/source-repository.html">update your source</a></p>
<p>Thanx Roland to have done the whole work <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  and for the support</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>First of all a little explanation on the title of this post:<br />
I&#8217;m having some fun with <a href="http://www.springactionscript.org/">spring actionscript</a>, an as3<a href="http://en.wikipedia.org/wiki/Inversion_of_control"> IoC</a> framework. It&#8217;s my first experience with inversion of control in actionscript and I found it a little weird at first, but now I (think I&#8217;ve) understood how it works I&#8217;m having really lots of fun with it <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .<br />
Anyway, Spring actionscript provides two ways of autowiring object properties:<br />
- for non visual objects: you define your object and its properties in the context (xml or mxml) and when that object is being created the framework automatically wires up all its properties driving into each of them the defined value.<br />
- for visual objects: you mark your component&#8217;s properties with the custom metatag [Autowired] and when your component is added to the display list spring actionscript automatically wires up all marked properties.</p>
<p>But what if I want to create a non visual object at runtime and I want the framework to autowire its marked properties?<br />
I created a base class in order to do that, it&#8217;s built upon the <a href="http://www.puremvc.org/">pureMVC</a> extension for spring actionscript, which is actually the microarchitecture framework I&#8217;m using right now.</p>
<p>Here&#8217;s the code:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p166code6'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1666"><td class="code" id="p166code6"><pre class="actionscript" style="font-family:monospace;">package
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">describeType</span>;
&nbsp;
    <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">as3commons</span>.<span style="color: #006600;">lang</span>.<span style="color: #006600;">ClassUtils</span>;
    <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">patterns</span>.<span style="color: #006600;">facade</span>.<span style="color: #006600;">Facade</span>;
    <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">springextensions</span>.<span style="color: #006600;">actionscript</span>.<span style="color: #006600;">context</span>.<span style="color: #006600;">IConfigurableApplicationContext</span>;
    <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">springextensions</span>.<span style="color: #006600;">actionscript</span>.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IIocFacade</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">/**
     * This class provides autowiring for subclasses.
     *
     * @author pigiuz
     *
     */</span>
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AutowiringObjectBase
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _iocFacade:IIocFacade;
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> AutowiringObjectBase<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#123;</span>
            _iocFacade = Facade.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as IIocFacade;
            autoWire<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
&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>:IConfigurableApplicationContext
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #b1b100;">return</span> _iocFacade.<span style="color: #006600;">container</span>;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> autoWire<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">var</span> typeDescription:<span style="color: #0066CC;">XML</span> = describeType<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #b1b100;">for</span> <span style="color: #b1b100;">each</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> metaDataNode:<span style="color: #0066CC;">XML</span> <span style="color: #b1b100;">in</span> typeDescription..<span style="color: #006600;">metadata</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>metaDataNode.<span style="color: #006600;">attribute</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;name&quot;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;Autowired&quot;</span><span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#123;</span>
					<span style="color: #000000; font-weight: bold;">var</span> host:<span style="color: #0066CC;">String</span>;
					<span style="color: #000000; font-weight: bold;">var</span> chain:<span style="color: #0066CC;">String</span>;
                    <span style="color: #000000; font-weight: bold;">var</span> propertyNode:<span style="color: #0066CC;">XML</span> = metaDataNode.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                    <span style="color: #000000; font-weight: bold;">var</span> property:<span style="color: #0066CC;">String</span> = propertyNode.<span style="color: #66cc66;">@</span><span style="color: #0066CC;">name</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                    <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Found Autowired property: &quot;</span> + property<span style="color: #66cc66;">&#41;</span>;
                    <span style="color: #000000; font-weight: bold;">var</span> objectName:<span style="color: #0066CC;">String</span> = property;
                    <span style="color: #000000; font-weight: bold;">var</span> autowireByType:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">true</span>;
&nbsp;
                    <span style="color: #b1b100;">for</span> <span style="color: #b1b100;">each</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> arg:<span style="color: #0066CC;">XML</span> <span style="color: #b1b100;">in</span> metaDataNode.<span style="color: #006600;">arg</span><span style="color: #66cc66;">&#41;</span>
                    <span style="color: #66cc66;">&#123;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>arg.<span style="color: #006600;">attribute</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;key&quot;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;host&quot;</span><span style="color: #66cc66;">&#41;</span>
                        <span style="color: #66cc66;">&#123;</span>
                            host = arg.<span style="color: #006600;">attribute</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;value&quot;</span><span style="color: #66cc66;">&#41;</span>
                        <span style="color: #66cc66;">&#125;</span>
                        <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>arg.<span style="color: #006600;">attribute</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;key&quot;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;chain&quot;</span><span style="color: #66cc66;">&#41;</span>
                        <span style="color: #66cc66;">&#123;</span>
                            chain = arg.<span style="color: #006600;">attribute</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;value&quot;</span><span style="color: #66cc66;">&#41;</span>;
                        <span style="color: #66cc66;">&#125;</span>
                        <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>arg.<span style="color: #006600;">attribute</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;value&quot;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;byName&quot;</span><span style="color: #66cc66;">&#41;</span>
                        <span style="color: #66cc66;">&#123;</span>
                            autowireByType = <span style="color: #000000; font-weight: bold;">false</span>;
                        <span style="color: #66cc66;">&#125;</span>
                    <span style="color: #66cc66;">&#125;</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>autowireByType<span style="color: #66cc66;">&#41;</span>
                    <span style="color: #66cc66;">&#123;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>host <span style="color: #66cc66;">&amp;</span><span style="color: #808080; font-style: italic;">#038;&amp; chain)</span>
                        <span style="color: #66cc66;">&#123;</span>
                            <span style="color: #808080; font-style: italic;">// CHAINED AUTOWIRE</span>
                            <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Autowiring: &quot;</span> + property + <span style="color: #ff0000;">&quot; in &quot;</span> + <span style="color: #0066CC;">this</span> + <span style="color: #ff0000;">&quot; from &quot;</span> + host + <span style="color: #ff0000;">&quot;.&quot;</span> + chain<span style="color: #66cc66;">&#41;</span>;
                            <span style="color: #000000; font-weight: bold;">var</span> hostObject:<span style="color: #0066CC;">Object</span> = container.<span style="color: #006600;">getObject</span><span style="color: #66cc66;">&#40;</span>host<span style="color: #66cc66;">&#41;</span>;
                            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>hostObject<span style="color: #66cc66;">&#41;</span>
                            <span style="color: #66cc66;">&#123;</span>
                                <span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#91;</span>property<span style="color: #66cc66;">&#93;</span> = hostObject<span style="color: #66cc66;">&#91;</span>chain<span style="color: #66cc66;">&#93;</span>;
                            <span style="color: #66cc66;">&#125;</span>
                        <span style="color: #66cc66;">&#125;</span>
                        <span style="color: #b1b100;">else</span>
                        <span style="color: #66cc66;">&#123;</span>
                            <span style="color: #808080; font-style: italic;">// AUTOWIRE BY TYPE</span>
                            <span style="color: #000000; font-weight: bold;">var</span> clazz:<span style="color: #000000; font-weight: bold;">Class</span> = ClassUtils.<span style="color: #006600;">forName</span><span style="color: #66cc66;">&#40;</span>propertyNode.<span style="color: #66cc66;">@</span><span style="color: #0066CC;">type</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
                            <span style="color: #000000; font-weight: bold;">var</span> objectNames:<span style="color: #0066CC;">Array</span> = container.<span style="color: #006600;">getObjectNamesForType</span><span style="color: #66cc66;">&#40;</span>clazz<span style="color: #66cc66;">&#41;</span>;
                            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>objectNames.<span style="color: #0066CC;">length</span> == <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
                            <span style="color: #66cc66;">&#123;</span>
                                objectName = objectNames<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>;
                            <span style="color: #66cc66;">&#125;</span>
                            <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Autowiring by type: &quot;</span> + property + <span style="color: #ff0000;">&quot; in &quot;</span> + <span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;
                            <span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#91;</span>property<span style="color: #66cc66;">&#93;</span> = container.<span style="color: #006600;">getObject</span><span style="color: #66cc66;">&#40;</span>objectName<span style="color: #66cc66;">&#41;</span>;
                        <span style="color: #66cc66;">&#125;</span>
                    <span style="color: #66cc66;">&#125;</span>
                    <span style="color: #b1b100;">else</span>
                    <span style="color: #66cc66;">&#123;</span>
&nbsp;
                        <span style="color: #808080; font-style: italic;">// AUTOWIRE BY NAME</span>
                        <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Autowiring by name:&quot;</span> + property + <span style="color: #ff0000;">&quot; in &quot;</span> + <span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;
                        <span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#91;</span>property<span style="color: #66cc66;">&#93;</span> = container.<span style="color: #006600;">getObject</span><span style="color: #66cc66;">&#40;</span>objectName<span style="color: #66cc66;">&#41;</span>;
                    <span style="color: #66cc66;">&#125;</span>
                    propertyNode = <span style="color: #000000; font-weight: bold;">null</span>;
					host = <span style="color: #000000; font-weight: bold;">null</span>;
					chain = <span style="color: #000000; font-weight: bold;">null</span>;
                <span style="color: #66cc66;">&#125;</span>
                metaDataNode = <span style="color: #000000; font-weight: bold;">null</span>;
            <span style="color: #66cc66;">&#125;</span>
            <span style="color: #808080; font-style: italic;">// dispose describetype</span>
            typeDescription = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
&nbsp;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>As you can see, as the constructor is called the iocFacade (the puremvc&#8217;s facade decorated in a springy fashion) is retrieved in order to be able to locate the application context (iocFacade is not needed if you are not using puremvc, just make sure you can locate the context otherwise it won&#8217;t work!) and the autoWire method is called.</p>
<p>Basically what autoWire() does is checking which properties are marked as [Autowired] and looking up the container for object definitions satisfying required conditions (name\type\host-chain), then wire each property with the found object.</p>
<p>Good thing is in order to leverage this autowiring capability you just have extend this class and create your own classes feeling free to mark properties as [Autowired].</p>
<p>Is there some better solution out there?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2010/01/21/spring-actionscript-autowire-objects-not-defined-in-context/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.flashfuck.it/2010/01/21/spring-actionscript-autowire-objects-not-defined-in-context/</feedburner:origLink></item>
		<item>
		<title>AS3 Reflection crapyness :\</title>
		<link>http://feedproxy.google.com/~r/FlashFuckIt/~3/ujyIYSSJOEM/</link>
		<comments>http://www.flashfuck.it/2009/12/02/as3-reflection-crapyness/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 12:58:10 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Improvements]]></category>
		<category><![CDATA[Reflection]]></category>
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=164</guid>
		<description><![CDATA[Today I spent a whole morning to figure out that AS3 sucks. Today I&#8217;ve been implementing a simple factory method which receives a Class object and some parameters to be passed to the concrete class instance, something with a signature like this: ?View Code ACTIONSCRIPTstatic public function createInstance&#40;c:Class, ... args&#41;:Object BUT&#8230;the implementation of such a [...]]]></description>
			<content:encoded><![CDATA[<p>Today I spent a whole morning to figure out that AS3 sucks.</p>
<p>Today I&#8217;ve been implementing a simple factory method which receives a Class object and some parameters to be passed to the concrete class instance, something with a signature like this:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p164code13'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16413"><td class="code" id="p164code13"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">static</span> <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> createInstance<span style="color: #66cc66;">&#40;</span>c:<span style="color: #000000; font-weight: bold;">Class</span>, ... <span style="color: #006600;">args</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Object</span></pre></td></tr></table></div>

<p>BUT&#8230;the implementation of such a clear and simple method has been a bloody bath, because AS3 doesn&#8217;t support a really cool way to do really cool stuff like this <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
I thought the implementation would be simply something like</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p164code14'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16414"><td class="code" id="p164code14"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">static</span> <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> createInstance<span style="color: #66cc66;">&#40;</span>c:<span style="color: #000000; font-weight: bold;">Class</span>, ... <span style="color: #006600;">args</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Object</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> c<span style="color: #66cc66;">&#40;</span>args<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>or any other easy way (python taught me to think simple <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ) BUT&#8230;<br />
&#8220;new c(args);&#8221; means my class constructor accepts one parameter typed as an Array, and I really don&#8217;t want my custom classes to have this defect of form nor my custom factory not to be able to instance classes written by someone else, so the solution &#8220;classes to be instanciated by the factory must accept an array as constructor parameter&#8221; is absolutely out.</p>
<p>Next approach, &#8220;reflect all properties instead of having parameters passed to the constructor&#8221;&#8230; not really a solution. Not always classes&#8217; properties have the same name\type\whatever of constructor parameters. It&#8217;s a compromise that my factory can&#8217;t accept because I wouldn&#8217;t be able to create whatever class instance but only &#8220;some&#8221; class instance :\. out.</p>
<p>Next approach, &#8220;use <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Function.html#apply%28%29">Function.apply</a> to pass some parameters (array) to a function as they were single variables&#8221;..hey! that&#8217;s a good one! Let&#8217;s try it with some function</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p164code15'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16415"><td class="code" id="p164code15"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> MyClass<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> myfunc<span style="color: #66cc66;">&#40;</span>foo:<span style="color: #0066CC;">String</span>,bar:uint<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>foo, bar<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> MyOtherClass<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> callmyfunc<span style="color: #66cc66;">&#40;</span>... <span style="color: #006600;">args</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #000000; font-weight: bold;">var</span> c:MyClass = <span style="color: #000000; font-weight: bold;">new</span> MyClass<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
c.<span style="color: #006600;">myfunc</span>.<span style="color: #0066CC;">apply</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">null</span>,args<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>HEY! IT WORKS! holy crap! AS3 rocks!&#8230;wait, let&#8217;s try it with a constructor function&#8230;</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p164code16'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16416"><td class="code" id="p164code16"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> MyClass<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MyClass<span style="color: #66cc66;">&#40;</span>foo:<span style="color: #0066CC;">String</span>,bar:uint<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>foo, bar<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> MyOtherClass<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> callmyfunc<span style="color: #66cc66;">&#40;</span>... <span style="color: #006600;">args</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #000000; font-weight: bold;">var</span> c:MyClass = <span style="color: #000000; font-weight: bold;">new</span> MyClass<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">apply</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">null</span>,args<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>&#8230;ok, it doesn&#8217;t work :\ and throws a runtime error :/ &#8220;Property apply not found on MyClass and there is no default value&#8221;&#8230;mmm<br />
ok, maybe I have to reference the constructor function, but how can I do it!?<br />
let&#8217;s try with &#8220;<a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Object.html#constructor">Class.prototype.constructor</a>&#8221;</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p164code17'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16417"><td class="code" id="p164code17"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> MyClass<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MyClass<span style="color: #66cc66;">&#40;</span>foo:<span style="color: #0066CC;">String</span>,bar:uint<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>foo, bar<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> MyOtherClass<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> callmyfunc<span style="color: #66cc66;">&#40;</span>... <span style="color: #006600;">args</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #000000; font-weight: bold;">var</span> c:<span style="color: #000000; font-weight: bold;">Class</span> = MyClass;
<span style="color: #000000; font-weight: bold;">var</span> f:<span style="color: #000000; font-weight: bold;">Function</span> = c.<span style="color: #0066CC;">prototype</span>.<span style="color: #0066CC;">constructor</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>&#8230;error&#8230; Class.prototype.constructor returns the type of the caller class (in this case MyClass)&#8230;<br />
so&#8230;what can I do?</p>
<p>Discarded solutions:<br />
- <del datetime="2009-12-02T12:02:52+00:00">&#8220;classes to be instanciated by the factory must accept an array as constructor parameter&#8221;<br />
</del><br />
- <del datetime="2009-12-02T12:02:52+00:00">&#8220;reflect all properties instead of having parameters passed to the constructor&#8221;</del><br />
- <del datetime="2009-12-02T12:02:52+00:00">&#8220;use Function.apply to pass some parameters (array) to a function as they were single variables&#8221;</del><br />
here&#8217;s the solution: (drums) <strong>THE CRAPY ONE</strong>!<br />
better known as &#8220;switch it all baby&#8221;&#8230;.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p164code18'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16418"><td class="code" id="p164code18"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">static</span> <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> create<span style="color: #66cc66;">&#40;</span>c:<span style="color: #000000; font-weight: bold;">Class</span>, ... <span style="color: #006600;">args</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Object</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">switch</span><span style="color: #66cc66;">&#40;</span>args.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
				<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">0</span>: <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> c<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">1</span>: <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> c<span style="color: #66cc66;">&#40;</span>args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">2</span>: <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> c<span style="color: #66cc66;">&#40;</span>args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>,args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">3</span>: <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> c<span style="color: #66cc66;">&#40;</span>args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>,args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>,args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">4</span>: <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> c<span style="color: #66cc66;">&#40;</span>args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>,args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>,args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span>,args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">5</span>: <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> c<span style="color: #66cc66;">&#40;</span>args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>,args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>,args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span>,args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#93;</span>,args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #000000; font-weight: bold;">default</span>: <span style="color: #0066CC;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;too many arguments&quot;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">null</span>;
		<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>if you need to pass more than 5 arguments just add some lines to the factory and you&#8217;re done&#8230;</p>
<p>I was completely pissed off when I found this horrible lack in AS3, really, I was about for starting to cry, so I submitted a feature request on bugs.adobe&#8230; I think it&#8217;s really a MUST for a &#8220;respectable&#8221; language, if you find it as necessary as I think take a minute to vote this feature.<br />
<a href="https://bugs.adobe.com/jira/browse/FP-3364">https://bugs.adobe.com/jira/browse/FP-3364</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2009/12/02/as3-reflection-crapyness/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.flashfuck.it/2009/12/02/as3-reflection-crapyness/</feedburner:origLink></item>
		<item>
		<title>Diving into Gumbo</title>
		<link>http://feedproxy.google.com/~r/FlashFuckIt/~3/tU-VLVwYLXY/</link>
		<comments>http://www.flashfuck.it/2009/11/13/diving-into-gumbo/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 16:03:42 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flex4]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=161</guid>
		<description><![CDATA[You know what? I found the jump very easy and those guys at Adobe&#8217;s hq did a wonderful job on driving people into this new release of the Flex framework. I&#8217;m not posting some code this time, just a link to a project which can be sooooooo helpful to take your dive: &#8220;Flex in a [...]]]></description>
			<content:encoded><![CDATA[<p>You know what? I found the jump very easy and those guys at Adobe&#8217;s hq did a wonderful job on driving people into this new release of the Flex framework.<br />
I&#8217;m not posting some code this time, just a link to a project which can be sooooooo helpful to take your dive: &#8220;Flex in a Week&#8221;.<br />
Nothing hard, just take your time, your headphones and a good internet connection, drive your browser to <a href="http://www.adobe.com/devnet/flex/videotraining/flex4beta/index.html">http://www.adobe.com/devnet/flex/videotraining/flex4beta/index.html</a> and start from the beginning&#8230;<br />
If you&#8217;re not new to flex programming it will take you half a day to get into this new baby.</p>
<p>bye for now <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2009/11/13/diving-into-gumbo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.flashfuck.it/2009/11/13/diving-into-gumbo/</feedburner:origLink></item>
		<item>
		<title>My FOTB ’09 Schedule</title>
		<link>http://feedproxy.google.com/~r/FlashFuckIt/~3/4wDUt5q-L7k/</link>
		<comments>http://www.flashfuck.it/2009/09/07/my-fotb-09-schedule/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 07:35:15 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[fotb09]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=159</guid>
		<description><![CDATA[Flash on the beach is each day closer and I started to plan my own schedule. Each choice has been quite hard because of the high quality the conference is offering, the good thing is that even if I&#8217;m not 100% convinced to be attending some sessions I&#8217;m sure that I can switch to another [...]]]></description>
			<content:encoded><![CDATA[<p>Flash on the beach is each day closer and I started to plan my own schedule.<br />
Each choice has been quite hard because of the high quality the conference is offering, the good thing is that even if I&#8217;m not 100% convinced to be attending some sessions I&#8217;m sure that I can switch to another one with the same or even higher quality <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>sunday:<br />
papervision3D workshop by seb lee-delisle</p>
<p>monday:<br />
Richard exposes all! &#8211; Richard Galvan<br />
Casual game architecture &#8211; Keith Peters<br />
Visualizing the voice &#8211; Chuck Freedman<br />
Who&#8217;s a bright spark then! &#8211; Mike Jones<br />
Cybernetic art revsited &#8211; Dr. Woohoo!<br />
Telling Stories – Hillman Curtis<br />
Epiphany – Joel Gethin Lewis</p>
<p>tuesday:<br />
3 minute wonders &#8211; many (looking forward to Michiel van der Ros 3D optimization for MMOs)<br />
Quick as a Flash &#8211; Grant Skinner<br />
Leaving the sandbox &#8211; Joa Ebert<br />
Application Frameworks &#8211; Richard Lord<br />
More than bending pixels &#8211; Paul Burnett<br />
Unconventional Webapps &#8211; Des Traynor + Eoghan McCabe<br />
Choose your own adventure &#8211; Craig Swann</p>
<p>wednesdey<br />
Play with vectors &#8211; Koen de Weggheleire<br />
Connecting the dots &#8211; Mario Klingemann<br />
Work/Play &#8211; Seb Lee-Delisle<br />
Flashed Fashion &#8211; Andy Mcdonald<br />
Research realtime graphics &#8211; Ralph Hauwert<br />
Space &#8211; Joshua Davis</p>
<p>I&#8217;m getting in Brighton on saturday 19th, you&#8217;re allowed to <a href="http://twitter.com/pigiuz">poke me</a> <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2009/09/07/my-fotb-09-schedule/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.flashfuck.it/2009/09/07/my-fotb-09-schedule/</feedburner:origLink></item>
		<item>
		<title>Speaking at “Arrivano i guru” September 26th 2009 Milan</title>
		<link>http://feedproxy.google.com/~r/FlashFuckIt/~3/pIACjllHJeY/</link>
		<comments>http://www.flashfuck.it/2009/08/07/speaking-at-arrivano-i-guru-september-26th-2009-milan/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 10:13:52 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[Speaking]]></category>
		<category><![CDATA[BitmapData]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[gfx]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=157</guid>
		<description><![CDATA[I&#8217;m pleased to be speaking at &#8220;Arrivano i guru&#8221; stage of Milan the next September 26th. Arrivano i guru is a moving conference iterating the whole italian peninsula. Here&#8217;s the complete list of stages Main topics are Adobe Flash Platform , SEO, and graphics. Great speakers are involved, such as Tiziano Fruet, Luca Mezzalira, and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pleased to be speaking at &#8220;Arrivano i guru&#8221; stage of Milan the next September 26th.<br />
Arrivano i guru is a moving conference iterating the whole italian peninsula. <a href="http://www.arrivanoiguru.com/index.php?pagina=13&#038;cnt=1&#038;ref=0">Here&#8217;s the complete list of stages</a> <br />
Main topics are Adobe Flash Platform , SEO, and graphics. Great speakers are involved, such as Tiziano Fruet, Luca Mezzalira, and <a href="http://www.arrivanoiguru.com/index.php?pagina=14&#038;cnt=1&#038;ref=1">many others</a>.</p>
<p>This is my session&#8217;s outline:<br />
(ITALIAN)<br />
Special Effects in Flash CS4<br />
Impariamo ad utilizzare bitmaps, filtri e tweens in Flash CS4 per creare effetti speciali custom.</p>
<p>I filtri in flash<br />
	- cosa sono i filtri in flash<br />
	- applicare i filtri con AS3</p>
<p>I blendmode in flash<br />
	- cosa sono i blendmode in flash<br />
	- applicare i blendmode AS3</p>
<p>Sveliamo i bitmap<br />
	- cos&#8217;è un bitmap in Flash<br />
	- i bitmap come tela di un pittore<br />
	- manipolare i bitmap in AS3</p>
<p>TweensyFX<br />
	- cos&#8217;è Tweensy<br />
	- animare i propri effetti speciali</p>
<p>(ENGLISH)<br />
Special Effects in Flash CS4<br />
Let&#8217;s learn to use bitmaps, filters and tweens within Flash CS4 to create custom special effects.</p>
<p>filters<br />
	- what are filters in flash?<br />
	- applying filters using AS3</p>
<p>blendmodes<br />
	- what blend modes are<br />
	- applying blendmodes using AS3</p>
<p>discovering bitmaps<br />
	- what are bitmaps for Flash?<br />
	- bitmaps as a painter&#8217;s canvas<br />
	- manipulating bitmaps using AS3</p>
<p>TweensyFX<br />
	- what&#8217;s Tweensy?<br />
	- creating and animating our own special effects</p>
<p>See you there <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2009/08/07/speaking-at-arrivano-i-guru-september-26th-2009-milan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.flashfuck.it/2009/08/07/speaking-at-arrivano-i-guru-september-26th-2009-milan/</feedburner:origLink></item>
		<item>
		<title>Flash on the Beach ’09</title>
		<link>http://feedproxy.google.com/~r/FlashFuckIt/~3/yPkSKNmUFYA/</link>
		<comments>http://www.flashfuck.it/2009/07/20/flash-on-the-beach-09/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 17:03:43 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[fotb]]></category>
		<category><![CDATA[fotb09]]></category>
		<category><![CDATA[schedule]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/2009/07/20/flash-on-the-beach-09/</guid>
		<description><![CDATA[Just bought my ticket for Flash on the Beach 09! w00t! I really can&#8217;t wait to reach Brighton and attending such a great conference. See you there guys]]></description>
			<content:encoded><![CDATA[<p>Just bought my ticket for Flash on the Beach 09! w00t!<br />
I really can&#8217;t wait to reach Brighton and attending such a great conference.<br />
See you there guys <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<a href="http://www.flashonthebeach.com"><img alt="" src="http://www.flashonthebeach.com/images/badges/fotb09webbadge.png" title="Flash on the Beach 09" class="alignnone" width="200" height="250" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2009/07/20/flash-on-the-beach-09/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.flashfuck.it/2009/07/20/flash-on-the-beach-09/</feedburner:origLink></item>
		<item>
		<title>The Burning Man – bitmapData fire effect</title>
		<link>http://feedproxy.google.com/~r/FlashFuckIt/~3/ahbdCiirW50/</link>
		<comments>http://www.flashfuck.it/2009/07/16/the-burning-man-bitmapdata-fire-effect/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 14:17:10 +0000</pubDate>
		<dc:creator>pigiuz</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[BitmapData]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[webcam]]></category>

		<guid isPermaLink="false">http://www.flashfuck.it/?p=149</guid>
		<description><![CDATA[Yesterday night it was too warm to sleep and I have no air conditioning at home, so I thought it was a good opportunity to make some experiments related to the high temperature&#8230; &#8220;the burning man&#8221; Here&#8217;s the algorithm in human language: - pick up the image from the webcam - perform a threshold on [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday night it was too warm to sleep and I have no air conditioning at home, so I thought it was a good opportunity to make some experiments related to the high temperature&#8230; &#8220;the burning man&#8221; <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Here&#8217;s the algorithm in human language:<br />
- pick up the image from the webcam<br />
- perform a threshold on it to exclude (alpha 0) every pixel below the average skin amount of red (between 44 and 90 depending on the light)<br />
- perform a second threshold to exclude (alpha 0) every pixel above the average skin amount of green and blue (between 3344 and 6677 depending on the light)<br />
- draw the result onto a new bitmapdata with the ADD blendmode<br />
- apply blur to the bitmapdata<br />
- generate a perlin noise of one channel (i chose red)<br />
- displace the bitmapdata towards -y<br />
- apply again a displacement map filter to displace horizontally (i used a cos function to make the x displacement a little likely)<br />
- apply a displacement map towards +y with just a bit less strenght than the previous &#8220;-y&#8221; one (this is to make the fire propagation much more likely)<br />
- then merge the original webcam output with the displaced one&#8230;and you&#8217;ve the burning man! <img src='http://www.flashfuck.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>here the actionscript implementation</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p149code20'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p14920"><td class="code" id="p149code20"><pre class="actionscript" style="font-family:monospace;">package
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Bitmap</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">BitmapData</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">BitmapDataChannel</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">BlendMode</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">filters</span>.<span style="color: #006600;">BlurFilter</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">filters</span>.<span style="color: #006600;">DisplacementMapFilter</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">filters</span>.<span style="color: #006600;">DisplacementMapFilterMode</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">ColorTransform</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Matrix</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Point</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Rectangle</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">media</span>.<span style="color: #0066CC;">Camera</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">media</span>.<span style="color: #0066CC;">Video</span>;
&nbsp;
	<span style="color: #66cc66;">&#91;</span>SWF<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;320&quot;</span>,<span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;240&quot;</span>,frameRate=<span style="color: #ff0000;">&quot;31&quot;</span>,<span style="color: #0066CC;">backgroundColor</span>=<span style="color: #ff0000;">&quot;0x000000&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> BurningMan <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _cam:<span style="color: #0066CC;">Camera</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _vid:<span style="color: #0066CC;">Video</span>;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _fireThreshold:BitmapData;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _firePerlin:BitmapData;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _fireOffset:Point;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _fireSpeed:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">20</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _fireDisplaceUP:DisplacementMapFilter;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _fireDisplaceDWN:DisplacementMapFilter;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _fireDisplaceSrc:BitmapData;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _fireBlur:BlurFilter;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _fireColorTransform:ColorTransform;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _fireMerge:BitmapData;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _camBd:BitmapData;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _b:Bitmap;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const <span style="color: #0066CC;">WIDTH</span>:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">320</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const <span style="color: #0066CC;">HEIGHT</span>:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">240</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const ORIGIN:Point = <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const REFLECT:Matrix = <span style="color: #000000; font-weight: bold;">new</span> Matrix<span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">1</span>,<span style="color: #0066CC;">WIDTH</span>,<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const RESIZE_2X:Matrix = <span style="color: #000000; font-weight: bold;">new</span> Matrix<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _rect:Rectangle;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> BurningMan<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_cam = <span style="color: #0066CC;">Camera</span>.<span style="color: #006600;">getCamera</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_cam.<span style="color: #0066CC;">setMode</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">WIDTH</span>,<span style="color: #0066CC;">HEIGHT</span>,<span style="color: #cc66cc;">31</span><span style="color: #66cc66;">&#41;</span>;
			_vid = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Video</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">WIDTH</span>,<span style="color: #0066CC;">HEIGHT</span><span style="color: #66cc66;">&#41;</span>;
			_vid.<span style="color: #006600;">attachCamera</span><span style="color: #66cc66;">&#40;</span>_cam<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_fireOffset = <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_fireThreshold = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">WIDTH</span>,<span style="color: #0066CC;">HEIGHT</span>,<span style="color: #000000; font-weight: bold;">true</span>,0x00000000<span style="color: #66cc66;">&#41;</span>;
			_fireMerge = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">WIDTH</span>,<span style="color: #0066CC;">HEIGHT</span>,<span style="color: #000000; font-weight: bold;">true</span>,0x00000000<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_firePerlin = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">WIDTH</span><span style="color: #66cc66;">*</span>.5,<span style="color: #0066CC;">HEIGHT</span><span style="color: #66cc66;">*</span>.5,<span style="color: #000000; font-weight: bold;">false</span>,0x000000<span style="color: #66cc66;">&#41;</span>;
			_fireDisplaceSrc = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">WIDTH</span>,<span style="color: #0066CC;">HEIGHT</span>,<span style="color: #000000; font-weight: bold;">false</span>,0x000000<span style="color: #66cc66;">&#41;</span>;
			_fireDisplaceUP = <span style="color: #000000; font-weight: bold;">new</span> DisplacementMapFilter<span style="color: #66cc66;">&#40;</span>_fireDisplaceSrc,ORIGIN,BitmapDataChannel.<span style="color: #006600;">RED</span>,BitmapDataChannel.<span style="color: #006600;">RED</span>,<span style="color: #cc66cc;">0</span>,-<span style="color: #cc66cc;">15</span>,DisplacementMapFilterMode.<span style="color: #006600;">CLAMP</span><span style="color: #66cc66;">&#41;</span>;
			_fireDisplaceDWN = <span style="color: #000000; font-weight: bold;">new</span> DisplacementMapFilter<span style="color: #66cc66;">&#40;</span>_fireDisplaceSrc,ORIGIN,BitmapDataChannel.<span style="color: #006600;">RED</span>,BitmapDataChannel.<span style="color: #006600;">RED</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">9</span>,DisplacementMapFilterMode.<span style="color: #006600;">CLAMP</span><span style="color: #66cc66;">&#41;</span>;
			_fireBlur = <span style="color: #000000; font-weight: bold;">new</span> BlurFilter<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span>;
			_fireColorTransform = <span style="color: #000000; font-weight: bold;">new</span> ColorTransform<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1.3</span>,<span style="color: #cc66cc;">1.1</span>,<span style="color: #cc66cc;">1</span>,.7<span style="color: #66cc66;">&#41;</span>;
&nbsp;
&nbsp;
			_camBd = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">WIDTH</span>,<span style="color: #0066CC;">HEIGHT</span>,<span style="color: #000000; font-weight: bold;">true</span>,0x00000000<span style="color: #66cc66;">&#41;</span>;
			_rect = _camBd.<span style="color: #006600;">rect</span>;
			_b = <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span>_camBd<span style="color: #66cc66;">&#41;</span>;
			_firePerlin.<span style="color: #006600;">lock</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_fireMerge.<span style="color: #006600;">lock</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span>_b<span style="color: #66cc66;">&#41;</span>;
&nbsp;
&nbsp;
			addEventListener<span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>,update<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> update<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event=<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">//locks</span>
			_camBd.<span style="color: #006600;">lock</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_fireOffset.<span style="color: #006600;">y</span>+=_fireSpeed;
			_firePerlin.<span style="color: #006600;">perlinNoise</span><span style="color: #66cc66;">&#40;</span>_firePerlin.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">*</span>.125,_firePerlin.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">*</span>.125,<span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #000000; font-weight: bold;">true</span>,<span style="color: #000000; font-weight: bold;">false</span>,BitmapDataChannel.<span style="color: #006600;">RED</span>,<span style="color: #000000; font-weight: bold;">false</span>,<span style="color: #66cc66;">&#91;</span>_fireOffset<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
			_fireDisplaceSrc.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span>_firePerlin,RESIZE_2X<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_camBd.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span>_vid,REFLECT<span style="color: #66cc66;">&#41;</span>;
			_fireThreshold.<span style="color: #006600;">setVector</span><span style="color: #66cc66;">&#40;</span>_rect,_camBd.<span style="color: #006600;">getVector</span><span style="color: #66cc66;">&#40;</span>_rect<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
			_fireThreshold.<span style="color: #006600;">threshold</span><span style="color: #66cc66;">&#40;</span>_fireThreshold,_rect,ORIGIN,<span style="color: #ff0000;">&quot;&lt;&quot;</span>,0xFF440000,0x00000000,0xFF0000,<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
			_fireThreshold.<span style="color: #006600;">threshold</span><span style="color: #66cc66;">&#40;</span>_fireThreshold,_rect,ORIGIN,<span style="color: #ff0000;">&quot;&gt;&quot;</span>,0xFF003344,0x00000000,0x00FFFF,<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
			_fireMerge.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span>_fireThreshold,<span style="color: #000000; font-weight: bold;">null</span>,_fireColorTransform,BlendMode.<span style="color: #0066CC;">ADD</span>,_rect<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_fireDisplaceUP.<span style="color: #006600;">scaleX</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>_fireOffset.<span style="color: #006600;">y</span><span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&lt;&lt;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">%</span>360<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">180</span><span style="color: #66cc66;">/</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">2</span>;
			_fireDisplaceDWN.<span style="color: #006600;">scaleX</span> = -_fireDisplaceUP.<span style="color: #006600;">scaleX</span>;
			_fireMerge.<span style="color: #006600;">applyFilter</span><span style="color: #66cc66;">&#40;</span>_fireMerge,_fireMerge.<span style="color: #006600;">rect</span>,ORIGIN,_fireBlur<span style="color: #66cc66;">&#41;</span>;
			_fireMerge.<span style="color: #006600;">applyFilter</span><span style="color: #66cc66;">&#40;</span>_fireMerge,_rect,ORIGIN,_fireDisplaceUP<span style="color: #66cc66;">&#41;</span>;
			_fireMerge.<span style="color: #006600;">applyFilter</span><span style="color: #66cc66;">&#40;</span>_fireMerge,_rect,ORIGIN,_fireDisplaceDWN<span style="color: #66cc66;">&#41;</span>;
			_camBd.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span>_fireMerge,<span style="color: #000000; font-weight: bold;">null</span>,_fireColorTransform,BlendMode.<span style="color: #006600;">HARDLIGHT</span>,_rect<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">//unlocks</span>
			_camBd.<span style="color: #006600;">unlock</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>here&#8217;s a preview of myself empowered by the force of the fire!:D<br />
<a href="http://www.flashfuck.it/test/burning_man/index.html" title="burning man" class="flickr-image alignnone"><img src="http://farm3.static.flickr.com/2517/3726036339_476f627507_o.jpg" alt="burning man" class=""  /></a><br />
click the photo to see the demo in action</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashfuck.it/2009/07/16/the-burning-man-bitmapdata-fire-effect/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.flashfuck.it/2009/07/16/the-burning-man-bitmapdata-fire-effect/</feedburner:origLink></item>
	</channel>
</rss>
