<?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>Sebastiaan Holtrop &#187; Away3D</title>
	<atom:link href="http://www.sebastiaanholtrop.com/archives/category/away3d/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sebastiaanholtrop.com</link>
	<description>Creating stuff that works...</description>
	<lastBuildDate>Mon, 08 Feb 2010 11:39:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JigLibFlash physics and Away3D experiment</title>
		<link>http://www.sebastiaanholtrop.com/archives/85</link>
		<comments>http://www.sebastiaanholtrop.com/archives/85#comments</comments>
		<pubDate>Thu, 09 Apr 2009 13:26:47 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Away3D]]></category>
		<category><![CDATA[JigLibFlash]]></category>
		<category><![CDATA[Physics]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=85</guid>
		<description><![CDATA[I wanted to do some real 3d physics for quite some time, but there just weren&#8217;t really good actionscript 3 physics engines around. There are 2 real options:

WOW Physics engine: This is a particle based engine, which means every vertex has it&#8217;s own physics properties
JigLibFlash Physics engine: This is a Rigid Body based engine. You [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to do some real 3d physics for quite some time, but there just weren&#8217;t really good actionscript 3 physics engines around. There are 2 real options:</p>
<ul>
<li><a title="WOW Physics engine" href="http://seraf.mediabox.fr/wow-engine/as3-3d-physics-engine-wow-engine/" target="_blank">WOW Physics engine</a>: This is a particle based engine, which means every vertex has it&#8217;s own physics properties</li>
<li><a title="JigLibFlash Physics engine" href="http://www.jiglibflash.com/blog/" target="_blank">JigLibFlash Physics engine</a>: This is a Rigid Body based engine. You work with primitive types like boxes and speres to create a rough shape of you 3d object. These rigid body based engines are faster than particle based engines, because there&#8217;s just one rigid body with physics properties instead of (in case of a simple cube) 8.</li>
</ul>
<p>There&#8217;s quite a lot of examples around built with JigLibFlash and Papervision3D. Because I prefer building my 3D stuff in Away3D, I wanted to create some 3D physics with JigLibFlash and Away3D. Here&#8217;s a simple example of how it works:</p>
<div class="mceTemp">
<dl id="attachment_87" class="wp-caption alignnone" style="width: 510px;">
<dt class="wp-caption-dt"><a title="JiglibFlash and Away3D example" href="http://sebastiaanholtrop.com/samples/jiglibflashexperiment/example/" target="_blank"><img class="size-full wp-image-87" title="jiglibflash-and-away3d-experiment" src="http://www.sebastiaanholtrop.com/wp-content/jiglibflash-and-away3d-experiment.jpg" alt="JigLibFlash and Away3D experiment" width="500" height="300" /></a></dt>
</dl>
</div>
<p>Just use the arrow keys to move the ball around, try to get it to jump the ramp <img src='http://www.sebastiaanholtrop.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . You can <a title="Download source code jiglibFlash Away3D example" href="http://www.sebastiaanholtrop.com/samples/jiglibflashexperiment/JigLibAway3DExperiment.zip" target="_self">download the source code here</a>.</p>
<p>That&#8217;s it for now. it takes a lot of time to figure out how everything works because these physics engines are still buggy and undocumented (grrr). The project members of JigLibFlash did a great job by porting this c++ engine to actionscript, but, for an open source project to be successful they better start documenting the source code (I know it&#8217;s a boring job) instead of creating demo apps with Papervision, which, in my opinion is not the best 3D engine around.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/85/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SebCoverFlow 2.2.1 available</title>
		<link>http://www.sebastiaanholtrop.com/archives/83</link>
		<comments>http://www.sebastiaanholtrop.com/archives/83#comments</comments>
		<pubDate>Thu, 09 Apr 2009 11:43:30 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flex 2]]></category>
		<category><![CDATA[Adobe Flex 3]]></category>
		<category><![CDATA[Away3D]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[CoverFlow]]></category>
		<category><![CDATA[Flex 2]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=83</guid>
		<description><![CDATA[Since the release of the source code of my coverflow component there was just one bug that came up again and again. The coverflow couldn&#8217;t load images from a subdomain or another domain. I&#8217;ve fixed that one by adding a LoaderContext to the Image loader. The new sources and samples are available on the SebCoverFlow [...]]]></description>
			<content:encoded><![CDATA[<p>Since the release of the source code of my coverflow component there was just one bug that came up again and again. The coverflow couldn&#8217;t load images from a subdomain or another domain. I&#8217;ve fixed that one by adding a LoaderContext to the Image loader. The new sources and samples are available on the <a title="SebCoverFlow project page" href="http://www.sebastiaanholtrop.com/sebcoverflowprojectpage" target="_self">SebCoverFlow project page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/83/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Mask an Away3D scene in Flex</title>
		<link>http://www.sebastiaanholtrop.com/archives/29</link>
		<comments>http://www.sebastiaanholtrop.com/archives/29#comments</comments>
		<pubDate>Thu, 18 Sep 2008 20:59:48 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flex 2]]></category>
		<category><![CDATA[Adobe Flex 3]]></category>
		<category><![CDATA[Away3D]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=29</guid>
		<description><![CDATA[An Away3D scene usually takes up the full width and height of the embedded swf file in the browser. In Flash you can easily solve this problem by masking the Away3D view.
The same thing goes for Flex, but Flex has it&#8217;s own measuring and sizing methods. I&#8217;ve come to know that it&#8217;s a great thing [...]]]></description>
			<content:encoded><![CDATA[<p>An Away3D scene usually takes up the full width and height of the embedded swf file in the browser. In Flash you can easily solve this problem by masking the Away3D view.</p>
<p>The same thing goes for Flex, but Flex has it&#8217;s own measuring and sizing methods. I&#8217;ve come to know that it&#8217;s a great thing as regards to performance, maintainability and scalability of your component to adapt to the Flex Framework.</p>
<p>In this case, I&#8217;ve extended a Flex component. The new Component contains an Away3D scene, which wants to take up the full width and height of my Flex Application. To solve this we need to override the updateDisplayList method. This method get&#8217;s called by the Flex Framework every time something in the measuring has changed. Here&#8217;s how it looks in code:</p>

<div class="wp_codebox"><table><tr id="p292"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code" id="p29code2"><pre class="actionscript" style="font-family:monospace;">override protected <span style="color: #000000; font-weight: bold;">function</span> updateDisplayList<span style="color: #66cc66;">&#40;</span>unscaledWidth:<span style="color: #0066CC;">Number</span>, unscaledHeight:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
<span style="color: #0066CC;">super</span>.<span style="color: #006600;">updateDisplayList</span><span style="color: #66cc66;">&#40;</span>unscaledWidth, unscaledHeight<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// Set the clipping of the 3D scene to make sure only the visible elements are rendered,</span>
<span style="color: #808080; font-style: italic;">// this is great improvement for the performance</span>
<span style="color: #000000; font-weight: bold;">var</span> clipping:RectangleClipping = <span style="color: #000000; font-weight: bold;">new</span> RectangleClipping<span style="color: #66cc66;">&#40;</span>-<span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>, -<span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>, <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>, <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// Asign the clipping to the _view3D, in this case a private variable within my class</span>
_view3D.<span style="color: #006600;">clip</span> = clipping;
&nbsp;
<span style="color: #808080; font-style: italic;">// Remove the old mask if there is one</span>
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>_mask <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">this</span>.<span style="color: #006600;">removeChild</span><span style="color: #66cc66;">&#40;</span>_mask<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// Create a new mask</span>
_mask = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
_mask.<span style="color: #006600;">x</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">x</span>;
_mask.<span style="color: #006600;">y</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">y</span>;
_mask.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xFF0000,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
_mask.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">width</span>, <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;
_mask.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// Add it to the displayList</span>
<span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>_mask<span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// And assign the mask to the view3D</span>
_view3D.<span style="color: #006600;">mask</span> = _mask;
&nbsp;
<span style="color: #808080; font-style: italic;">// And center the view3D in the available space</span>
_view3D.<span style="color: #006600;">x</span> = <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">width</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>;
_view3D.<span style="color: #006600;">y</span> = <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>So as you see above, it&#8217;s quite straighforward. The clipping in the beginning of the method is not necessary for the masking, but since only the masked area is being displayed, there&#8217;s no need to render the invisible parts of the view3D.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/29/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dynamic Flex CoverFlow Component with dataProvider</title>
		<link>http://www.sebastiaanholtrop.com/archives/27</link>
		<comments>http://www.sebastiaanholtrop.com/archives/27#comments</comments>
		<pubDate>Thu, 11 Sep 2008 19:17:08 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flex 2]]></category>
		<category><![CDATA[Away3D]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[CoverFlow]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=27</guid>
		<description><![CDATA[There&#8217;s a project page of this component now, check it here, it&#8217;s open source!
As you may have read in a few of my other posts I&#8217;ve hacked a CoverFlow component together, just to see if it could be done. I was glad to see a lot of people liked it, so I decided to turn [...]]]></description>
			<content:encoded><![CDATA[<p><a title="SebCoverflow Project page" href="http://www.sebastiaanholtrop.com/sebcoverflowprojectpage" target="_self">There&#8217;s a project page of this component now, check it here, it&#8217;s open source!</a></p>
<p>As you may have read in a few of my other posts I&#8217;ve hacked a CoverFlow component together, just to see if it could be done. I was glad to see a lot of people liked it, so I decided to turn it into a proper component instead of the &#8220;hacked together&#8221; version I&#8217;ve posted before.</p>
<p><a title="Flex 2 CoverFlow component sample application" href="http://www.sebastiaanholtrop.com/samples/coverFlowcomponent/sampleapp/" target="_blank"><img class="alignnone size-full wp-image-28" title="sebcoverflow" src="http://www.sebastiaanholtrop.com/wp-content/sebcoverflow.jpg" alt="SebCoverFlow component for Flex" width="500" height="238" /></a></p>
<p>A lot of things have changed under the hood, a lot of bugs are fixed and you have to use the component a bit different.</p>
<ul>
<li>The previous version was built as a container, the new version is built more like a dataGrid, so it&#8217;s a component with a dataProvider. The component just renders the data in the dataProvider</li>
<li>It&#8217;s dynamic! It loads the images from the dataProvider. Changes on the dataProvider will be detected through binding</li>
<li>It&#8217;s now compatible with the Flex history manager, I&#8217;ve implemented the IHistoryManagerClient interface</li>
<li>It&#8217;s now compatible with the Flex focus manager, I&#8217;ve implemented the IFocusManagerComponent interface</li>
<li>I&#8217;ve added keyboard control, so the left and right arrow keys change the selected cover</li>
<li>It dispatches events, it lets everyone who&#8217;s listening know that the selectedIndex has changed, that it&#8217;s finished animating, etc</li>
<li>It&#8217;s now properly masked, the 3d scene doesn&#8217;t stretch to the full stage width and height anymore</li>
<li>And some more other small things</li>
</ul>
<p>I&#8217;ve created a new sample project to demonstrate all of the features, <a title="Flex 2 CoverFlow component sample application" href="http://sebastiaanholtrop.com/samples/coverFlowcomponent/sampleapp/" target="_blank">see it in action here</a>. You can see and <a title="Source view of the coverFlow sample project" href="http://sebastiaanholtrop.com/samples/coverFlowcomponent/sampleapp/srcview/index.html">download the source code of the sample project here</a>.</p>
<p>The component free to download and free to use, <a title="Flex 2 CoverFlow component swc" href="http://sebastiaanholtrop.com/samples/coverFlowcomponent/SebCoverFlow.swc">download the swc here</a>. I&#8217;m not publishing the source code of this one for now.</p>
<p>I&#8217;ve created documentation to help you put this component to good use, <a title="Flex 2 CoverFlow component documentation" href="http://sebastiaanholtrop.com/samples/coverFlowcomponent/asdoc/com/sebastiaanholtrop/components/coverflow/SebCoverFlow.html">read it here</a>.</p>
<p>Let me know what you think of it. I&#8217;d also like to see some end results. some projects in which you&#8217;ve used my component.</p>
<p>The next step? Hmm, a <a title="Piclens" href="http://www.cooliris.com/">piclens </a>component perhaps?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/27/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Flex CoverFlow Component updated</title>
		<link>http://www.sebastiaanholtrop.com/archives/19</link>
		<comments>http://www.sebastiaanholtrop.com/archives/19#comments</comments>
		<pubDate>Wed, 11 Jun 2008 19:10:30 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flex 2]]></category>
		<category><![CDATA[Away3D]]></category>
		<category><![CDATA[CoverFlow]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=19</guid>
		<description><![CDATA[There&#8217;s a project page of this component now, check it here, it&#8217;s open source!

I&#8217;ve been quite busy working on my CoverFlow component. I&#8217;ve added my reflection class and added the possibility to use cubes instead of planes as a cover. Since I&#8217;ve used a true 3D engine (Away3D) to build this component it&#8217;s become much [...]]]></description>
			<content:encoded><![CDATA[<p><a title="SebCoverflow Project page" href="http://www.sebastiaanholtrop.com/sebcoverflowprojectpage" target="_self">There&#8217;s a project page of this component now, check it here, it&#8217;s open source!<br />
</a></p>
<p>I&#8217;ve been quite busy working on my CoverFlow component. I&#8217;ve added my <a title="Reflection class" href="http://www.sebastiaanholtrop.com/archives/17" target="_blank">reflection class</a> and added the possibility to use cubes instead of planes as a cover. Since I&#8217;ve used a true 3D engine (<a title="Away3D" href="http://away3d.com/" target="_blank">Away3D</a>) to build this component it&#8217;s become much more than just a CoverFlow rip-off. Here are some examples of what it can do:</p>
<p><a href="http://www.sebastiaanholtrop.com/samples/covercube/"><img class="alignnone size-full wp-image-20" title="CoverCube Example" src="http://www.sebastiaanholtrop.com/wp-content/covercubenewexample1.jpg" alt="CoverCube Example" width="500" height="193" /></a></p>
<p><a href="http://www.sebastiaanholtrop.com/samples/covercube/"><img class="alignnone size-full wp-image-21" title="CoverCube example" src="http://www.sebastiaanholtrop.com/wp-content/covercubenewexample2.jpg" alt="CoverCube example" width="500" height="193" /></a></p>
<p><a title="CoverCube" href="http://www.sebastiaanholtrop.com/samples/covercube/">Click here to see the CoverCube in action</a>. Try the presets and drag the sliders to explore the possibilities of this component.<br />
<a title="Covercube source code" href="http://www.sebastiaanholtrop.com/samples/covercube/srcview/index.html">Click here to view the source code.</a></p>
<p>Here&#8217;s a few examples of the component using just planes:</p>
<p><a href="http://www.sebastiaanholtrop.com/samples/coverflowv2/"><img class="alignnone size-full wp-image-22" title="CoverFlow example" src="http://www.sebastiaanholtrop.com/wp-content/coverflownewexample.jpg" alt="CoverFlow example" width="500" height="193" /></a></p>
<p><a href="http://www.sebastiaanholtrop.com/samples/coverflowv2/"><img class="alignnone size-full wp-image-23" title="CoverFlow example" src="http://www.sebastiaanholtrop.com/wp-content/coverflownewexample2.jpg" alt="CoverFlow example" width="500" height="193" /></a></p>
<p><a title="CoverFlow V2" href="http://www.sebastiaanholtrop.com/samples/coverflowv2/">Click here to see the CoverFlowV2 in action</a>. Try the presets and drag the sliders to explore the possibilities of this component.<br />
<a title="CoverFlowV2 source code" href="http://www.sebastiaanholtrop.com/samples/coverflowv2/srcview/index.html">Click here to view the source code.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/19/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Flex Reflections Component and Actionscript Class</title>
		<link>http://www.sebastiaanholtrop.com/archives/17</link>
		<comments>http://www.sebastiaanholtrop.com/archives/17#comments</comments>
		<pubDate>Wed, 28 May 2008 21:46:02 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Adobe Flex 2]]></category>
		<category><![CDATA[Away3D]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=17</guid>
		<description><![CDATA[There are a lot of Reflection classes around, but I always enjoy writing my own. I had a special purpose in mind with writing this one; I wanted to create a reflection of a displayObject as a BitmapData, so I could use it as a Material in Away3D or any other actionscript 3D API. One [...]]]></description>
			<content:encoded><![CDATA[<p>There are a lot of Reflection classes around, but I always enjoy writing my own. I had a special purpose in mind with writing this one; I wanted to create a reflection of a displayObject as a BitmapData, so I could use it as a Material in Away3D or any other actionscript 3D API. One thing led to another, and before I knew I was writing a Reflection Flex component as well.</p>
<p>So the idea is that there are two flavors to this Reflection classes:</p>
<ul>
<li>The Actionscript-only way to create a Reflection</li>
<li>The MXML-only way to create a Reflection</li>
</ul>
<p>I also wanted to be able to create a reflection of a video or any other moving object. Check the example to see it in action.</p>
<p><a href="http://www.sebastiaanholtrop.com/samples/reflections/" target="_blank"><img class="alignnone size-medium wp-image-18" title="reflectionexample" src="http://www.sebastiaanholtrop.com/wp-content/reflectionexample-300x291.jpg" alt="An image with reflection using Actionscript and or Flex" width="300" height="291" /></a></p>
<h2>The Actionscript-only way to create a Reflection</h2>
<p>I&#8217;ve created this one so you can create reflections in Flash or in any Actionscript project. I&#8217;m going to use this to create reflection BitmapData&#8217;s to use in Away3D. Here&#8217;s how you use it:</p>

<div class="wp_codebox"><table><tr id="p175"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p17code5"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> reflection:Reflect = <span style="color: #000000; font-weight: bold;">new</span> Reflect<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">image1</span> as Sprite, <span style="color: #cc66cc;">0.4</span>, <span style="color: #cc66cc;">100</span>, <span style="color: #000000; font-weight: bold;">true</span>, Reflect.<span style="color: #006600;">BOTTOM</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>The constructor arguments are:</p>
<ul>
<li>The sprite to reflect</li>
<li>the alpha value</li>
<li>the ratio value</li>
<li>a boolean to tell if it should be added as a child to the target sprite</li>
<li>the direction of the reflection</li>
<li>the updateTime, this one is set to 0, so it doesn&#8217;t periodically update the reflection</li>
</ul>
<p>See the example <a title="Reflections sample" href="http://www.sebastiaanholtrop.com/samples/reflections/" target="_blank">here<br />
</a>See the sourcecode <a title="Reflections sample sourcecode" href="http://www.sebastiaanholtrop.com/samples/reflections/srcview/index.html" target="_blank">here</a></p>
<h2>The MXML-only way to create a Reflection</h2>
<p>The component version uses exactly the same arguments as the Actionscript class. All properties (except for the updateTime) are bindable, so you can alter the alpha, ratio, etc at runtime.</p>

<div class="wp_codebox"><table><tr id="p176"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p17code6"><pre class="xml" style="font-family:monospace;">&nbsp;</pre></td></tr></table></div>

<p>See the example <a title="Reflections sample" href="http://www.sebastiaanholtrop.com/samples/reflections/" target="_blank">here<br />
</a>See the sourcecode <a title="Reflections sample sourcecode" href="http://www.sebastiaanholtrop.com/samples/reflections/srcview/index.html" target="_blank">here</a></p>
<p>There&#8217;s one problem with reflecting dynamic textfields. I&#8217;m using a Matrix to create the Flipped BitmapData. Unfortunately the scale and translate methods of the Matrix mess up the rendering of dynamic textfields, but hey, who would want to reflect a boring textfield or dateChooser <img src='http://www.sebastiaanholtrop.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
I&#8217;ve written a post about this problem, you can read it <a title="BitmapData and Matrix weirdness" href="http://www.sebastiaanholtrop.com/archives/16" target="_self">here</a>. I know the solution to this problem; Use a Bitmap and set the scaleY property, but this will only flip the Bitmap, the BitmapData is still not flipped, and as I mentioned before, this was all to do about the Flipped and reflected BitmapData.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/17/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Away3D is a lefthanded system</title>
		<link>http://www.sebastiaanholtrop.com/archives/13</link>
		<comments>http://www.sebastiaanholtrop.com/archives/13#comments</comments>
		<pubDate>Thu, 08 May 2008 15:22:38 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Away3D]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=13</guid>
		<description><![CDATA[While most 3D coordinate systems are right handed, Papervision3D and Away3D are left handed, like this:

So every axis points into the positive direction and that&#8217;s what puzzled me for about two months while using Away3D; why do my 3D objects appear on the left side of the 0,0,0 position when I create them, while they [...]]]></description>
			<content:encoded><![CDATA[<p>While most 3D coordinate systems are right handed, Papervision3D and Away3D are left handed, like this:</p>
<p><img class="alignnone size-full wp-image-14" title="left handed coordinate system" src="http://www.sebastiaanholtrop.com/wp-content/left_handed.gif" alt="" width="195" height="190" /></p>
<p>So every axis points into the positive direction and that&#8217;s what puzzled me for about two months while using Away3D; why do my 3D objects appear on the left side of the 0,0,0 position when I create them, while they should appear on the right hand side. This is what the code looks like:</p>

<div class="wp_codebox"><table><tr id="p138"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p13code8"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> view3D:View3D = <span style="color: #000000; font-weight: bold;">new</span> View3D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>view3D<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> sphere:Sphere = <span style="color: #000000; font-weight: bold;">new</span> Sphere<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>radius:<span style="color: #cc66cc;">200</span>, segmentsW:<span style="color: #cc66cc;">10</span>, segmentsH:<span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
sphere.<span style="color: #0066CC;">position</span> = <span style="color: #000000; font-weight: bold;">new</span> Number3D<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
view3D.<span style="color: #006600;">scene</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>sphere<span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>Here&#8217;s the answer: This is because how the view3D instance is initialized. If you don&#8217;t pass an initObj to the constructor of the view3D, the camera is positioned at z=1000 and told to look at the center. So the camera is looking towards you, so the whole coordinate system is the other way around.</p>
<p>Glad I figured this one out, I was starting to loose my mind <img src='http://www.sebastiaanholtrop.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/13/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iTunes CoverFlow Flex 2 component with Away3D</title>
		<link>http://www.sebastiaanholtrop.com/archives/5</link>
		<comments>http://www.sebastiaanholtrop.com/archives/5#comments</comments>
		<pubDate>Sun, 20 Apr 2008 20:52:11 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flex 2]]></category>
		<category><![CDATA[Away3D]]></category>
		<category><![CDATA[CoverFlow]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=5</guid>
		<description><![CDATA[There&#8217;s a project page of this component now, check it here, it&#8217;s open source!
I&#8217;ve been fiddling around with 3d engines in Flash for about a year now, but never used it in Flex before, so I decided to try to build an iTunes coverflow component in Flex. This was what i came up with:

Not really [...]]]></description>
			<content:encoded><![CDATA[<p><a title="SebCoverflow Project page" href="http://www.sebastiaanholtrop.com/sebcoverflowprojectpage" target="_self">There&#8217;s a project page of this component now, check it here, it&#8217;s open source!</a></p>
<p>I&#8217;ve been fiddling around with 3d engines in Flash for about a year now, but never used it in Flex before, so I decided to try to build an iTunes coverflow component in Flex. This was what i came up with:</p>
<p><a href="http://www.sebastiaanholtrop.com/samples/coverflow/" target="_blank"><img class="alignnone size-full wp-image-6" title="coverflowfront" src="http://www.sebastiaanholtrop.com/wp-content/coverflowfront.jpg" alt="iTunes Coverflow with Flex and Away3D" width="500" height="193" /></a></p>
<p>Not really anything special, but since i&#8217;ve used a real 3D engine, i can do more stuff with it, like this:</p>
<p><a href="http://www.sebastiaanholtrop.com/samples/coverflow/" target="_blank"><img class="alignnone size-full wp-image-7" title="coverflowside" src="http://www.sebastiaanholtrop.com/wp-content/coverflowside.jpg" alt="" width="500" height="323" /></a></p>
<p>and this:</p>
<p><a href="http://www.sebastiaanholtrop.com/samples/coverflow/" target="_blank"><img class="alignnone size-full wp-image-8" title="coverflowtop" src="http://www.sebastiaanholtrop.com/wp-content/coverflowtop.jpg" alt="" width="500" height="281" /></a></p>
<p>There&#8217;s still a lot of work to do before it&#8217;s really useful, but i&#8217;m pretty content with the results so far.</p>
<p>I don&#8217;t know if I&#8217;ll ever finish this component. To me it was just a case study in which I wanted to explore the possibilities of the combination of a 3D engine and Flex.</p>
<ul>
<li><a href="http://www.sebastiaanholtrop.com/samples/coverflow/">View the example</a></li>
<li><a href="http://www.sebastiaanholtrop.com/samples/coverflow/srcview/index.html">Download the sourcode</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/5/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
