<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Professional Papervision3D Book</title>
	<atom:link href="http://professionalpapervision.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://professionalpapervision.wordpress.com</link>
	<description>by Mike Lively</description>
	<lastBuildDate>Fri, 05 Jun 2009 19:13:40 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
		<url>http://www.gravatar.com/blavatar/a98e58b6baa8a0d92f432b30fddecaeb?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Professional Papervision3D Book</title>
		<link>http://professionalpapervision.wordpress.com</link>
	</image>
			<item>
		<title>Jiglibflash Pong Game with Levels</title>
		<link>http://professionalpapervision.wordpress.com/2009/06/05/jiglibflash-pong-game-with-game-levels/</link>
		<comments>http://professionalpapervision.wordpress.com/2009/06/05/jiglibflash-pong-game-with-game-levels/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 19:07:21 +0000</pubDate>
		<dc:creator>Mike Lively</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[JigLib]]></category>

		<guid isPermaLink="false">http://professionalpapervision.wordpress.com/?p=1647</guid>
		<description><![CDATA[Intro 
Here&#8217;s Pong in JiglibFlash and PV3D that I created. It&#8217;s fully explained in the book (and the Wii controller is added as well)!
Directions: Click Drag to Move Around the game. Move your mouse up and down to control the game paddle. 21 points and you win the level, get to level six, and you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1647&subd=professionalpapervision&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Intro </strong></p>
<p>Here&#8217;s Pong in JiglibFlash and PV3D that I created. It&#8217;s fully explained in the book (and the Wii controller is added as well)!</p>
<p><strong>Directions</strong>: Click Drag to Move Around the game. Move your mouse up and down to control the game paddle. 21 points and you win the level, get to level six, and you beat the computer. I&#8217;ve never made it to level six&#8230;</p>
<p>A bounding box had to be created by Hacking the PV3D plugin created by <em>Bartek Drozd</em>&#8230;the rest was easy.</p>
<div id="attachment_1648" class="wp-caption aligncenter" style="width: 470px"><a href="http://www.professionalpapervision.com/demos/pong/PongGame.html"><img class="size-full wp-image-1648" title="Pong" src="http://professionalpapervision.files.wordpress.com/2009/06/pong.png?w=460&#038;h=265" alt="Pong in 3D" width="460" height="265" /></a><p class="wp-caption-text">Pong in 3D</p></div>
<p><a title="Pong" href="http://www.professionalpapervision.com/demos/pong/PongGame.html" target="_blank">Demo</a></p>
<p><a title="Pong Zip" href="http://flex3cookbook3.googlecode.com/files/Pong.zip" target="_blank">Source</a></p>
<p>Of course many thanks to Seb Lee-Delisle, who created a similar game in PV3D, it wasn&#8217;t Jiglib and not mutli-level, but it was a good place to start and Seb released it under the Commons license-thanks Seb! And thanks to Barteck Drozd who created the PV3D Jiglib plugin that I hacked to create a Pong Bounding box.</p>
<p>The book is almost done&#8230;when it is, I&#8217;ll start posting more frequently&#8230;sorry about the down time.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/professionalpapervision.wordpress.com/1647/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/professionalpapervision.wordpress.com/1647/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/professionalpapervision.wordpress.com/1647/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/professionalpapervision.wordpress.com/1647/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/professionalpapervision.wordpress.com/1647/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/professionalpapervision.wordpress.com/1647/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/professionalpapervision.wordpress.com/1647/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/professionalpapervision.wordpress.com/1647/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/professionalpapervision.wordpress.com/1647/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/professionalpapervision.wordpress.com/1647/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1647&subd=professionalpapervision&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://professionalpapervision.wordpress.com/2009/06/05/jiglibflash-pong-game-with-game-levels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eb5a0d289883e5e5bee87c7ee2391cdc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/06/pong.png" medium="image">
			<media:title type="html">Pong</media:title>
		</media:content>
	</item>
		<item>
		<title>Spring Camera with Arrow Control (Flash)</title>
		<link>http://professionalpapervision.wordpress.com/2009/05/13/spring-camera-with-arrow-control-flash/</link>
		<comments>http://professionalpapervision.wordpress.com/2009/05/13/spring-camera-with-arrow-control-flash/#comments</comments>
		<pubDate>Wed, 13 May 2009 22:36:17 +0000</pubDate>
		<dc:creator>Mike Lively</dc:creator>
				<category><![CDATA[Papervision]]></category>

		<guid isPermaLink="false">http://professionalpapervision.wordpress.com/?p=1640</guid>
		<description><![CDATA[Intro
I did a port into Papervision3D of the famous Spring Camera example in Away3D. I threw out a few things and added arrow control so you can change the speed of your navigating rod.
It didn&#8217;t make the book, but I was able to build a galaxy cruiser out of the next iteration that did.
I&#8217;ll start [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1640&subd=professionalpapervision&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Intro</strong></p>
<p>I did a port into Papervision3D of the famous Spring Camera example in Away3D. I threw out a few things and added arrow control so you can change the speed of your navigating rod.</p>
<p>It didn&#8217;t make the book, but I was able to build a galaxy cruiser out of the next iteration that did.</p>
<div id="attachment_1641" class="wp-caption aligncenter" style="width: 360px"><a href="http://www.professionalpapervision.com/demos/web/springport/"><img class="size-full wp-image-1641" title="portofspringBlog" src="http://professionalpapervision.files.wordpress.com/2009/05/portofspringblog.png?w=350&#038;h=208" alt="Spring Camera Port" width="350" height="208" /></a><p class="wp-caption-text">Spring Camera Port</p></div>
<p>I&#8217;ll start beefing up the explanations once the book is done&#8230;sorry about the short introduction. The source code is given below.</p>
<p><a title="Spring Camera Port" href="http://www.professionalpapervision.com/demos/web/springport/" target="_blank">Demo</a></p>
<p><a title="Spring Camera Source" href="http://flex3cookbook3.googlecode.com/files/post.zip" target="_blank">Source</a></p>
<p>Best &#8230; Mike</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/professionalpapervision.wordpress.com/1640/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/professionalpapervision.wordpress.com/1640/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/professionalpapervision.wordpress.com/1640/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/professionalpapervision.wordpress.com/1640/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/professionalpapervision.wordpress.com/1640/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/professionalpapervision.wordpress.com/1640/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/professionalpapervision.wordpress.com/1640/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/professionalpapervision.wordpress.com/1640/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/professionalpapervision.wordpress.com/1640/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/professionalpapervision.wordpress.com/1640/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1640&subd=professionalpapervision&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://professionalpapervision.wordpress.com/2009/05/13/spring-camera-with-arrow-control-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eb5a0d289883e5e5bee87c7ee2391cdc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/05/portofspringblog.png" medium="image">
			<media:title type="html">portofspringBlog</media:title>
		</media:content>
	</item>
		<item>
		<title>Jiglib Flash Example Viewer (Using Flex Modules)</title>
		<link>http://professionalpapervision.wordpress.com/2009/05/11/jiglib-flash-example-viewer-using-flex-modules/</link>
		<comments>http://professionalpapervision.wordpress.com/2009/05/11/jiglib-flash-example-viewer-using-flex-modules/#comments</comments>
		<pubDate>Mon, 11 May 2009 12:44:52 +0000</pubDate>
		<dc:creator>Mike Lively</dc:creator>
				<category><![CDATA[Papervision]]></category>

		<guid isPermaLink="false">http://professionalpapervision.wordpress.com/?p=1635</guid>
		<description><![CDATA[Intro
I built this JiglibFlash example viewer using Flex modules as a demo for Chapter 9 of the book. It&#8217;s fully explained in the book, but I thought I would share the code with you before the book is published. Check it out below:
Demo
Source
I&#8217;m finishing the book this month, so not much time for explanation or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1635&subd=professionalpapervision&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Intro</strong></p>
<p>I built this JiglibFlash example viewer using Flex modules as a demo for Chapter 9 of the book. It&#8217;s fully explained in the book, but I thought I would share the code with you before the book is published. Check it out below:</p>
<div id="attachment_1637" class="wp-caption aligncenter" style="width: 390px"><a href="http://www.professionalpapervision.com/demos/web/jiglib/"><img class="size-full wp-image-1637" title="jiglibexamplesbook" src="http://professionalpapervision.files.wordpress.com/2009/05/jiglibexamplesbook1.png?w=380&#038;h=281" alt="Jiglib Examples using Flex Modules" width="380" height="281" /></a><p class="wp-caption-text">Jiglib Examples using Flex Modules</p></div>
<p><a title="Jiglib Examples" href="http://www.professionalpapervision.com/demos/web/jiglib/" target="_blank">Demo</a></p>
<p><a title="Jiglib Examples Source" href="http://flex3cookbook3.googlecode.com/files/JiglibViewer.zip" target="_blank">Source</a><br />
I&#8217;m finishing the book this month, so not much time for explanation or many posts. Once the book is finished I&#8217;ll start posting like crazy again.</p>
<p>Best Regards&#8230;Mike</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/professionalpapervision.wordpress.com/1635/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/professionalpapervision.wordpress.com/1635/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/professionalpapervision.wordpress.com/1635/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/professionalpapervision.wordpress.com/1635/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/professionalpapervision.wordpress.com/1635/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/professionalpapervision.wordpress.com/1635/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/professionalpapervision.wordpress.com/1635/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/professionalpapervision.wordpress.com/1635/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/professionalpapervision.wordpress.com/1635/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/professionalpapervision.wordpress.com/1635/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1635&subd=professionalpapervision&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://professionalpapervision.wordpress.com/2009/05/11/jiglib-flash-example-viewer-using-flex-modules/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eb5a0d289883e5e5bee87c7ee2391cdc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/05/jiglibexamplesbook1.png" medium="image">
			<media:title type="html">jiglibexamplesbook</media:title>
		</media:content>
	</item>
		<item>
		<title>SketchUp for the Supper Club by Rebecca Wilson</title>
		<link>http://professionalpapervision.wordpress.com/2009/04/27/sketchup-for-the-super-club-by-rebecca-wilson/</link>
		<comments>http://professionalpapervision.wordpress.com/2009/04/27/sketchup-for-the-super-club-by-rebecca-wilson/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 18:16:31 +0000</pubDate>
		<dc:creator>Mike Lively</dc:creator>
				<category><![CDATA[Papervision]]></category>

		<guid isPermaLink="false">http://professionalpapervision.wordpress.com/?p=1619</guid>
		<description><![CDATA[Intro
Rebecca Wilson, one of my graphic designers, has just completed a series of introductory tutorials on SketchUp. In the tutorials she demonstrates how to use SketchUp to build the rooms in the Beverly Hills Supper club.
Video 1 Basic Tools


Video 2 Model a Room


Video 3 Importing Furniture


Video 4 Texturing


Image
Below are some Images of what Rebecca created:

 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1619&subd=professionalpapervision&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Intro</strong></p>
<p>Rebecca Wilson, one of my graphic designers, has just completed a series of introductory tutorials on SketchUp. In the tutorials she demonstrates how to use SketchUp to build the rooms in the Beverly Hills Supper club.</p>
<p><strong>Video 1 Basic Tools</strong></p>
<p><strong><span style="text-align:center; display: block;"><a href="http://professionalpapervision.wordpress.com/2009/04/27/sketchup-for-the-super-club-by-rebecca-wilson/"><img src="http://img.youtube.com/vi/fJOPT0XW1PI/2.jpg" alt="" /></a></span><br />
</strong></p>
<p><strong>Video 2 Model a Room<br />
</strong></p>
<p><strong><span style="text-align:center; display: block;"><a href="http://professionalpapervision.wordpress.com/2009/04/27/sketchup-for-the-super-club-by-rebecca-wilson/"><img src="http://img.youtube.com/vi/o6A15WI4KiI/2.jpg" alt="" /></a></span></strong></p>
<p><strong>Video 3 Importing Furniture<br />
</strong></p>
<p><strong><span style="text-align:center; display: block;"><a href="http://professionalpapervision.wordpress.com/2009/04/27/sketchup-for-the-super-club-by-rebecca-wilson/"><img src="http://img.youtube.com/vi/DayW4vcBTdU/2.jpg" alt="" /></a></span></strong></p>
<p><strong>Video 4 Texturing<br />
</strong></p>
<p><strong><span style="text-align:center; display: block;"><a href="http://professionalpapervision.wordpress.com/2009/04/27/sketchup-for-the-super-club-by-rebecca-wilson/"><img src="http://img.youtube.com/vi/21JFgZic_IQ/2.jpg" alt="" /></a></span></strong></p>
<p><strong>Image</strong></p>
<p>Below are some Images of what Rebecca created:</p>
<div id="attachment_1621" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-1621" title="buildingoutline1450" src="http://professionalpapervision.files.wordpress.com/2009/04/buildingoutline1450.png?w=450&#038;h=277" alt="Building Outline Around Room 1" width="450" height="277" /><p class="wp-caption-text">Building Outline Around Room 1</p></div>
<div id="attachment_1622" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-1622" title="buildingoutline2450" src="http://professionalpapervision.files.wordpress.com/2009/04/buildingoutline2450.png?w=450&#038;h=291" alt="Building Outline Around Room 2" width="450" height="291" /><p class="wp-caption-text">Building Outline Around Room 2</p></div>
<div id="attachment_1623" class="wp-caption aligncenter" style="width: 470px"><img class="size-full wp-image-1623" title="cabaretroom1" src="http://professionalpapervision.files.wordpress.com/2009/04/cabaretroom1.png?w=460&#038;h=270" alt="Cabaret Room 1" width="460" height="270" /><p class="wp-caption-text">Cabaret Room 1</p></div>
<div id="attachment_1624" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-1624" title="cabaretroom2450" src="http://professionalpapervision.files.wordpress.com/2009/04/cabaretroom2450.png?w=450&#038;h=258" alt="Cabaret Room 2" width="450" height="258" /><p class="wp-caption-text">Cabaret Room 2</p></div>
<div id="attachment_1625" class="wp-caption aligncenter" style="width: 470px"><img class="size-full wp-image-1625" title="vienneseroom1" src="http://professionalpapervision.files.wordpress.com/2009/04/vienneseroom1.png?w=460&#038;h=252" alt="Viennese Room 1" width="460" height="252" /><p class="wp-caption-text">Viennese Room 1</p></div>
<p><strong></strong></p>
<div id="attachment_1626" class="wp-caption aligncenter" style="width: 470px"><strong><strong><img class="size-full wp-image-1626" title="vienneseroom2" src="http://professionalpapervision.files.wordpress.com/2009/04/vienneseroom2.png?w=460&#038;h=269" alt="Viennese Room 2" width="460" height="269" /></strong></strong><p class="wp-caption-text">Viennese Room 2</p></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/professionalpapervision.wordpress.com/1619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/professionalpapervision.wordpress.com/1619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/professionalpapervision.wordpress.com/1619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/professionalpapervision.wordpress.com/1619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/professionalpapervision.wordpress.com/1619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/professionalpapervision.wordpress.com/1619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/professionalpapervision.wordpress.com/1619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/professionalpapervision.wordpress.com/1619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/professionalpapervision.wordpress.com/1619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/professionalpapervision.wordpress.com/1619/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1619&subd=professionalpapervision&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://professionalpapervision.wordpress.com/2009/04/27/sketchup-for-the-super-club-by-rebecca-wilson/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eb5a0d289883e5e5bee87c7ee2391cdc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/fJOPT0XW1PI/2.jpg" medium="image" />

		<media:content url="http://img.youtube.com/vi/o6A15WI4KiI/2.jpg" medium="image" />

		<media:content url="http://img.youtube.com/vi/DayW4vcBTdU/2.jpg" medium="image" />

		<media:content url="http://img.youtube.com/vi/21JFgZic_IQ/2.jpg" medium="image" />

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/04/buildingoutline1450.png" medium="image">
			<media:title type="html">buildingoutline1450</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/04/buildingoutline2450.png" medium="image">
			<media:title type="html">buildingoutline2450</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/04/cabaretroom1.png" medium="image">
			<media:title type="html">cabaretroom1</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/04/cabaretroom2450.png" medium="image">
			<media:title type="html">cabaretroom2450</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/04/vienneseroom1.png" medium="image">
			<media:title type="html">vienneseroom1</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/04/vienneseroom2.png" medium="image">
			<media:title type="html">vienneseroom2</media:title>
		</media:content>
	</item>
		<item>
		<title>Flash CS4 Planetarium in 49 Lines</title>
		<link>http://professionalpapervision.wordpress.com/2009/04/22/flash-cs4-planetarium-in-49-lines/</link>
		<comments>http://professionalpapervision.wordpress.com/2009/04/22/flash-cs4-planetarium-in-49-lines/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 18:55:12 +0000</pubDate>
		<dc:creator>Mike Lively</dc:creator>
				<category><![CDATA[CS4]]></category>
		<category><![CDATA[Particles]]></category>
		<category><![CDATA[Physics]]></category>

		<guid isPermaLink="false">http://professionalpapervision.wordpress.com/?p=1598</guid>
		<description><![CDATA[Intro
In Chapter 7 of the book I change the  Planetarium example (shown in a previous post) so that it only uses XML (threw out Cairngorm). And in the process I thought, hey this should be easy to do in CS4. And it was! Check it out below&#8230;a planetarium (with real star data) in 49 lines [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1598&subd=professionalpapervision&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Intro</strong></p>
<p>In Chapter 7 of the book I change the  Planetarium example (shown in a previous post) so that it only uses XML (threw out Cairngorm). And in the process I thought, hey this should be easy to do in CS4. And it was! Check it out below&#8230;a planetarium (with real star data) in 49 lines of code&#8230;including comments.</p>
<div id="attachment_1599" class="wp-caption aligncenter" style="width: 314px"><a href="http://www.professionalpapervision.com/demos/web/CS4Planetarium/"><img class="size-full wp-image-1599" title="myplanetarium" src="http://professionalpapervision.files.wordpress.com/2009/04/myplanetarium.png?w=304&#038;h=312" alt="Flash CS4 Planetarium in 49 Lines" width="304" height="312" /></a><p class="wp-caption-text">Flash CS4 Planetarium in 49 Lines</p></div>
<p><a title="CS4 Planetarium" href="http://www.professionalpapervision.com/demos/web/CS4Planetarium/" target="_blank"><strong>Demo</strong></a></p>
<p><a title="CS4 Planetarium" href="http://flex3cookbook3.googlecode.com/files/CS4Planetarium.zip" target="_blank">Source</a></p>
<p><span style="text-align:center; display: block;"><a href="http://professionalpapervision.wordpress.com/2009/04/22/flash-cs4-planetarium-in-49-lines/"><img src="http://img.youtube.com/vi/Hv6jEihoS80/2.jpg" alt="" /></a></span></p>
<p><strong>Disucssion</strong></p>
<p>There are two main steps in getting this to go:</p>
<p><strong>Step 1:</strong> Get a star object into your library so you can instantiate it onto the stage like you would your particles class &#8211; this step saves you tons of code:   var myStar = new Star();</p>
<div id="attachment_1604" class="wp-caption aligncenter" style="width: 298px"><img class="size-full wp-image-1604" title="libarystar" src="http://professionalpapervision.files.wordpress.com/2009/04/libarystar.png?w=288&#038;h=164" alt="Star in the Library for Instantiation" width="288" height="164" /><p class="wp-caption-text">Star in the Library for Instantiation</p></div>
<p><strong>Step 2</strong>: Treat your stars like a particle system. This lets your stuff then into an updatable array so you can rotate them:</p>
<p>The rest of this stuff you&#8217;ve seen before, and I go through the discussion in the book and in the YouTube video above so I just show the code below:  myParticles[j]</p>
<p><strong>Sample Star Data (</strong><strong>CSV)<br />
</strong><br />
AND, 2.065, 42.316, 0,<br />
AND, 1.161, 35.616, 1,<br />
AND, 0.655, 30.85, 1,<br />
AND, 0.139, 29.083, 1,<strong><br />
</strong></p>
<p><strong>CS4 Planetarium in 49 lines</strong></p>
<p>import flash.events.*;<br />
import flash.display.*;</p>
<p>//Create star parameters<br />
var myStar:Star;<br />
var skyRadius:Number = 240;<br />
var myOsc:int=0;<br />
var starHolder:MovieClip= new MovieClip();</p>
<p>//Create a star array to hold CSVdata and particle array<br />
var starArray:Array=new Array();<br />
var myParticles = new Array();</p>
<p>//XML Statements used to bring in XML data<br />
var urlRequest:URLRequest = new URLRequest(&#8221;data/starData.xml&#8221;);<br />
var xmlLoader:URLLoader = new URLLoader(urlRequest);<br />
xmlLoader.addEventListener(&#8221;complete&#8221;, readXml);</p>
<p>//XML parser and CSV splitter<br />
function readXml(event:Event):void{<br />
var markersXML:XML = new XML(event.target.data);<br />
starArray=markersXML.myStars.split(&#8221;,&#8221;);</p>
<p>//Set the initial star system in place and add to a Movie holder<br />
for(var i:uint = 0; i &lt;  starArray.length/4; i++){</p>
<p>//Instantiate stars and place them in a particle array<br />
var myStar = new Star();<br />
myParticles.push(myStar);<br />
starHolder.addChild(myStar);</p>
<p>//Position stars (x, y, z) on stage<br />
myStar.x=skyRadius*(Math.cos(2*Math.PI*starArray[4*i+1]/24)*Math.sin((90-starArray[4*i+2])*Math.PI/180));<br />
myStar.z=-skyRadius*(Math.sin(2*Math.PI*starArray[4*i+1]/24)*Math.sin((90-starArray[4*i+2])*Math.PI/180));<br />
myStar.y=skyRadius*Math.cos((90-starArray[4*i+2])*Math.PI/180);</p>
<p>//Scale stars according to magnitude and give a rand rotation<br />
myStar.scaleX=myStar.scaleY=(1/9)*(3-starArray[(4*i+3)]);<br />
myStar.rotation=180*Math.random();<br />
}</p>
<p>//Add stars to star holder and position the holder<br />
addChild(starHolder);<br />
starHolder.x=400;<br />
starHolder.y=300;</p>
<p>//Create your animation loop using an Enter Frame Listener<br />
this.addEventListener(Event.ENTER_FRAME, onEnterFrame);<br />
}</p>
<p>function onEnterFrame(event:Event):void{<br />
//Increment oscillation parameter and iterate over stars<br />
myOsc++;<br />
for(var j:uint = 0; j &lt;  starArray.length/4; j++){</p>
<p>//Set new x, y, z for your stars as they rotate<br />
myParticles[j].x=skyRadius*(Math.cos(2*Math.PI*starArray[4*j+1]/24+myOsc/180)*Math.sin((90-starArray[4*j+2])*Math.PI/180));<br />
myParticles[j].z=-skyRadius*(Math.sin(2*Math.PI*starArray[4*j+1]/24+myOsc/180)*Math.sin((90-starArray[4*j+2])*Math.PI/180));<br />
myParticles[j].y=skyRadius*Math.cos((90-starArray[4*j+2])*Math.PI/180);<br />
}}</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/professionalpapervision.wordpress.com/1598/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/professionalpapervision.wordpress.com/1598/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/professionalpapervision.wordpress.com/1598/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/professionalpapervision.wordpress.com/1598/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/professionalpapervision.wordpress.com/1598/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/professionalpapervision.wordpress.com/1598/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/professionalpapervision.wordpress.com/1598/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/professionalpapervision.wordpress.com/1598/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/professionalpapervision.wordpress.com/1598/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/professionalpapervision.wordpress.com/1598/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1598&subd=professionalpapervision&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://professionalpapervision.wordpress.com/2009/04/22/flash-cs4-planetarium-in-49-lines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eb5a0d289883e5e5bee87c7ee2391cdc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/04/myplanetarium.png" medium="image">
			<media:title type="html">myplanetarium</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/Hv6jEihoS80/2.jpg" medium="image" />

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/04/libarystar.png" medium="image">
			<media:title type="html">libarystar</media:title>
		</media:content>
	</item>
		<item>
		<title>Putting 3D Google Maps on the Web (using Flash 10)</title>
		<link>http://professionalpapervision.wordpress.com/2009/04/18/putting-3d-google-maps-on-the-web-using-flash-10/</link>
		<comments>http://professionalpapervision.wordpress.com/2009/04/18/putting-3d-google-maps-on-the-web-using-flash-10/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 21:39:48 +0000</pubDate>
		<dc:creator>Mike Lively</dc:creator>
				<category><![CDATA[3D Modeling]]></category>
		<category><![CDATA[CS4]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[CS]]></category>

		<guid isPermaLink="false">http://professionalpapervision.wordpress.com/?p=1589</guid>
		<description><![CDATA[Intro
To this point, I&#8217;ve been putting Google Maps into Air applications due to the Flash Sandbox issue encountered in PV3D (discussed in a previous post). But in CS4, guess what, it&#8217;s not an issue. They go right on the web as you can see from the demo below:

Demo
Source

Discussion

Now here is how you do it, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1589&subd=professionalpapervision&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Intro</strong></p>
<p>To this point, I&#8217;ve been putting Google Maps into Air applications due to the Flash Sandbox issue encountered in PV3D (discussed in a previous post). But in CS4, guess what, it&#8217;s not an issue. They go right on the web as you can see from the demo below:</p>
<p style="text-align:center;">
<div id="attachment_1592" class="wp-caption aligncenter" style="width: 360px"><a href="http://www.professionalpapervision.com/demos/projects/tour/"><img class="size-full wp-image-1592" title="mymap" src="http://professionalpapervision.files.wordpress.com/2009/04/mymap.png?w=350&#038;h=225" alt="Google Map in 3D on the Web" width="350" height="225" /></a><p class="wp-caption-text">Google Map in 3D on the Web</p></div>
<p><a title="Demo CS4 Google Maps" href="http://www.professionalpapervision.com/demos/projects/tour/" target="_blank"><strong>Demo</strong></a></p>
<p><strong><a title="Code Google Map in 3D" href="http://flex3cookbook3.googlecode.com/files/GoogleMapin3DonWeb.zip" target="_blank">Source</a></strong></p>
<p><span style="text-align:center; display: block;"><a href="http://professionalpapervision.wordpress.com/2009/04/18/putting-3d-google-maps-on-the-web-using-flash-10/"><img src="http://img.youtube.com/vi/6AWI6LYkwFc/2.jpg" alt="" /></a></span></p>
<p><strong>Discussion<br />
</strong></p>
<p>Now here is how you do it, and it&#8217;s so simple you will not believe it. Use the code below to put your map into a movie where it&#8217;s free to move freely in 3D.</p>
<p style="padding-left:30px;">movie.addChild(map);</p>
<p>Placing a Google Map on a CS4 Plane is easier in Flex 4 (Gumbo) than it is in PV3D. All you do is throw your map into a movie clip using the code below, and then center it to get your map pivot right. The code snippet below sets your map in a movie clip, centers its pivot, sets map controls, places your movie in a Flex canvas, and centers your movie on the stage.</p>
<p style="padding-left:30px;">//Place your map in a movie so you can position its pivot<br />
movie.addChild(map);</p>
<p style="padding-left:30px;">//Set your map pivot<br />
map.x=-map.width/2;<br />
map.y=-map.height/2;</p>
<p style="padding-left:30px;">//Add Map Controls<br />
map.addControl(new ZoomControl());<br />
map.addControl(new PositionControl());<br />
map.addControl(new MapTypeControl());</p>
<p style="padding-left:30px;">//Put your movie in a Flex Canvas<br />
mapHolder.rawChildren.addChild(movie);</p>
<p style="padding-left:30px;">//Center your Movie<br />
movie.z=0;<br />
movie.x=450;<br />
movie.y=300;</p>
<p>The map also has two additional Flex components; a button, which stops it from spinning and a slider, which adjusts its speed and direction of rotation.</p>
<p><span style="color:#ff0000;">This is the great power of CS4 over PV3D. You can now bring native Flex components into your 3D environment in conjunction with your 3D objects. Bringing Flex components into PV3D is a difficult task and requires the use of the draw BitmapData feature. But with CS4 it occurs natively, and those components can be manipulated in 3D as well.</span></p>
<p>Hey that&#8217;s it, how crazy can that be! And all the controls and buttons are fully functional and in the right place.</p>
<p>Note: You could have just rotated the map directly, but you put it in a movie to control positioning and its pivot point.</p>
<p>The rest of the code is shown in the link below and discussed in greater detail in Chapter 7 of the book.</p>
<p><span id="more-1589"></span></p>
<p><strong>Full Code</strong></p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;<br />
&lt;mx:Application xmlns:mx=&#8221;http://www.adobe.com/2006/mxml&#8221; xmlns:maps=&#8221;com.google.maps.*&#8221; layout=&#8221;absolute&#8221; width=&#8221;1200&#8243; height=&#8221;800&#8243;  backgroundGradientAlphas=&#8221;[1.0, 1.0]&#8221; backgroundGradientColors=&#8221;[#9B9FAB, #05184C]&#8220;&gt;<br />
&lt;maps:Map xmlns:maps=&#8221;com.google.maps.*&#8221;<br />
id=&#8221;map&#8221;<br />
mapevent_mapready=&#8221;onMapReady(event)&#8221;<br />
width=&#8221;800&#8243; height=&#8221;600&#8243;<br />
url=&#8221;http://www.professionalpapervision.com/demos/projects/tour/&#8221;<br />
key=&#8221;ABQIAAAA4LpFEu2In0mhf90kMq6mnRS-6gvR7plocG5jEAw_XBK5krTJ_RRxjCMUXsM0nZ0Gam53OPR26zHU5w&#8221;/&gt;</p>
<p>&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
import mx.events.SliderEvent;<br />
import com.google.maps.*;<br />
import com.google.maps.controls.*;<br />
import mx.events.MoveEvent;</p>
<p>//Create map holder, oscillation angle, and rotation parameters<br />
private var myAngle:Number=0;<br />
private var movie:MovieClip = new MovieClip();<br />
private var stopRotation:Boolean = false;<br />
private var rotationValue:Number = -.05;</p>
<p>//When the map is ready run this function<br />
private function onMapReady(event:Event):void {<br />
this.map.setCenter(new LatLng(40.736072,-73.992062), 14, MapType.NORMAL_MAP_TYPE);<br />
//Place your map in a move so you can position its pivot<br />
movie.addChild(map);<br />
//Set your map pivot<br />
map.x=-map.width/2;<br />
map.y=-map.height/2;<br />
//Add Map Controls<br />
map.addControl(new ZoomControl());<br />
map.addControl(new PositionControl());<br />
map.addControl(new MapTypeControl());<br />
//Put your movie in a Flex Canvas<br />
mapHolder.rawChildren.addChild(movie);<br />
//Center your Movie<br />
movie.z=0;<br />
movie.x=450;<br />
movie.y=300;</p>
<p>addEventListener(Event.ENTER_FRAME, frameLoop);</p>
<p>}</p>
<p>//Pause or rotate button for your map<br />
private function pauseRotate(event:MouseEvent):void{</p>
<p>if(mouseBtn.label=="Stop"){<br />
mouseBtn.label="Start";<br />
stopRotation = true;</p>
<p>}else{<br />
mouseBtn.label="Stop";<br />
stopRotation = false;<br />
}<br />
}</p>
<p>//Map Slider<br />
private function mySliderHere(event:SliderEvent):void{</p>
<p>rotationValue=-mySliderValue.value;</p>
<p>}</p>
<p>//Map animation loop - enable rotation<br />
private function frameLoop(event:Event):void<br />
{<br />
//Iterate animation variable<br />
//Rotate map if stopRotation is equal to false<br />
if(!stopRotation){</p>
<p>movie.rotationX+=rotationValue;</p>
<p>}<br />
}</p>
<p>//Set up canvas components below</p>
<p>]]&gt;<br />
&lt;/mx:Script&gt;</p>
<p>&lt;mx:Canvas x=&#8221;0&#8243; y=&#8221;0&#8243; width=&#8221;60&#8243; height=&#8221;73&#8243; id=&#8221;mapHolder&#8221;&gt;&lt;/mx:Canvas&gt;<br />
&lt;mx:Canvas x=&#8221;87&#8243; y=&#8221;7&#8243; width=&#8221;267&#8243; height=&#8221;65&#8243; backgroundColor=&#8221;#DFAAF7&#8243;&gt;<br />
&lt;mx:Button x=&#8221;19.5&#8243; y=&#8221;10&#8243; label=&#8221;Stop&#8221; id=&#8221;mouseBtn&#8221;   click=&#8221;pauseRotate(event)&#8221; /&gt;<br />
&lt;mx:HSlider x=&#8221;87.5&#8243; y=&#8221;15&#8243; minimum=&#8221;-4&#8243; maximum=&#8221;4&#8243; id=&#8221;mySliderValue&#8221; value=&#8221;.05&#8243; change=&#8221;mySliderHere(event)&#8221; /&gt;<br />
&lt;mx:Label x=&#8221;108.5&#8243; y=&#8221;33&#8243; text=&#8221;Speed and Direction&#8221;/&gt;<br />
&lt;/mx:Canvas&gt;<br />
&lt;/mx:Application&gt;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/professionalpapervision.wordpress.com/1589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/professionalpapervision.wordpress.com/1589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/professionalpapervision.wordpress.com/1589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/professionalpapervision.wordpress.com/1589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/professionalpapervision.wordpress.com/1589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/professionalpapervision.wordpress.com/1589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/professionalpapervision.wordpress.com/1589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/professionalpapervision.wordpress.com/1589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/professionalpapervision.wordpress.com/1589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/professionalpapervision.wordpress.com/1589/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1589&subd=professionalpapervision&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://professionalpapervision.wordpress.com/2009/04/18/putting-3d-google-maps-on-the-web-using-flash-10/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eb5a0d289883e5e5bee87c7ee2391cdc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/04/mymap.png" medium="image">
			<media:title type="html">mymap</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/6AWI6LYkwFc/2.jpg" medium="image" />
	</item>
		<item>
		<title>2 and 3D FLINT Particle (Gumbo) Viewers</title>
		<link>http://professionalpapervision.wordpress.com/2009/04/17/2-and-3d-flint-particle-viewers/</link>
		<comments>http://professionalpapervision.wordpress.com/2009/04/17/2-and-3d-flint-particle-viewers/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 21:02:40 +0000</pubDate>
		<dc:creator>Mike Lively</dc:creator>
				<category><![CDATA[Papervision]]></category>
		<category><![CDATA[Particles]]></category>

		<guid isPermaLink="false">http://professionalpapervision.wordpress.com/?p=1524</guid>
		<description><![CDATA[Intro
I used to have an old truck, that I payed way too much for, and on its sixth repair trip &#8230; the mechanic said there had been too many hands in it. What did that mean? And then it just died and nobody knew why. It&#8217;s true for software as well &#8211; too many people [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1524&subd=professionalpapervision&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h3><strong>Intro</strong></h3>
<p>I used to have an old truck, that I payed way too much for, and on its sixth repair trip &#8230; the mechanic said there had been too many hands in it. What did that mean? And then it just died and nobody knew why. It&#8217;s true for software as well &#8211; too many people working on a project can kill it &#8230; you just need a few bright folks. And with Flint, there was just one, Richard Lord. It demonstrates how powerful just one guy can be.</p>
<p>In chapter 6 of the book, we cover <a title="Flint Particle System" href="http://flintparticles.org/" target="_blank">Richard&#8217;s incredible FLINT particle system</a> and its use in PV3D &#8230; super job Richard Lord!!! This guy must have a cranium cavity the size of the grand canyon.</p>
<p>However, in the prep for the particle chapter I really got tired of having to wait for his different example apps to come up, so I created 2 and 3D fast particle viewers (in Flex 4 Gumbo) . You can view the apps below and download the source code as well. They work very similarly to the <a title="MD2 Viewer" href="http://professionalpapervision.wordpress.com/2009/03/24/pv3d-quake-2-md2-model-viewer-and-download/" target="_blank">MD2 viewer posted earlier</a>, so I won&#8217;t cover how they were made here.</p>
<p><a title="2 and 3D source" href="http://flex3cookbook3.googlecode.com/files/flintViewer.zip" target="_blank">Download Source for both Apps here</a></p>
<h3><span style="text-decoration:underline;"><a title="Flint Particle System 2D" href="http://www.professionalpapervision.com/demos/web/flintView/FlintViewer.html" target="_blank">2D Viewer Demo (click this link or image below)<br />
</a></span></h3>
<p style="text-align:center;">
<div id="attachment_1578" class="wp-caption aligncenter" style="width: 314px"><a href="http://www.professionalpapervision.com/demos/web/flintView/FlintViewer.html"><img class="size-full wp-image-1578" title="flint2d" src="http://professionalpapervision.files.wordpress.com/2009/04/flint2d.png?w=304&#038;h=124" alt="Flint 2D Particle System" width="304" height="124" /></a><p class="wp-caption-text">Flint 2D Particle Viewer</p></div>
<h3><span style="text-decoration:underline;"><a title="Flint Particle System 3D" href="http://www.professionalpapervision.com/demos/web/flintView/FlintViewer3D.html" target="_blank">3D Viewer Demo (click this link or image below)</a></span></h3>
<div id="attachment_1579" class="wp-caption aligncenter" style="width: 332px"><a href="http://www.professionalpapervision.com/demos/web/flintView/FlintViewer3D.html"><img class="size-full wp-image-1579" title="bats3d" src="http://professionalpapervision.files.wordpress.com/2009/04/bats3d.png?w=322&#038;h=179" alt="3D Particle Viewer" width="322" height="179" /></a><p class="wp-caption-text">Flint 3D Particle Viewer</p></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/professionalpapervision.wordpress.com/1524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/professionalpapervision.wordpress.com/1524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/professionalpapervision.wordpress.com/1524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/professionalpapervision.wordpress.com/1524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/professionalpapervision.wordpress.com/1524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/professionalpapervision.wordpress.com/1524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/professionalpapervision.wordpress.com/1524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/professionalpapervision.wordpress.com/1524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/professionalpapervision.wordpress.com/1524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/professionalpapervision.wordpress.com/1524/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1524&subd=professionalpapervision&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://professionalpapervision.wordpress.com/2009/04/17/2-and-3d-flint-particle-viewers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eb5a0d289883e5e5bee87c7ee2391cdc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/04/flint2d.png" medium="image">
			<media:title type="html">flint2d</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/04/bats3d.png" medium="image">
			<media:title type="html">bats3d</media:title>
		</media:content>
	</item>
		<item>
		<title>A Little Extra OOP (for particle systems)</title>
		<link>http://professionalpapervision.wordpress.com/2009/04/16/a-little-extra-oop-for-particle-systems/</link>
		<comments>http://professionalpapervision.wordpress.com/2009/04/16/a-little-extra-oop-for-particle-systems/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 20:42:03 +0000</pubDate>
		<dc:creator>Mike Lively</dc:creator>
				<category><![CDATA[Papervision]]></category>

		<guid isPermaLink="false">http://professionalpapervision.wordpress.com/?p=1569</guid>
		<description><![CDATA[A Little Extra OOP
Working with particle systems requires that you delve a little deeper into the wonderful world of OOP (Object-Oriented Programming). There are a few new concepts (and some you&#8217;ve already seen) that will take you a long way when working with particle systems: encapsulation, inheritance, access modifiers, polymorphism, getters and setters, static properties [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1569&subd=professionalpapervision&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>A Little Extra OOP</strong></p>
<p>Working with particle systems requires that you delve a little deeper into the wonderful world of OOP (Object-Oriented Programming). There are a few new concepts (and some you&#8217;ve already seen) that will take you a long way when working with particle systems: encapsulation, inheritance, access modifiers, polymorphism, getters and setters, static properties and methods, static constants, and throwing errors.</p>
<p><strong>Encapsulation</strong><br />
Encapsulation involves exposing only what is necessary in order to use a class. You can think of it as the dials on your car radio. You don&#8217;t need to understand electronics to turn on your car radio. The circuitry is behind the scenes and the same is true about your code. You can have very complex code structures hidden using encapsulation and reveal only the bare minimum of what your user needs to interact with. This has been one of the cornerstones of PV3D and you&#8217;ll find many complex code structures beneath the sub-layer of PV3D&#8217;s commonly used classes.</p>
<p><strong>Inheritance</strong></p>
<p>Key to many applications in PV3D is the concept of inheritance. You can recognize when inheritance is in play by the &#8220;extends&#8221; keyword. The class you extend will therefore inherit all the properties and methods of the class it extends. So in the simple starter code below the new &#8220;ClassExtends&#8221; class will inherit from the Sprite class all of its methods and properties.</p>
<p style="padding-left:30px;">package {<br />
import flash.display.Sprite;</p>
<p style="padding-left:30px;">public class ClassExtends extends Sprite<br />
{<br />
public function ClassExtends()<br />
{<br />
}<br />
}<br />
}</p>
<p>Inheritance saves you tons of space and labor by allowing you to write reusable code, and you can attach that code to other classes, thus extending their functionality very easily.</p>
<p><strong>Polymorphism<br />
</strong><br />
It&#8217;s often joked that polymorphism is a word that will impress friends at parties, most likely it will get them going the other way. Polymorphism is the concept that an object that inherits from a class can be used in place of an instance from that class.<br />
So to cut through all the formalism, it&#8217;s all about data types. If I&#8217;ve extended a class by the Movie class then that class can be treated as the Movie datatype. Think of it as the king&#8217;s son. If the king is allowed into the thrown room, so is his son, because in a sense he is an extended version of the king. There&#8217;s much more to polymorphism of course (or it wouldn&#8217;t have such a big name), but this is enough to get you through particles.<br />
<strong><br />
Access Modifiers<br />
</strong><br />
You&#8217;ve already dealt with access modifiers. They give you the ability to control your encapsulation, exposing and restricting various code elements in the sub-layers of your program, defining what properties and methods are exposed for use behind the scenes. As discussed in a previous chapter access modifiers use the keywords: public (everyone), private (within your class), protected (available to descended or sub-classes), internal (same package where defined).</p>
<p><strong>Getters and Setters<br />
</strong><br />
If you open up the PV3D&#8217;s DisplayObject3D class you&#8217;ll find tons of getter and setter methods and if you&#8217;ve never seen this before it may seem a little strange, but it has its roots in the &#8220;best practice&#8221; of keeping all your class properties private. But you can still access those properties through pubic methods (so you protect the private property but expose it using public methods). And since this approach is used so much special methods &#8220;get&#8221; and &#8220;set&#8221; have been created just for the process of getting and setting data. Get allows you to get the private property, and set allows you to change that private property. If you only have a get method and not set method the property is read-only&#8230;you can&#8217;t change it.</p>
<p>In the code snippet below taken from the DisplayObject3D class you get and set the value of X rotation. The first step is to set your &#8220;_rotationX&#8221; property to private. Note: the underscore in front of the property &#8220;_rotationX&#8221; is just a convention, which indicates that the property is private.</p>
<p>So to illustrate this principle, in the statement below the &#8220;_rotationX&#8221; property is set to private.</p>
<p>private var _rotationX          :Number;</p>
<p>By using the get and set methods you can access the &#8220;_rotationX&#8221; property as shown:</p>
<p style="padding-left:30px;">
<p style="padding-left:30px;">public function get rotationX():Number<br />
{<br />
if( this._rotationDirty ) updateRotation();</p>
<p style="padding-left:30px;">return Papervision3D.useDEGREES ? this._rotationX * toDEGREES :<br />
this._rotationX;<br />
}</p>
<p style="padding-left:30px;">public function set rotationX( rot:Number ):void<br />
{<br />
this._rotationX = Papervision3D.useDEGREES ? rot * toRADIANS : rot;<br />
this._transformDirty = true;<br />
}</p>
<p>Now, in your main program, all you need to do is reference rotationX to get or set your private property. For example, if want to get or set the x rotation of a cylinder use the code below:</p>
<p>get method: cylinder.rotationX<br />
set method: cylinder.rotationX = 45;</p>
<p>You&#8217;ll use getter/setter methods as you add various physical properties to your particles.</p>
<p><strong>Static Properties and Methods</strong></p>
<p><strong></strong><br />
Static properties and methods are attached to a class, as opposed to the instance of a class. A good example of this is aligning an object to the center of the stage. You do this all the time and it would be handy to have some reusable code that does this for you automatically. Using static properties and methods allows you to do this, and you won&#8217;t have to create an instance of this class every time you need it, but you will access it directly.</p>
<p style="padding-left:30px;">package utils<br />
{<br />
//Visual objects (top level objects) need to be imported.<br />
import flash.display.DisplayObject;<br />
public class Utils<br />
{<br />
public static var centerMyObject:String=&#8221;Center Object!&#8221;;<br />
public function Utils()<br />
{<br />
}</p>
<p style="padding-left:30px;">//Because of polymorphism you can pass in any object that inherits from the Display Object class</p>
<p style="padding-left:30px;">public static functioncenterObject1(myObject:DisplayObject):void{</p>
<p style="padding-left:30px;">myObject.x=myObject.stage.stageWidth/2-myObject.width/2;<br />
myObject.y=myObject.stage.stageHeight/2-myObject.height/2;<br />
}<br />
public static function centerObject2(myObject:DisplayObject):void{</p>
<p style="padding-left:30px;">myObject.x=myObject.stage.stageWidth/2<br />
myObject.y=myObject.stage.stageHeight/2<br />
}<br />
public static function centerObject3(myObject1:DisplayObject,myObject2:DisplayObject):void{</p>
<p style="padding-left:30px;">myObject2.x=-myObject1.width/2;<br />
myObject2.y=-myObject1.height/2;<br />
}<br />
}}</p>
<p style="padding-left:30px;">
<p>Another important category of static classes commonly used in PV3D is the Tweener class (such as TweenLite or Caurina). Typically, an object needs to be tweened in a certain way, which makes this approach ideal. Just toss your object into a static tween method and away you go. Tweeners are handled in more detail in a later chapter.<br />
<strong>Static Constants</strong></p>
<p><strong></strong><br />
A static constant is like a static variable, but it never changes. Just open up the ObjectDisplay3D class and you&#8217;ll see tons of them. Static constants are typically used with events and have the following form.<br />
* tells Mesh3D&#8217;s render() method to sort by measuring from the center of a triangle*/<br />
public static const MESH_SORT_CENTER:uint = 1;<br />
The convention is to use all caps when creating static constants and the separation of words with underscores. This is what Flash does with its static constants.<br />
<strong>Throwing Errors (Try/Catch)</strong></p>
<p><strong></strong></p>
<p>Why in the heck would you want to throw or create an error&#8230;aren&#8217;t there enough of them? When Flash has an error it doesn&#8217;t always know what to do with that error (or provides vague information). Throwing errors (and catching them) gives you the ability to take control of the process, directing Flash on what to do for certain types of errors or providing more details to the user about that error. The example below checks to see if a video is available; if it is not available an error is thrown</p>
<p style="padding-left:30px;">if(!video){<br />
throw new Error(&#8221;No Video Available&#8221;)<br />
}</p>
<p>It&#8217;s important to understand that when Flash encounters a throw statement that no more code can be run in the routine (its current script is terminated). It works somewhat like a return statement in a loop, but there&#8217;s more. When an error is thrown, Flash stops the current process and looks for some code that can catch what is being thrown.<br />
To catch that thrown error you can use a try/catch block as shown below:</p>
<p style="padding-left:30px;">try<br />
{<br />
//statements<br />
}<br />
catch(myError:Error)<br />
{<br />
//statements<br />
}</p>
<p>When an error is thrown, Flash looks to see if it was thrown within a try/catch block, if it was, it goes to the next position in the stack and executes its catch statement. The try/catch block gives you the ability to do something when your error occurs as opposed to stopping your code, which could potentially wreck your program.<br />
Now that you have a little more OOP under your belt, you can now proceed to build advanced particle systems.<br />
<strong><br />
</strong></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/professionalpapervision.wordpress.com/1569/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/professionalpapervision.wordpress.com/1569/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/professionalpapervision.wordpress.com/1569/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/professionalpapervision.wordpress.com/1569/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/professionalpapervision.wordpress.com/1569/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/professionalpapervision.wordpress.com/1569/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/professionalpapervision.wordpress.com/1569/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/professionalpapervision.wordpress.com/1569/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/professionalpapervision.wordpress.com/1569/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/professionalpapervision.wordpress.com/1569/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1569&subd=professionalpapervision&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://professionalpapervision.wordpress.com/2009/04/16/a-little-extra-oop-for-particle-systems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eb5a0d289883e5e5bee87c7ee2391cdc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>
	</item>
		<item>
		<title>Flash CS4 Exploding House of Cards (3D Particle Class)</title>
		<link>http://professionalpapervision.wordpress.com/2009/04/15/flash-cs4-exploding-house-of-cards-3d-particle-class/</link>
		<comments>http://professionalpapervision.wordpress.com/2009/04/15/flash-cs4-exploding-house-of-cards-3d-particle-class/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 17:26:57 +0000</pubDate>
		<dc:creator>Mike Lively</dc:creator>
				<category><![CDATA[CS4]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Particles]]></category>
		<category><![CDATA[Physics]]></category>

		<guid isPermaLink="false">http://professionalpapervision.wordpress.com/?p=1553</guid>
		<description><![CDATA[Intro
Exploding an object is serious gaming fun. There’s just something about the human psyche that loves to see things blow up.  In this post, we show you how to create a card house in Flash CS4 and then how to blow it up by treating the cards as particles.
Demo
Source: http://flex3cookbook3.googlecode.com/files/blowitUp3D.zip

 YouTube Video 1: Building [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1553&subd=professionalpapervision&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h3><strong>Intro</strong></h3>
<p>Exploding an object is serious gaming fun. There’s just something about the human psyche that loves to see things blow up.  In this post, we show you how to create a card house in Flash CS4 and then how to blow it up by treating the cards as particles.</p>
<div id="attachment_1554" class="wp-caption aligncenter" style="width: 209px"><a href="http://www.professionalpapervision.com/demos/web/explodingCards/"><img class="size-full wp-image-1554" title="explodingcards" src="http://professionalpapervision.files.wordpress.com/2009/04/explodingcards.jpg?w=199&#038;h=121" alt="Exploding House of Cards" width="199" height="121" /></a><p class="wp-caption-text">Exploding House of Cards</p></div>
<p><a title="Exploding Cards" href="http://www.professionalpapervision.com/demos/web/explodingCards/" target="_blank">Demo</a></p>
<p><a title="Flash CS4 Exploding Cards" href="http://flex3cookbook3.googlecode.com/files/blowitUp3D.zip" target="_blank">Source: http://flex3cookbook3.googlecode.com/files/blowitUp3D.zip</a></p>
<p><a title="Flash CS4 Exploding Cards" href="http://flex3cookbook3.googlecode.com/files/blowitUp3D.zip" target="_blank"></a><br />
<a title="House of Cards Part 1" href="http://www.youtube.com/watch?v=7N6yS-qoiOQ" target="_blank"> YouTube Video 1: Building a House of Cards in CS4 (Part 1)</a></p>
<p><span style="text-align:center; display: block;"><a href="http://professionalpapervision.wordpress.com/2009/04/15/flash-cs4-exploding-house-of-cards-3d-particle-class/"><img src="http://img.youtube.com/vi/7N6yS-qoiOQ/2.jpg" alt="" /></a></span></p>
<p><a title="House of Cards Part 2" href="http://www.youtube.com/watch?v=p4vZaSJII48" target="_blank">YouTube Video 2: Building a House of Cards in CS4 (Part 2)</a></p>
<p><span style="text-align:center; display: block;"><a href="http://professionalpapervision.wordpress.com/2009/04/15/flash-cs4-exploding-house-of-cards-3d-particle-class/"><img src="http://img.youtube.com/vi/p4vZaSJII48/2.jpg" alt="" /></a></span></p>
<p><a title="House of Cards Explode" href="http://www.youtube.com/watch?v=GWBm5KYhvu4" target="_blank">YouTube Video 3: Making Your CS4 Card House Explode (Part 3)</a></p>
<p><span style="text-align:center; display: block;"><a href="http://professionalpapervision.wordpress.com/2009/04/15/flash-cs4-exploding-house-of-cards-3d-particle-class/"><img src="http://img.youtube.com/vi/GWBm5KYhvu4/2.jpg" alt="" /></a></span></p>
<p><strong>Discussion</strong></p>
<p>The first step in making things explode is to add a spin (x, y, z) property to your Particle3D class (developed in the book).</p>
<p>You can accomplish this in the following three steps:</p>
<p>Exploding an object is serious gaming fun. There’s just something about the human psyche that loves to see things blow up.  The first step in making things explode is to add a spin (x, y, z) property to your Particle3D class. You can accomplish this in the following three steps:</p>
<p><strong>Step 1:</strong> To keep things straight rename your Particle3D (developed in the book) class to ParticleBlowUp and add a spin (x, y, z) property</p>
<p style="padding-left:30px;">public var spinX:Number;<br />
public var spinY:Number;<br />
public var spinZ:Number;</p>
<p><strong>Step 2:</strong> In the constructor function, set the spin (x, y, z) equal to zero.</p>
<p style="padding-left:30px;">spinX = 0;<br />
spinY = 0;<br />
spinZ = 0;</p>
<p>Step 3: And in your animation method “myLoop” update the rotation of the particle by iterating the spin (x, y, z) amount.</p>
<p style="padding-left:30px;">this.rotationX += spinX;<br />
this.rotationY += spinY;<br />
this.rotationZ += spinZ;</p>
<p>And that’s all you have to do to your Particle3D (now named ParticleBlowUp) class. See the book for more details&#8230;</p>
<h3>You&#8217;re Only Half Way</h3>
<p>But to get your particle system to explode you want to transfer a multi-part movie clip into your Particle class (using polymorphism). Then iterate over the elements of that movie clip, so you can spin those elements off into space in different directions, simulating an explosion.</p>
<p>To do this, make the following changes to your Particle3D class shown below:</p>
<p>1.    Remove the “extends Sprite” statement from your ParticleBlowUp class; this allows you to bring in an object into your ParticleBlowUp class.</p>
<p>2.    Create a public property “obj” and data type it as a Display Object:</p>
<p style="padding-left:30px;">
<p>public var obj:DisplayObject</p>
<p>3.    Add “obj” to your constructor method, declare “obj” as an object in your constructor method.<br />
4.    Finally, change all the “this” keywords to object so that the transformations are applied to the object passed in through the constructor.</p>
<p>To see the rest of the discussion click the link below:</p>
<p><span id="more-1553"></span></p>
<p>The completed code is shown below:</p>
<p style="padding-left:30px;">package org.lively3d.particles<br />
{<br />
import flash.display.*;<br />
//Particle Parameters<br />
public class ParticleBlowUp<br />
{<br />
public var velocityX:Number;<br />
public var velocityY:Number;<br />
public var velocityZ:Number;<br />
public var gravity:Number;<br />
public var friction:Number;<br />
public var fade:Number;<br />
public var autoRotate:Boolean;<br />
public var spinX:Number;<br />
public var spinY:Number;<br />
public var spinZ:Number;<br />
public var object:DisplayObject;</p>
<p>public function ParticleBlowUp(obj:DisplayObject)<br />
{<br />
//Set Parameters<br />
object = obj;<br />
velocityX = 0;<br />
velocityY = 0;<br />
velocityZ = 0;<br />
gravity = 0;<br />
friction = 1;<br />
fade = 1;<br />
spinX = 0;<br />
spinY = 0;<br />
spinZ = 0;</p>
<p>}<br />
//Update Parameters<br />
public function myUpdate():void<br />
{<br />
velocityX *= friction;<br />
velocityY *= friction;<br />
velocityY += gravity;<br />
object.x += velocityX;<br />
object.y += velocityY;<br />
object.z += velocityZ;<br />
//Update rotation<br />
object.rotationX += spinX;<br />
object.rotationY += spinY;<br />
object.rotationZ += spinZ;<br />
}<br />
}<br />
}</p>
<p>Next open up Flash and make a few movies (3D card houses) and make sure that those movies are made up of various movies. You’ll iterate over these pieces to simulate the explosion. Shown below are 3 card houses, which explode when you click on them. To get this to happen, you need to give each house an appropriate instance name (house1_mc, house2_mc, house3_mc).</p>
<p>You then attach listeners to each one of these instance names, so when you click on them the explode method is executed.</p>
<p style="padding-left:30px;">//Set your click listeners<br />
cards1_mc.addEventListener(MouseEvent.CLICK, explode);<br />
cards2_mc.addEventListener(MouseEvent.CLICK, explode);<br />
cards3_mc.addEventListener(MouseEvent.CLICK, explode);<br />
text_mc.addEventListener(MouseEvent.CLICK, explode);</p>
<p>The explode method is pretty straightforward; each particle is given a random velocity and spin (in x, y, z), and gravity is set to 1, which brings the particles to the ground over time.</p>
<p>The full code is listed below:</p>
<p style="padding-left:30px;">
<p>import org.lively3d.particles.*;<br />
//Import blowup class<br />
import org.lively3d.particles.ParticleBlowUp;<br />
//Declare particle array and particle<br />
var particles:Array = [];<br />
var particle:ParticleBlowUp;</p>
<p>function explode(event:MouseEvent):void<br />
{<br />
var element:MovieClip = MovieClip(event.currentTarget);<br />
for(var i:uint = 0; i &lt; element.numChildren; i++)<br />
{   //Set random velocity and spin<br />
particle = new ParticleBlowUp(element.getChildAt(i));<br />
particle.velocityX = Math.random() * 20 &#8211; 10;<br />
particle.velocityY = Math.random() * -20 ;<br />
particle.velocityZ = Math.random() * 20 &#8211; 10;<br />
particle.gravity = 1;<br />
particle.friction = .98;<br />
particle.spinX = Math.random() * 40 &#8211; 20;<br />
particle.spinY = Math.random() * 20 &#8211; 10;<br />
particle.spinZ = Math.random() * 20 &#8211; 10;<br />
particles.push(particle);<br />
}<br />
addEventListener(Event.ENTER_FRAME, myLoop);<br />
}</p>
<p>function myLoop(event:Event):void<br />
{<br />
for(var i:uint =0; i &lt; particles.length; i++)<br />
{<br />
particles[i].myUpdate();<br />
}<br />
}<br />
//Add Listeners<br />
cards1_mc.addEventListener(MouseEvent.CLICK, explode);<br />
cards2_mc.addEventListener(MouseEvent.CLICK, explode);<br />
cards3_mc.addEventListener(MouseEvent.CLICK, explode);<br />
text_mc.addEventListener(MouseEvent.CLICK, explode);</p>
<p>In this post, you’ve learned a very important technique that you will use over and over in coming chapters. You’re not just passing variables to your methods, but movies and objects…and that opens up a whole new world of possibilities.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/professionalpapervision.wordpress.com/1553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/professionalpapervision.wordpress.com/1553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/professionalpapervision.wordpress.com/1553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/professionalpapervision.wordpress.com/1553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/professionalpapervision.wordpress.com/1553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/professionalpapervision.wordpress.com/1553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/professionalpapervision.wordpress.com/1553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/professionalpapervision.wordpress.com/1553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/professionalpapervision.wordpress.com/1553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/professionalpapervision.wordpress.com/1553/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1553&subd=professionalpapervision&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://professionalpapervision.wordpress.com/2009/04/15/flash-cs4-exploding-house-of-cards-3d-particle-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eb5a0d289883e5e5bee87c7ee2391cdc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/04/explodingcards.jpg" medium="image">
			<media:title type="html">explodingcards</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/7N6yS-qoiOQ/2.jpg" medium="image" />

		<media:content url="http://img.youtube.com/vi/p4vZaSJII48/2.jpg" medium="image" />

		<media:content url="http://img.youtube.com/vi/GWBm5KYhvu4/2.jpg" medium="image" />
	</item>
		<item>
		<title>Hacking Plugin Media and PV3D.org</title>
		<link>http://professionalpapervision.wordpress.com/2009/04/11/hacking-plugin-media-and-pv3dorg/</link>
		<comments>http://professionalpapervision.wordpress.com/2009/04/11/hacking-plugin-media-and-pv3dorg/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 00:27:16 +0000</pubDate>
		<dc:creator>Mike Lively</dc:creator>
				<category><![CDATA[3D Modeling]]></category>
		<category><![CDATA[Papervision]]></category>
		<category><![CDATA[Particles]]></category>

		<guid isPermaLink="false">http://professionalpapervision.wordpress.com/?p=1528</guid>
		<description><![CDATA[Intro
Seb Lee-Delisle is the technical director at Plug-in media and is famous world wide for his particle effects and his very entertaining presentations. During the Christmas season Seb usually releases a snow particle system to the open source community. You can download Seb’s snow systems and more from his blog at www.sebleedelisle.com.
In this post, you’ll [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1528&subd=professionalpapervision&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Intro</strong></p>
<p>Seb Lee-Delisle is the technical director at Plug-in media and is famous world wide for his particle effects and his very entertaining presentations. During the Christmas season Seb usually releases a snow particle system to the open source community. You can download Seb’s snow systems and more from his blog at <a title="Seb Lee-Delise" href="http://www.sebleedelisle.com/" target="_blank">www.sebleedelisle.com</a>.</p>
<p>In this post, you’ll take Seb&#8217;s snow-storm particle effect and combine it with another great blog release found on John Lindquist’s site at <a href="http://www.pv3d.org/">www.pv3d.org</a>. John also releases  tons of great PV3D examples and you should take the time to visit his site as well.</p>
<p>You’ll combine Seb and John’s work to produce a reflecting snowy Christmas scene shown below. This is a great example of hacking two different software apps to produce a superior one.</p>
<div id="attachment_1529" class="wp-caption aligncenter" style="width: 223px"><a href="http://www.professionalpapervision.com/demos/web/Christmastree/"><img class="size-full wp-image-1529" title="christmas" src="http://professionalpapervision.files.wordpress.com/2009/04/christmas.jpg?w=213&#038;h=134" alt="IT'S A SNOWY CHRISTMAS" width="213" height="134" /></a><p class="wp-caption-text">IT&#39;S A SNOWY CHRISTMAS</p></div>
<p><a title="Snowy Christmas" href="http://www.professionalpapervision.com/demos/web/Christmastree/" target="_blank"><strong>Demo</strong></a></p>
<p><a title="Source" href="http://flex3cookbook3.googlecode.com/files/MerryChristmas2.zip" target="_blank"><strong>Download</strong></a></p>
<p><strong>YouTube</strong></p>
<p><strong>Discussion</strong></p>
<p><span style="color:#ff0000;">If you haven&#8217;t guessed it yet, hacking in the open source community is a good thing, and the book emphasizes going beyond the surface of PV3D and making it better (or hacking the heck out of it)!<br />
</span></p>
<p><strong>Making it Snow for Christmas<br />
</strong></p>
<p>You’ll want to start by either going to Seb and John’s blogs and downloading the corresponding snow storm and Flint Christmas scene, or by downloading the Merry Christmas code from the book’s chapter code (or link above).</p>
<p>John uses this Christmas scene as an example of Flint particles. The problem is that his snow is just 2D and does not interact with the reflective surface. Seb has 3D snow that will interact with the surface. So you&#8217;re going to delete the FLINT particle snow system (you’ll learn about FLINT in a later post) and add Seb’s snow.</p>
<p><strong>Here are the steps:<br />
</strong><br />
1.    Delete the Flint Particle system from John’s code.<br />
2. And import Seb’s snow storm package into to John’s code and instantiate it using the following code:</p>
<p style="padding-left:30px;">snowStorm=new SnowStorm(100, .4,2000);<br />
// Also, make sure that you update the snow in your animation loop (enterFrameHandler) or it willnot show up.<br />
snowStorm.update();</p>
<p>3.    John uses planes for Christmas ornaments, you can “snaz” this up a bit by replacing the planes with spheres, and by reducing the segments to 2&#215;2 you make your ornaments look like crystals.</p>
<p style="padding-left:30px;">for(var i:int = 0; i &lt; total; i++)<br />
{<br />
var material:ColorMaterial;<br />
if((i &amp; 1) == 0) material = new ColorMaterial(0xaa0000);<br />
else material = new ColorMaterial(0&#215;00aa00);<br />
material.doubleSided = true;<br />
//Add a sphere instead<br />
var sphere:Sphere = new Sphere(material, 10, 2,2);<br />
sphere.x = Math.cos(i) * (radius &#8211; i * 3);<br />
sphere.z = Math.sin(i) * (radius &#8211; i * 3);<br />
sphere.y = i / total * height;</p>
<p>myHolder.addChild(sphere);</p>
<p style="padding-left:30px;">}</p>
<p>4.    You now have 3D snow and cool looking ornaments, but the snow is out of wrack and at this point you’ll need to adjust a few parameters to make it look just right. In this case, we want the falling snow to disappear just as it touches the reflective surface . To accomplish this adjust the following parameters</p>
<p style="padding-left:30px;">snowStorm=new SnowStorm(100, .4,2000);<br />
myHolder.addChild(snowStorm);<br />
//Pull the snow up so it disappears when it hits the reflective surface<br />
snowStorm.y=1000;</p>
<p>In addition to changing your particle parameters you raise your snow&#8217;s y-position so it just touches the reflective surface before being recycled. Next you have to go into the snow class itself and adjust the particle ratio. In the SnowStorm class in the update method make the following change:</p>
<p style="padding-left:30px;">if(particles.length/10 &lt; maxFlakes)</p>
<p><span style="color:#ff0000;">This is what I call emotional (or intuitive) programming. You might not know completely how the code works but by changing a few parameters you bring everything into agreement. This can be both dangerous and fun! So make sure you keep back up copies in case you really mess something up.<br />
</span></p>
<p>This causes your particles to be regenerated more rapidly and close the gap that appears due to particle lag. Now matter what you create, you’ll always need to make adjustments. Get used to going down to sub classes and changing parameters.</p>
<p><span style="color:#ff0000;">Flex is a great tool for surfing logically to classes that you need to modify. Just roll over a method and hold down the command key (MAC) or alt key (PC) and when you do the method, class, or property will underscore and when you click on it you will automatically navigate to that method even if it is in another class.</span></p>
<p>5.    Finally you want to change the words from MERRY CHRISTMAS to IT’S A SNOWY CHRISTMAS. You’ll need to play around with the spacing of the words a little to get it right (this is where a little knowledge of trig is helpful).</p>
<p style="padding-left:30px;">//IT’S A<br />
var itsaMaterial:Letter3DMaterial = new Letter3DMaterial(0&#215;00cc00);<br />
var itsa:Text3D = new Text3D(&#8221;IT&#8217;S A&#8221;, rockwell, itsaMaterial);<br />
//SNOWY<br />
var snowyMaterial:Letter3DMaterial = new Letter3DMaterial(0xcc0000);<br />
var snowy:Text3D = new Text3D(&#8221;SNOWY&#8221;, rockwell, snowyMaterial);<br />
//CHRISTMAS<br />
var christmasMaterial:Letter3DMaterial = new Letter3DMaterial(0&#215;00cc00);<br />
var christmas:Text3D = new Text3D(&#8221;CHRISTMAS&#8221;, rockwell, christmasMaterial);</p>
<p>The final results are shown below in the figure above. To see the entire code download it from the source or click the more button below:</p>
<p><span id="more-1528"></span></p>
<p><strong>Main Code</strong></p>
<p>package<br />
{<br />
import flash.events.Event;<br />
import flash.filters.BlurFilter;</p>
<p>import net.pluginmedia.pv3d.SnowStorm;</p>
<p>import org.papervision3d.core.effects.view.ReflectionView;<br />
import org.papervision3d.materials.ColorMaterial;<br />
import org.papervision3d.materials.special.Letter3DMaterial;<br />
import org.papervision3d.objects.DisplayObject3D;<br />
import org.papervision3d.objects.primitives.Sphere;<br />
import org.papervision3d.typography.Text3D;</p>
<p>[SWF(width="640", height="480", backgroundColor="#000000", frameRate="60")]<br />
public class MerryChristmas extends ReflectionView<br />
{<br />
private var myHolder:DisplayObject3D = new DisplayObject3D();<br />
private var snowStorm:SnowStorm;<br />
public function MerryChristmas()<br />
{<br />
viewportReflection.filters = [new BlurFilter(3,3,1)];<br />
setReflectionColor(.5, .5, .5);<br />
surfaceHeight = -80;</p>
<p>initText();<br />
initSnow();<br />
initTree();</p>
<p>addEventListener(Event.ENTER_FRAME, enterFrameHandler);<br />
}</p>
<p>private function initText():void<br />
{<br />
var rockwell:Rockwell = new Rockwell();</p>
<p>var itsaMaterial:Letter3DMaterial = new Letter3DMaterial(0&#215;00cc00);<br />
var itsa:Text3D = new Text3D(&#8221;IT&#8217;S A&#8221;, rockwell, itsaMaterial);</p>
<p>var snowyMaterial:Letter3DMaterial = new Letter3DMaterial(0xcc0000);<br />
var snowy:Text3D = new Text3D(&#8221;SNOWY&#8221;, rockwell, snowyMaterial);</p>
<p>var christmasMaterial:Letter3DMaterial = new Letter3DMaterial(0&#215;00cc00);<br />
var christmas:Text3D = new Text3D(&#8221;CHRISTMAS&#8221;, rockwell, christmasMaterial);</p>
<p>itsa.z=-500;</p>
<p>snowy.z = 0;<br />
snowy.x=500;<br />
christmas.z = 500;<br />
snowy.rotationY=-90;<br />
christmas.rotationY = 180;</p>
<p>myHolder.addChild(itsa);<br />
myHolder.addChild(snowy);<br />
myHolder.addChild(christmas);</p>
<p>scene.addChild(myHolder);<br />
}</p>
<p>private function initTree():void<br />
{<br />
var radius:Number = 300;<br />
var height:Number = 500;<br />
var total:uint = 100;</p>
<p>for(var i:int = 0; i &lt; total; i++)<br />
{<br />
var material:ColorMaterial;<br />
if((i &amp; 1) == 0) material = new ColorMaterial(0xaa0000);<br />
else material = new ColorMaterial(0&#215;00aa00);<br />
material.doubleSided = true;<br />
var sphere:Sphere = new Sphere(material, 10, 2,2);<br />
sphere.x = Math.cos(i) * (radius &#8211; i * 3);<br />
sphere.z = Math.sin(i) * (radius &#8211; i * 3);<br />
sphere.y = i / total * height;</p>
<p>myHolder.addChild(sphere);<br />
}<br />
}</p>
<p>private function initSnow():void<br />
{<br />
snowStorm=new SnowStorm(100, .4,2000);<br />
myHolder.addChild(snowStorm);<br />
snowStorm.y=1000;</p>
<p>}</p>
<p>private function enterFrameHandler(event:Event):void<br />
{<br />
myHolder.rotationY += (viewport.containerSprite.mouseX &#8211; myHolder.rotationY) * .01;</p>
<p>snowStorm.update();</p>
<p>singleRender();<br />
}<br />
}<br />
}</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/professionalpapervision.wordpress.com/1528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/professionalpapervision.wordpress.com/1528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/professionalpapervision.wordpress.com/1528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/professionalpapervision.wordpress.com/1528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/professionalpapervision.wordpress.com/1528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/professionalpapervision.wordpress.com/1528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/professionalpapervision.wordpress.com/1528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/professionalpapervision.wordpress.com/1528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/professionalpapervision.wordpress.com/1528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/professionalpapervision.wordpress.com/1528/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=professionalpapervision.wordpress.com&blog=5170343&post=1528&subd=professionalpapervision&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://professionalpapervision.wordpress.com/2009/04/11/hacking-plugin-media-and-pv3dorg/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/eb5a0d289883e5e5bee87c7ee2391cdc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>

		<media:content url="http://professionalpapervision.files.wordpress.com/2009/04/christmas.jpg" medium="image">
			<media:title type="html">christmas</media:title>
		</media:content>
	</item>
	</channel>
</rss>