<?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>timovirtanen.com &#187; Demo</title>
	<atom:link href="http://www.timovirtanen.com/category/flash/demo/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.timovirtanen.com</link>
	<description>FLASH RUNTIME ROCKS!</description>
	<lastBuildDate>Sun, 27 Jun 2010 09:39:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>A* pathfinding</title>
		<link>http://www.timovirtanen.com/2009/03/30/a-pathfinding/</link>
		<comments>http://www.timovirtanen.com/2009/03/30/a-pathfinding/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 16:11:20 +0000</pubDate>
		<dc:creator>Timo Virtanen</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Flash & Flex]]></category>

		<guid isPermaLink="false">http://www.timovirtanen.com/?p=746</guid>
		<description><![CDATA[Path-finding is really an interesting topic and luckily there is loads of information available on the Internet. Implementing the algorithm, however,Â  is a different thing. Don&#8217;t get me wrong. The algorithm itself is pretty easy to digest. Making it fast and efficient is a bit harder. That would involve advanced data structures, Â some pre calculationsÂ and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.timovirtanen.com/wp-content/uploads/astar/"><img class="alignnone size-full wp-image-751" title="astar21" src="http://timovirtanen.com/wp-content/uploads/2009/03/astar21.png" alt="astar21" width="445" height="224" /></a></p>
<p>Path-finding is really an interesting topic and luckily there is loads of information available on the Internet. Implementing the algorithm, however,Â  is a different thing. Don&#8217;t get me wrong. The algorithm itself is pretty easy to digest. Making it fast and efficient is a bit harder. That would involve advanced data structures, Â some <span><span>pre</span></span> calculationsÂ and probably more. Anyway, here&#8217;s what I managed to put together. It uses Vector class so FP10 is needed.</p>
<h1>Notes about the settings</h1>
<p><strong>Map mode:</strong><br />
In this mode you can modify the tiles. White tile equals to &#8220;<em>walkable</em>&#8220;. Click on a tile to toggle its state.</p>
<p><strong>Path mode:</strong><br />
In this mode you can select the starting and ending points of the path.</p>
<p><strong>Use Manhattan method:</strong><br />
<em>Manhattan method</em> is a fast (thus more inaccurate) method for calculating the distanceÂ  between two points. It is the total number of squares moved horizontally and vertically to reach the target square from the current square, ignoring diagonal movement and any obstacles that may be in the way.Â If this option is unchecked <em><span>Euclidean</span> Method</em> will be used instead. It is slower but better.</p>
<p><span id="more-746"></span></p>
<p><strong>Use diagonal paths:</strong><br />
Using diagonal paths increases the calculation time but results in &#8220;more realistic paths&#8221;.</p>
<p><strong>Allow cutting corners:</strong><br />
This is probably not acceptable in most cases.Â  If diagonal paths are disabled this setting will have no effect.</p>
<p>SOURCE FILES: <a href="http://timovirtanen.com/wp-content/uploads/2009/03/astar.zip"><span><span>astar</span></span></a></p>
<p><strong>Useful links:</strong></p>
<ul>
<li><a href="http://www.policyalmanac.org/games/aStarTutorial.htm">A* Path-finding for Beginners</a><br />
If you are new to <span><span>Astar</span></span> this is the place to start with.</li>
</ul>
<ul>
<li><a href="http://theory.stanford.edu/~amitp/GameProgramming/"><span><span>Amit&#8217;s</span></span> A* Pages</a><br />
More advanced and in depth information on A*</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.timovirtanen.com/2009/03/30/a-pathfinding/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Brain Man (Papervision3D)</title>
		<link>http://www.timovirtanen.com/2009/03/03/brain-man-papervision3d/</link>
		<comments>http://www.timovirtanen.com/2009/03/03/brain-man-papervision3d/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 14:34:03 +0000</pubDate>
		<dc:creator>Timo Virtanen</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Flash & Flex]]></category>
		<category><![CDATA[Flash 3D]]></category>

		<guid isPermaLink="false">http://www.timovirtanen.com/?p=716</guid>
		<description><![CDATA[Don&#8217;t ask me about the name / post title . Here is demo I made at Talvi Digital a few weeks ago. I got the idea from Audis microsite. I guess there a few ways you can do this but here&#8217;s my solution. I did this demo by reading the models geometry (vertices) into an [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://talvi.com/asiakas/demo/brainman/"><img class="alignnone size-full wp-image-717" title="brainman2" src="http://timovirtanen.com/wp-content/uploads/2009/03/brainman2.png" alt="brainman2" width="445" height="224" /></a></p>
<p>Don&#8217;t ask me about the name / post title <img src='http://www.timovirtanen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Here is demo I made at <a href="http://talvi.com/experiments/">Talvi Digital</a> a few weeks ago. I got the idea from <a href="http://microsites.audi.com/vdt-onlinespecial/html/popup.html">Audis microsite</a>.</p>
<p>I guess there a few ways you can do this but here&#8217;s my solution. I did this demo by reading the models geometry (vertices) into an array. Then I mapped the points to the corresponding positions in 3D space and added the &#8220;avoid mouse&#8221; behavior. You can do pretty impressive effects with this technique.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.timovirtanen.com/2009/03/03/brain-man-papervision3d/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wild Driver (Chase Cam)</title>
		<link>http://www.timovirtanen.com/2009/03/03/wild-driver-chase-cam/</link>
		<comments>http://www.timovirtanen.com/2009/03/03/wild-driver-chase-cam/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 10:32:18 +0000</pubDate>
		<dc:creator>Timo Virtanen</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Flash & Flex]]></category>
		<category><![CDATA[Flash 3D]]></category>

		<guid isPermaLink="false">http://www.timovirtanen.com/?p=696</guid>
		<description><![CDATA[Here a variation of the Wild Driver game demo. I guess the top-down view works much better but this is quite fun too. Take a test drive.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.talvi.com/asiakas/demo/wilddriverchase/"><img class="alignnone size-full wp-image-697" title="wild_driver_chase" src="http://timovirtanen.com/wp-content/uploads/2009/03/wild_driver_chase.png" alt="wild_driver_chase" width="445" height="224" /></a></p>
<p><span>Here a variation of the Wild Driver game demo. I guess the top-down view works much better but this is </span>quite fun too. <img src='http://www.timovirtanen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<a href="http://www.talvi.com/asiakas/demo/wilddriverchase/">Take a test drive</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.timovirtanen.com/2009/03/03/wild-driver-chase-cam/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Artillery Game Demo</title>
		<link>http://www.timovirtanen.com/2009/03/02/artillery-game-demo/</link>
		<comments>http://www.timovirtanen.com/2009/03/02/artillery-game-demo/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 17:14:06 +0000</pubDate>
		<dc:creator>Timo Virtanen</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Flash & Flex]]></category>

		<guid isPermaLink="false">http://www.timovirtanen.com/?p=687</guid>
		<description><![CDATA[Here is my variation of the well known Artillery Game. This is only a single player implementation so it&#8217;s pertty lame. But give it a try let me know what you think about it. SOURCE: Artillery Source Files]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.timovirtanen.com/wp-content/uploads/artillerydemo/"><img class="alignnone size-full wp-image-688" title="artillery" src="http://timovirtanen.com/wp-content/uploads/2009/03/artillery.png" alt="artillery" width="445" height="224" /></a></p>
<p>Here is <a href="http://www.timovirtanen.com/wp-content/uploads/artillerydemo/">my variation</a> of the well known <a href="http://en.wikipedia.org/wiki/Artillery_game">Artillery Game</a>. This is only a single player implementation so it&#8217;s pertty lame. But give it a try let me know what you think about it.</p>
<p>SOURCE: <a href="http://timovirtanen.com/wp-content/uploads/2009/03/Artillery1.zip">Artillery Source Files</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.timovirtanen.com/2009/03/02/artillery-game-demo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wild Driver demo with PaperVision3D</title>
		<link>http://www.timovirtanen.com/2009/03/02/wild-driver-demo-with-papervision3d/</link>
		<comments>http://www.timovirtanen.com/2009/03/02/wild-driver-demo-with-papervision3d/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 12:28:43 +0000</pubDate>
		<dc:creator>Timo Virtanen</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Flash & Flex]]></category>
		<category><![CDATA[Flash 3D]]></category>

		<guid isPermaLink="false">http://www.timovirtanen.com/?p=677</guid>
		<description><![CDATA[Pedal to the metal. No cops in this town. APE Engine is responsible for the physics.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.talvi.com/asiakas/demo/wilddriver/"><img class="alignnone size-full wp-image-678" title="wild_driver" src="http://timovirtanen.com/wp-content/uploads/2009/03/wild_driver.png" alt="wild_driver" width="445" height="224" /></a></p>
<p><a href="http://www.talvi.com/asiakas/demo/wilddriver/">Pedal to the metal</a>. No cops in this town. <img src='http://www.timovirtanen.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
<a href="http://www.cove.org/ape/">APE Engine</a> is responsible for the physics.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.timovirtanen.com/2009/03/02/wild-driver-demo-with-papervision3d/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>3rd Person Shooter Demo with Away3D</title>
		<link>http://www.timovirtanen.com/2009/02/27/3rd-person-shooter-demo-with-away3d/</link>
		<comments>http://www.timovirtanen.com/2009/02/27/3rd-person-shooter-demo-with-away3d/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 16:16:09 +0000</pubDate>
		<dc:creator>Timo Virtanen</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Flash & Flex]]></category>
		<category><![CDATA[Flash 3D]]></category>

		<guid isPermaLink="false">http://www.timovirtanen.com/?p=671</guid>
		<description><![CDATA[Long story short. Here is a Shooter Demo we made at Talvi Digital at the end of this week. Boy was that fun . If only I had the time to make a real game. Well, I keep on dreaming.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.talvi.com/asiakas/demo/shooter/"><img class="alignnone size-full wp-image-672" title="shooter" src="http://timovirtanen.com/wp-content/uploads/2009/02/shooter.png" alt="shooter" width="445" height="224" /></a></p>
<p>Long story short. Here is a <a href="http://www.talvi.com/asiakas/demo/shooter/">Shooter Demo</a> we made at <a href="http://talvi.com/experiments/">Talvi Digital</a> at the end of this week. Boy was that fun <img src='http://www.timovirtanen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . If only I had the time to make a real game. Well, I keep on dreaming.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.timovirtanen.com/2009/02/27/3rd-person-shooter-demo-with-away3d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check domain demo</title>
		<link>http://www.timovirtanen.com/2009/02/01/check-domain-demo/</link>
		<comments>http://www.timovirtanen.com/2009/02/01/check-domain-demo/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 11:48:34 +0000</pubDate>
		<dc:creator>Timo Virtanen</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Flash & Flex]]></category>

		<guid isPermaLink="false">http://www.timovirtanen.com/?p=564</guid>
		<description><![CDATA[I made this small app a while ago. I figured this could be useful for someone so I decided to post it here with the source. It is relatively simple so I guess no in depth explanation is needed here. However, if you are new to Zend framework I recommend watching this tutorial from Lee [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.timovirtanen.com/wp-content/uploads/domaincheck/"><img class="alignnone size-full wp-image-632" title="dc" src="http://timovirtanen.com/wp-content/uploads/2009/02/dc.png" alt="dc" width="445" height="224" /></a></p>
<p>I made this small app a while ago. I figured this could be useful for someone so I decided to post it here with the source. It is relatively simple so I guess no in depth explanation is needed here. <img src='http://www.timovirtanen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  However, if you are new to Zend framework I recommend watching <a title="Introduction to ZendAMF" href="http://www.gotoandlearn.com/play?id=90">this tutorial</a> from <a href="http://theflashblog.com/">Lee Brimelow</a>.</p>
<p>You can also download the ZendAMF bootstrap file and other related files needed to get the application work properly. I included <a href="http://www.rheinschmiede.de/kontakt/">Sven Wageners</a> amazingÂ  <a href="http://phpclasses.mkdata.net/browse/file/2329.html">domain.class.php</a> script in the download. That is the place where the actual search happens.</p>
<p><strong><a title="View Domain Check demo" href="http://www.timovirtanen.com/wp-content/uploads/domaincheck/">Â» LIVE DEMO</a></strong> |<strong> <a title="Download Flex source" href="http://www.timovirtanen.com/wp-content/uploads/domaincheck/srcview">Â» VIEW FLEX SOURCE</a></strong> | <strong><a title="Download AMF source" href="http://www.timovirtanen.com/wp-content/uploads/domaincheck/AMFSource.zip">Â» DOWNLOAD AMF SOURCE</a><br />
</strong></p>
<p><strong>Zend Framework / Zend AMF downloads:</strong><br />
<span id="more-564"></span></p>
<ul>
<li><a href="http://www.zendframework.com/download/latest">The latest Zend Framework (The whole set)</a></li>
<li><a href="http://www.zendframework.com/download/amf">The latest ZendAMF (Only the parts needed to get remoting working)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.timovirtanen.com/2009/02/01/check-domain-demo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Feed Reader Demo</title>
		<link>http://www.timovirtanen.com/2009/02/01/feed-reader-demo/</link>
		<comments>http://www.timovirtanen.com/2009/02/01/feed-reader-demo/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 22:04:32 +0000</pubDate>
		<dc:creator>Timo Virtanen</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Flash & Flex]]></category>

		<guid isPermaLink="false">http://www.timovirtanen.com/?p=604</guid>
		<description><![CDATA[Here is a simple feed reader app I made with Flex. It accepts RSS2.0 and Atom1.0. I included some error checking and validation to make sure that the URL or feed is valid but it could sure be better. Much better . I used Adobes as3syndicationlib to parse the feed data so if you need [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.timovirtanen.com/fdrider/RSSReaderExample.html"><img class="alignnone size-full wp-image-605" title="feedrider" src="http://timovirtanen.com/wp-content/uploads/2009/01/feedrider.png" alt="feedrider" width="445" height="224" /></a></p>
<p>Here is a simple feed reader app I made with Flex. It accepts RSS2.0 and Atom1.0. I included some error checking and validation to make sure that the URL or feed is valid but it could sure be better. Much better <img src='http://www.timovirtanen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
<p>I used Adobes <a href="http://code.google.com/p/as3syndicationlib/">as3syndicationlib</a> to parse the feed data so if you need more information about it go check <a href="http://code.google.com/p/as3syndicationlib/wiki/Resources">this article</a>. &#8220;<a href="http://www.timovirtanen.com/fdrider/srcview/index.html">View Source</a>&#8221; is enabled so you can download the files and study the application. Anyway check out the <a href="http://www.timovirtanen.com/fdrider/RSSReaderExample.html">demo (Feed Rider)</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.timovirtanen.com/2009/02/01/feed-reader-demo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The 25-Line ActionScript Contest</title>
		<link>http://www.timovirtanen.com/2008/12/10/the-25-line-actionscript-contest/</link>
		<comments>http://www.timovirtanen.com/2008/12/10/the-25-line-actionscript-contest/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 08:39:51 +0000</pubDate>
		<dc:creator>Timo Virtanen</dc:creator>
				<category><![CDATA[Demo]]></category>
		<category><![CDATA[Flash & Flex]]></category>

		<guid isPermaLink="false">http://www.timovirtanen.com/?p=440</guid>
		<description><![CDATA[The finalists are here. Go to &#8220;The 25-Line ActionScript Contest&#8220;, if you haven&#8217;t already, and vote for your favorite demo. May the best 25 lines win.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.25lines.com/?page_id=139"><img class="alignnone size-full wp-image-441" title="25line" src="http://timovirtanen.com/wp-content/uploads/2008/12/25line.png" alt="" width="445" height="224" /></a>The finalists are here. Go to &#8220;<a href="http://www.25lines.com/?page_id=139">The 25-Line ActionScript Contest</a>&#8220;, if you haven&#8217;t already, and vote for your favorite demo.<br />
May the best <strong>25 lines</strong> win. <img src='http://www.timovirtanen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.timovirtanen.com/2008/12/10/the-25-line-actionscript-contest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Water/Flag effect</title>
		<link>http://www.timovirtanen.com/2008/08/16/waterflag-effect/</link>
		<comments>http://www.timovirtanen.com/2008/08/16/waterflag-effect/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 09:24:41 +0000</pubDate>
		<dc:creator>Timo Virtanen</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Flash 3D]]></category>

		<guid isPermaLink="false">http://www.timovirtanen.com/?p=226</guid>
		<description><![CDATA[I found this post a few days ago and desided to try something similar. My experiment is far more simplier compared to Exey Panteleevs demo but the result is pretty goot anyway. Click the plane to switch between water and flag. Water/Flag demo page And here is the source: (WaterPlaneDemo.as) package &#123; import flash.display.Sprite; import [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.timovirtanen.com/wp-content/uploads/water/"><img src="http://timovirtanen.com/wp-content/uploads/2008/08/water1.png" alt="" title="water1" width="445" height="224" class="alignnone size-full wp-image-230" /></a></p>
<p>I found <a href="http://exey.ru/blog/home/fluid-simulation-pv3d-and-away3d">this post</a> a few days ago and desided to try something similar. My experiment is far more simplier compared to <a href="http://exey.ru/blog/home/fluid-simulation-pv3d-and-away3d">Exey Panteleevs</a> demo but the result is pretty goot anyway.</p>
<p>Click the plane to switch between water and flag.<br />
<a href="http://www.timovirtanen.com/wp-content/uploads/water/">Water/Flag demo page</a></p>
<p><span id="more-226"></span></p>
<p><strong>And here is the source: (WaterPlaneDemo.as)</strong></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">package</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">display</span>.<span style="color: #660066;">Sprite</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">import</span> flash.<span style="color: #660066;">events</span>.<span style="color: #660066;">Event</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">import</span> org.<span style="color: #660066;">papervision3d</span>.<span style="color: #660066;">objects</span>.<span style="color: #660066;">primitives</span>.<span style="color: #660066;">Plane</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">import</span> org.<span style="color: #660066;">papervision3d</span>.<span style="color: #660066;">view</span>.<span style="color: #660066;">BasicView</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">import</span> org.<span style="color: #660066;">papervision3d</span>.<span style="color: #660066;">materials</span>.<span style="color: #660066;">BitmapFileMaterial</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">import</span> org.<span style="color: #660066;">papervision3d</span>.<span style="color: #660066;">events</span>.<span style="color: #660066;">InteractiveScene3DEvent</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">class</span> WaterPlaneDemo <span style="color: #003366; font-weight: bold;">extends</span> Sprite
<span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> v<span style="color: #339933;">:</span>BasicView <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> BasicView<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">800</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">600</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> plane<span style="color: #339933;">:</span>Plane<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> bitmap<span style="color: #339933;">:</span>BitmapFileMaterial<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> bitmap2<span style="color: #339933;">:</span>BitmapFileMaterial<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> planeSegs<span style="color: #339933;">:</span>int <span style="color: #339933;">=</span> <span style="color: #CC0000;">12</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> vertexArray<span style="color: #339933;">:</span>Array<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> directionArray<span style="color: #339933;">:</span>Array <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">var</span> speedArray<span style="color: #339933;">:</span>Array <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">public</span> <span style="color: #003366; font-weight: bold;">function</span> WaterPlaneDemo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
initPV3D<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
addEventListener<span style="color: #009900;">&#40;</span>Event.<span style="color: #660066;">ENTER_FRAME</span><span style="color: #339933;">,</span> render3D<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> initPV3D<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
addChild<span style="color: #009900;">&#40;</span>v.<span style="color: #660066;">viewport</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
bitmap <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> BitmapFileMaterial<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;water.jpg&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
bitmap2 <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> BitmapFileMaterial<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;flag.jpg&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
bitmap2.<span style="color: #660066;">smooth</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
bitmap.<span style="color: #660066;">smooth</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
bitmap2.<span style="color: #660066;">interactive</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
bitmap.<span style="color: #660066;">interactive</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
plane <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Plane<span style="color: #009900;">&#40;</span>bitmap<span style="color: #339933;">,</span> <span style="color: #CC0000;">1000</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">668</span><span style="color: #339933;">,</span> planeSegs<span style="color: #339933;">,</span> planeSegs <span style="color: #339933;">-</span> <span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
plane.<span style="color: #660066;">localRotationX</span> <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">90</span><span style="color: #339933;">;</span>
v.<span style="color: #660066;">scene</span>.<span style="color: #660066;">addChild</span><span style="color: #009900;">&#40;</span>plane<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
v.<span style="color: #660066;">camera</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">500</span><span style="color: #339933;">;</span>
&nbsp;
plane.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>InteractiveScene3DEvent.<span style="color: #660066;">OBJECT_CLICK</span><span style="color: #339933;">,</span> changeMaterial<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
createArrays<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> changeMaterial<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span>InteractiveScene3DEvent<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>plane.<span style="color: #660066;">material</span> <span style="color: #339933;">==</span> bitmap<span style="color: #009900;">&#41;</span> plane.<span style="color: #660066;">material</span> <span style="color: #339933;">=</span> bitmap2<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">else</span> plane.<span style="color: #660066;">material</span> <span style="color: #339933;">=</span> bitmap<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> createArrays<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #003366; font-weight: bold;">var</span> dir <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
vertexArray <span style="color: #339933;">=</span> plane.<span style="color: #660066;">geometry</span>.<span style="color: #660066;">vertices</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> vertexArray.<span style="color: #660066;">length</span> <span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	directionArray.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>dir<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	speedArray.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>Math.<span style="color: #660066;">random</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">1.1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	dir <span style="color: #339933;">*=</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> doWaterEffect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> vertexArray.<span style="color: #660066;">length</span> <span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>	
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>Math.<span style="color: #660066;">abs</span><span style="color: #009900;">&#40;</span>vertexArray<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">z</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">15</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		directionArray<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">*=</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	vertexArray<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">z</span> <span style="color: #339933;">+=</span> directionArray<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">*</span> speedArray<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">private</span> <span style="color: #003366; font-weight: bold;">function</span> render3D<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span>Event<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
v.<span style="color: #660066;">singleRender</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>doWaterEffect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
v.<span style="color: #660066;">camera</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> v.<span style="color: #660066;">camera</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> v.<span style="color: #660066;">camera</span>.<span style="color: #660066;">z</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
v.<span style="color: #660066;">camera</span>.<span style="color: #660066;">yaw</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span>.1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
v.<span style="color: #660066;">camera</span>.<span style="color: #660066;">moveBackward</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
v.<span style="color: #660066;">camera</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">400</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.timovirtanen.com/2008/08/16/waterflag-effect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

