<?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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Rob Silverton</title>
	<atom:link href="http://robsilverton.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://robsilverton.wordpress.com</link>
	<description>Thoughts on systems</description>
	<lastBuildDate>Thu, 05 Jan 2012 10:47:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='robsilverton.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Rob Silverton</title>
		<link>http://robsilverton.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://robsilverton.wordpress.com/osd.xml" title="Rob Silverton" />
	<atom:link rel='hub' href='http://robsilverton.wordpress.com/?pushpress=hub'/>
		<item>
		<title>2011 in review</title>
		<link>http://robsilverton.wordpress.com/2012/01/01/2011-in-review/</link>
		<comments>http://robsilverton.wordpress.com/2012/01/01/2011-in-review/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 21:05:43 +0000</pubDate>
		<dc:creator>robsilverton</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://robsilverton.wordpress.com/?p=419</guid>
		<description><![CDATA[The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog. Here&#8217;s an excerpt: The concert hall at the Syndey Opera House holds 2,700 people. This blog was viewed about 13,000 times in 2011. If it were a concert at Sydney Opera House, it would take about 5 sold-out performances for that many [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=419&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.</p>
<p><a href="/2011/annual-report/"><img src="http://www.wordpress.com/wp-content/mu-plugins/annual-reports/img/emailteaser.jpg" alt="" width="100%" /></a></p>
<p>Here&#8217;s an excerpt:</p>
<blockquote><p>The concert hall at the Syndey Opera House holds 2,700 people. This blog was viewed about <strong>13,000</strong> times in 2011. If it were a concert at Sydney Opera House, it would take about 5 sold-out performances for that many people to see it.</p></blockquote>
<p><a href="/2011/annual-report/">Click here to see the complete report.</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robsilverton.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robsilverton.wordpress.com/419/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robsilverton.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robsilverton.wordpress.com/419/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robsilverton.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robsilverton.wordpress.com/419/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robsilverton.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robsilverton.wordpress.com/419/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robsilverton.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robsilverton.wordpress.com/419/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robsilverton.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robsilverton.wordpress.com/419/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robsilverton.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robsilverton.wordpress.com/419/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=419&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://robsilverton.wordpress.com/2012/01/01/2011-in-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/780fd0319ad01f12e5363a0471f32000?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">robsilverton</media:title>
		</media:content>

		<media:content url="http://www.wordpress.com/wp-content/mu-plugins/annual-reports/img/emailteaser.jpg" medium="image" />
	</item>
		<item>
		<title>Away3D 3.6.0: Three JS exporter WIP</title>
		<link>http://robsilverton.wordpress.com/2011/09/20/away3d-3-6-0-three-js-exporter-wip/</link>
		<comments>http://robsilverton.wordpress.com/2011/09/20/away3d-3-6-0-three-js-exporter-wip/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 16:32:18 +0000</pubDate>
		<dc:creator>robsilverton</dc:creator>
				<category><![CDATA[Away3D]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Three JS]]></category>

		<guid isPermaLink="false">http://robsilverton.wordpress.com/?p=378</guid>
		<description><![CDATA[As a follow on to my recent Away3d AS3Exporter update post, I began to wonder whether I could write a similar exporter for Three JS. I&#8217;ve managed to make a reasonable amount of progress with this- the current version can export various Away3D primitives to their correct positions, but I&#8217;m struggling a little with translating [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=378&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As a follow on to my recent <a title="Away3d Exporter update" href="http://robsilverton.wordpress.com/2011/09/09/away3d-3-6-0-as3exporter-update/" target="_blank">Away3d AS3Exporter update</a> post, I began to wonder whether I could write a similar exporter for <a title="Three JS" href="https://github.com/mrdoob/three.js/" target="_blank">Three JS</a>. I&#8217;ve managed to make a reasonable amount of progress with this- the current version can export various Away3D primitives to their correct positions, but I&#8217;m struggling a little with translating the rotation and scale properties.</p>
<p><a title="Flash source code" href="http://unwrong.com/download/rob/blog/away3d_3js_exporter1/srcview/" target="_blank">Here&#8217;s the code</a> for the latest version, and <a title="Three JS exporter swf" href="http://unwrong.com/download/rob/blog/away3d_3js_exporter1/" target="_blank">here&#8217;s the swf</a> which outputs the Three JS HTML file.</p>
<p>Clicking on the &#8220;export to 3JS&#8221; button generates the HTML file and copies the code to your clipboard. If you create a new text file in Notepad or similar, call it &#8220;exported.html&#8221; (the name doesn&#8217;t matter as long as the .html extension is there), paste in the code, save and open the html page. Note: this example doesn&#8217;t run in IE9 for me, so I&#8217;d advise opening it with <a title="Google Chrome browser" href="http://www.google.com/chrome/?installdataindex=nosearch&amp;hl=en-GB&amp;brand=CHMA&amp;utm_campaign=en-GB&amp;utm_source=en-GB-ha-emea-uk-bk&amp;utm_medium=ha" target="_blank">Google Chrome</a>. Alternatively, you can <a title="Exported scene 1" href="http://unwrong.com/download/rob/blog/away3d_3js_exporter1/exported.html" target="_blank">click here</a> to open the resultant Three JS scene in your browser. The image below describes the problem with the Three JS scene:</p>
<p><a href="http://robsilverton.files.wordpress.com/2011/09/awayto3js.jpg"><img class="alignleft size-full wp-image-381" title="awayTo3JS" src="http://robsilverton.files.wordpress.com/2011/09/awayto3js.jpg?w=497&#038;h=795" alt="" width="497" height="795" /></a>As you can see there are a few issues with the exported HTML file.</p>
<p>The first problem is that the red x-axis is inverted in Three JS. This is because Away3D is a left-handed system whereas Three JS is a <a title="Right handed system" href="http://en.wikipedia.org/wiki/Cartesian_coordinate_system#Orientation_and_handedness" target="_blank">right-handed system</a>. This means that the positions of the objects are correct asides from the fact they are inverted on the x-axis.</p>
<p>The second problem is that the primitives appear to be rotated +90 degrees around the x-axis. This seems to be due to the fact that the standard behaviour in Three JS is to build them from top to bottom along the z-axis, whereas the standard behaviour in Away3D is to build them from top to bottom along the y-axis.</p>
<p>I&#8217;ve attempted to resolve both of these issues in <code>exporters.ThreeJSExporter</code> in the following function:</p>
<p><pre class="brush: as3;">
private function getThreeJSMatrix( object3d:Object3D ):Matrix3D
{
  var m:Matrix3D = object3d.transform.clone();
  m.prependRotation(-90, Vector3D.X_AXIS);
  m.appendScale(-1,1,1);

  return m;
}</pre></p>
<p>The function <code>getThreeJSMatrix()</code> is called just before an object3d is serialised and updates the object&#8217;s <code>Matrix3D</code> in an attempt to correct it&#8217;s orientation in the resultant Three JS scene. As you can see from the image below, this works to some degree, though the plane primitives are rendered upside down (hence are invisible from this viewing angle) and the primitives which had rotations applied to them are incorrectly rotated in the new coordinate space. <a title="Exported scene 2" href="http://unwrong.com/download/rob/blog/away3d_3js_exporter1/exported2.html" target="_blank">Click here</a> to open the resultant Three JS scene in your browser.</p>
<p><img class="alignleft size-full wp-image-397" title="awayTo3JS2" src="http://robsilverton.files.wordpress.com/2011/09/awayto3js2.jpg?w=497&#038;h=397" alt="" width="497" height="397" />I&#8217;m hoping someone with a little more 3D knowledge will read this and help me to complete what should be a pretty neat little exporter.</p>
<p><strong>Key questions:</strong></p>
<ul>
<li>Should I rotate the objects through -90 degrees or is there another way in Three JS to alter the rendering orientation (e.g. <code>yUp = true</code> in Away3D)?</li>
<li>Can someone provide the necessary matrix transformation code to translate rotation and scale properties from a left-handed to a right-handed system?</li>
</ul>
<div>Thanks in advance! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robsilverton.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robsilverton.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robsilverton.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robsilverton.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robsilverton.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robsilverton.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robsilverton.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robsilverton.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robsilverton.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robsilverton.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robsilverton.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robsilverton.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robsilverton.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robsilverton.wordpress.com/378/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=378&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://robsilverton.wordpress.com/2011/09/20/away3d-3-6-0-three-js-exporter-wip/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/780fd0319ad01f12e5363a0471f32000?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">robsilverton</media:title>
		</media:content>

		<media:content url="http://robsilverton.files.wordpress.com/2011/09/awayto3js.jpg" medium="image">
			<media:title type="html">awayTo3JS</media:title>
		</media:content>

		<media:content url="http://robsilverton.files.wordpress.com/2011/09/awayto3js2.jpg" medium="image">
			<media:title type="html">awayTo3JS2</media:title>
		</media:content>
	</item>
		<item>
		<title>Away3D 3.6.0: AS3Exporter update</title>
		<link>http://robsilverton.wordpress.com/2011/09/09/away3d-3-6-0-as3exporter-update/</link>
		<comments>http://robsilverton.wordpress.com/2011/09/09/away3d-3-6-0-as3exporter-update/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 14:51:27 +0000</pubDate>
		<dc:creator>robsilverton</dc:creator>
				<category><![CDATA[Away3D]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://robsilverton.wordpress.com/?p=244</guid>
		<description><![CDATA[View/download the Source files for this post here. The tutorial also assumes you have a working build of Away3D 3.6.0. I&#8217;ve been playing around with the ActionScript exporter for Away3D 3.6.0 a fair bit recently and have found a few scenarios where it didn&#8217;t work so well. The upshot of this is that I&#8217;ve re-written the AS3Exporter.as file, solving [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=244&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>View/download the Source files for this post <a title="Source files" href="http://unwrong.com/download/rob/blog/away3d_exporter1/srcview/index.html" target="_blank">here</a>. The tutorial also assumes you have a working build of <a title="Away3D 3.6.0" href="http://away3d.com/download/away3d_3.6.0" target="_blank">Away3D 3.6.0</a>.</p>
<p>I&#8217;ve been playing around with the ActionScript exporter for Away3D 3.6.0 a fair bit recently and have found a few scenarios where it didn&#8217;t work so well. The upshot of this is that I&#8217;ve re-written the <code>AS3Exporter.as</code> file, solving the problems that I was able to identify while hanging onto the clever bits that already worked.</p>
<p>The following slideshow demonstrates a number of tests that I&#8217;ve created and included in the source files above. Each of the images represents one of the &#8220;TestScene&#8221; apps that can be run from the source project. Each of the test scenes has an Export to AS3 button which copies the exported AS3 file to your clipboard and defaults to using the new exporter at <code>exporters.AS3Exporter</code>, if you want to compare the new exporter against the old one, change the import statement for the exporter at the top to <code>import away3d.exporters.AS3Exporter</code>.</p>
<p>For <code>PrimitiveTestScene</code>, <code>MaterialsTestScene</code>, <code>TransformsTestScene</code>,  <code>ContainersTestScene</code> and <code>LoadedMeshTestScene</code>, the class <code>exported.ExportedScene</code> is created. Copy and paste this new code into the class file of the same name and then run the <code>ExportedSceneViewer</code> app to see the results.</p>
<p>For <code>SingleMeshTestScene</code> and <code>SinglePrimitiveTestScene</code>, the class <code>exported.ExportedMesh</code> is created. Copy and paste this new code into the class file of the same name then run the <code>ExporterMeshViewer</code> app to see the results.</p>

<a href='http://robsilverton.wordpress.com/2011/09/09/away3d-3-6-0-as3exporter-update/1_primitivestest/' title='1_primitivesTest'><img data-attachment-id='245' data-orig-size='500,738' data-liked='0'width="101" height="150" src="http://robsilverton.files.wordpress.com/2011/09/1_primitivestest.jpg?w=101&#038;h=150" class="attachment-thumbnail" alt="1_primitivesTest" title="1_primitivesTest" /></a>
<a href='http://robsilverton.wordpress.com/2011/09/09/away3d-3-6-0-as3exporter-update/2_materialstest/' title='2_materialsTest'><img data-attachment-id='246' data-orig-size='500,1097' data-liked='0'width="68" height="150" src="http://robsilverton.files.wordpress.com/2011/09/2_materialstest.jpg?w=68&#038;h=150" class="attachment-thumbnail" alt="2_materialsTest" title="2_materialsTest" /></a>
<a href='http://robsilverton.wordpress.com/2011/09/09/away3d-3-6-0-as3exporter-update/3_transformstest/' title='3_transformsTest'><img data-attachment-id='247' data-orig-size='500,1000' data-liked='0'width="75" height="150" src="http://robsilverton.files.wordpress.com/2011/09/3_transformstest.jpg?w=75&#038;h=150" class="attachment-thumbnail" alt="3_transformsTest" title="3_transformsTest" /></a>
<a href='http://robsilverton.wordpress.com/2011/09/09/away3d-3-6-0-as3exporter-update/4_objconttest/' title='4_objContTest'><img data-attachment-id='248' data-orig-size='500,780' data-liked='0'width="96" height="150" src="http://robsilverton.files.wordpress.com/2011/09/4_objconttest.jpg?w=96&#038;h=150" class="attachment-thumbnail" alt="4_objContTest" title="4_objContTest" /></a>
<a href='http://robsilverton.wordpress.com/2011/09/09/away3d-3-6-0-as3exporter-update/5_meshtest/' title='5_meshTest'><img data-attachment-id='249' data-orig-size='500,749' data-liked='0'width="100" height="150" src="http://robsilverton.files.wordpress.com/2011/09/5_meshtest.jpg?w=100&#038;h=150" class="attachment-thumbnail" alt="5_meshTest" title="5_meshTest" /></a>

<p>As you can see from the pictures, the new exporter succeeds in a number of scenarios where the old exporter failed. I&#8217;ll explain what&#8217;s happened in each test case briefly below:</p>
<p><strong>1. Primitives Test</strong></p>
<p>In this test, as we are only concerned with the rendering of the primitives&#8217; geometries rather than their materials, the old exporter works as well as the new exporter. Both however exhibit a problem where <code>Cone</code>, <code>WireCone</code>, <code>Cylinder</code> and <code>WireCylinder</code> are re-rendered at half of their previous height. This is actually due to a bug with the primitives rather than the exporters; in the <code>buildPrimitive()</code> function for each of these primitives we find the following line of code:</p>
<p><pre class="brush: as3;">_height /= 2;</pre></p>
<p>This line means that when you later get the height property for the primitive, it reports that it is half the height that you originally specified.</p>
<p>One difference you might notice in the code outputted by the exporters is that the new exporter omits any properties or functions that aren&#8217;t required for this specific scene in order to improve legibility. In this scene the <code>read()</code>, <code>setSource()</code> and <code>buildMaterials()</code> functions are omitted. It&#8217;s also worth noting that the <code>cleanUp()</code> function has been dropped altogether in the new version.</p>
<p>Whilst writing the parsers for each Objects3D I noticed that <code>LineSegment</code> currently requires <code>Vector3D</code>s if passed an initialisation object via the constructor function and <code>Vertex</code>s if setting the same properties via the classes public API, I&#8217;m assuming Vertex should now be done away with in favour of Vector3D.</p>
<p>I&#8217;ve also added support for <code>ObjectContainer3D</code> primitives, for example <code>Trident</code>. This functionality is currently disabled however, as Trident doesn&#8217;t expose the necessary public properties or accept an initialisation object in the same way as the other primitives. I propose the public properties <code>axisLength</code> and <code>showLetters</code> are introduced, which if changed force the Trident to re-render.</p>
<p><strong>2. Materials Test</strong></p>
<p>As you can see from the pictures, materials aren&#8217;t really supported in the old exporter, which makes sense as I&#8217;m sure the priority was to enable users to export custom meshes into ActionScript code. In the new exporter <code>BitmapMaterial</code>, <code>ColorMaterial</code>, <code>WireColorMaterial</code> and <code>WireframeMaterial</code> are supported. BitmapMaterial support will only work if you have passed a class to it which extends <code>BitmapData</code>. This is the default behaviour if you export a bitmap for ActionScript from within the Flash IDE, you can also look in the assets package in the source code for this project to see how you can achieve the same effect with code.</p>
<p><strong>3. Transforms Test</strong></p>
<p>As you can see from the pic, the new exporter remains faithful to the initial scene, apart from the aforementioned problem with the <code>Cone</code> primitive&#8217;s height. The problem with the old exporter is that it fails to register each primitive&#8217;s <code>scaleX</code>, <code>scaleY</code> and <code>scaleZ</code> properties. The new exporter will retain this information when using it&#8217;s default behaviour, but currently drops it when using object initialisers. What do I mean by that? Well&#8230; You may have noticed this line of code in the <code>clickExportBtnHandler()</code> function for each test scene:</p>
<p><pre class="brush: as3;">exporter.export( view.scene, &quot;ExportedScene&quot;, &quot;exported&quot;);//, true);</pre></p>
<p>The currently commented out optional extra Boolean value at the end is a flag to tell the exporter whether to use &#8220;object initialisers&#8221; or not, this is a new feature I&#8217;ve introduced. With the flag set to false, your primitive code will look like this:</p>
<p><pre class="brush: as3;">var sphere1:Sphere = new Sphere();
sphere1.segmentsW = 12;
sphere1.segmentsH = 9;
sphere1.radius = 100*_scale;
sphere1.position = new Vector3D(-500*_scale, 100*_scale, -1500*_scale);
sphere1.rotationX = 153.3;
sphere1.rotationY = 171.19;
sphere1.rotationZ = 201.22;
sphere1.scaleX = 0.87;
sphere1.scaleY = 1.59;
sphere1.scaleZ = 1.48;
sphere1.material = new WireColorMaterial(0x8d9e96, {wireColor:0x0});
_containers[0].addChild(sphere1);
_meshes.push(sphere1);</pre></p>
<p>With the flag set to true, it will look like this:</p>
<p><pre class="brush: as3;">var sphere1:Sphere = new Sphere({segmentsW:12, segmentsH:9, radius:100*_scale, x:-500*_scale, y:100*_scale, z:-1500*_scale, rotationX:18.54, rotationY:284.45, rotationZ:61.03, scaleX:0.64, scaleY:0.87, scaleZ:0.1, material:new WireColorMaterial(0x530424, {wireColor:0x0})});
_containers[0].addChild(sphere1);
_meshes.push(sphere1);</pre></p>
<p>I personally prefer the former over the latter for a number of reasons. In the battle between clarity and brevity in coding, I generally tend to find myself on the side of clarity. The latter approach relies on the individual to be aware of all of the relevant properties and to type them perfectly into a dynamic object without the benefit of auto-completion.</p>
<p>Also, by using the public API of the class in the former example, we can be more confident in our assumptions of exactly what will happen; by setting the <code>scaleX</code>, <code>scaleY</code> and <code>scaleZ</code> public properties, we can be fairly safe in the assumption that the primitive will be updated unless a reasonably significant bug exists. With the latter example however we are relying on the fact that the developer has written the code to parse these properties out of the object initialiser, and in this instance it appears they haven&#8217;t. If you click through to the constructor function for <code>away3d.core.base.Object3D</code> you can find the following line&#8230;</p>
<p><pre class="brush: as3;">scale( ini.getNumber(&quot;scale&quot;, 1) );</pre></p>
<p>&#8230;where support is added for a scale property which isn&#8217;t in fact reflected in <code>Object3D</code>&#8216;s public properties.</p>
<p>Finally, what the latter saves in terms of vertical code length it almost equals in horizontal code length, so it sacrifices clarity and predictability without a great improvement in brevity.</p>
<p>I&#8217;ve decided not to work around this bug with the new exporter as this is an issue which should be resolved with the <code>Object3D</code> init object parsing. Whilst the team are no doubt feverishly working on the next version of the framework to support <a title="Stage3D" href="http://labs.adobe.com/technologies/flashplatformruntimes/features/stage3d.html" target="_blank">Stage3D</a>, I think now could be a good time to question the logic of using object initialisers and the value of supporting the additional parsing code it necessarily creates.</p>
<p><strong>4. Containers Test</strong></p>
<p>The problem with the old exporter in this instance is simply a small error in the ObjectContainer3D exporter code. Here&#8217;s the relevant code the old exporter creates:</p>
<p><pre class="brush: as3;">var cont1:ObjectContainer3D = new ObjectContainer3D();
aC.push(cont1);
addChild(cont1);
var m1:Matrix3D = new Matrix3D();
m1.rawData = Vector.([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);
transform = m1;
cont1.movePivot(0,0,0);</pre></p>
<p>The error is in the line <code>transform = m1</code>, if this is changed to <code>cont1.transform = m1</code>, it works fine.</p>
<p>This brings me neatly onto the topic of the code structure within the old AS3Exporter class. If you look for instance at the code dealing with writing out containers in the old <code>parse()</code> function, it looks like this:</p>
<p><pre class="brush: as3;">
if(containerid != -1){
  containerString += &quot;\n\t\t\tvar cont&quot;+id+&quot;:ObjectContainer3D = new ObjectContainer3D();\n&quot;;
  containerString += &quot;\t\t\taC.push(cont&quot;+id+&quot;);\n&quot;;
  if (containerid == 0)
    containerString += &quot;\t\t\taddChild(cont&quot;+id+&quot;);\n&quot;;
  else
    containerString += &quot;\t\t\tcont&quot;+containerid+&quot;.addChild(cont&quot;+id+&quot;);\n&quot;;

    containerString +=&quot;\t\t\tvar m&quot;+id+&quot;:Matrix3D = new Matrix3D();\n&quot;;
    v = obj.transform.rawData;
    containerString += &quot;\t\t\tm&quot;+id+&quot;.rawData = Vector.([&quot;+v[0]+&quot;,&quot;+v[1]+&quot;,&quot;+v[2]+&quot;,&quot;+v[3]+&quot;,&quot;+v[4]+&quot;,&quot;+v[5]+&quot;,&quot;+v[6]+&quot;,&quot;+v[7]+&quot;,&quot;+v[8]+&quot;,&quot;+v[9]+&quot;,&quot;+v[10]+&quot;,&quot;+v[11]+&quot;,&quot;+v[12]+&quot;,&quot;+v[13]+&quot;,&quot;+v[14]+&quot;,&quot;+v[15]+&quot;]);\n&quot;
    containerString += &quot;\t\t\ttransform = m&quot;+id+&quot;;\n&quot;;

    if(obj.name != null)
      containerString += &quot;\t\t\tcont&quot;+id+&quot;.name = \&quot;&quot;+obj.name+&quot;\&quot;;\n&quot;;
    if(obj.pivotPoint.toString() != &quot;x:0 y:0 z:0&quot;)
      containerString += &quot;\t\t\tcont&quot;+id+&quot;.movePivot(&quot;+obj.pivotPoint.x+&quot;,&quot;+obj.pivotPoint.y+&quot;,&quot;+obj.pivotPoint.z+&quot;);\n&quot;;
}else{
  containerString += &quot;\t\t\taC.push(this);\n&quot;;
  containerString += &quot;\t\t\tvar m&quot;+id+&quot;:Matrix3D = new Matrix3D();\n&quot;;
  v = obj.transform.rawData;
  containerString +=&quot;\t\t\tm&quot;+id+&quot;.rawData = Vector.([&quot;+v[0]+&quot;,&quot;+v[1]+&quot;,&quot;+v[2]+&quot;,&quot;+v[3]+&quot;,&quot;+v[4]+&quot;,&quot;+v[5]+&quot;,&quot;+v[6]+&quot;,&quot;+v[7]+&quot;,&quot;+v[8]+&quot;,&quot;+v[9]+&quot;,&quot;+v[10]+&quot;,&quot;+v[11]+&quot;,&quot;+v[12]+&quot;,&quot;+v[13]+&quot;,&quot;+v[14]+&quot;,&quot;+v[15]+&quot;]);\n&quot;
  containerString += &quot;\t\t\ttransform = m&quot;+id+&quot;;\n&quot;;

  if (obj.name != null)
    containerString += &quot;\t\t\tname = \&quot;&quot;+obj.name+&quot;\&quot;;\n&quot;;
  if (obj.pivotPoint.toString() != &quot;x:0 y:0 z:0&quot;)
    containerString += &quot;\t\t\tmovePivot(&quot;+obj.pivotPoint.x+&quot;,&quot;+obj.pivotPoint.y+&quot;,&quot;+obj.pivotPoint.z+&quot;);\n&quot;;
}
</pre></p>
<p>The first thing I notice about this is there&#8217;s loads of repetition which could (and should) be turned into functions in order to avoid the errors which creep in from typing and retyping code. Here&#8217;s the equivalent code in the new version:</p>
<p><pre class="brush: as3;">
if(containerid != -1)
{
  containerString += newLine();
  containerName	= getContainerName(type, id);
  containerString += newLine(getObject3dDefAsString(type, object3d, id, 3));
}
else
{
  containerName = &quot;this&quot;;
  var obj2	:Object = getObject3dDataObj( object3d );
  containerString += writeDataObjAsString( obj2, containerName, 3 );
}

containerString += newLine(&quot;_containers.push(&quot;+containerName+&quot;);&quot;, 3);

if(containerid != -1)
{
  if (containerid == 0)
    containerString += newLine(&quot;addChild(&quot;+containerName+&quot;);&quot;, 3);
  else
    containerString += newLine(&quot;_containers[&quot;+containerid+&quot;].addChild(&quot;+containerName+&quot;);&quot;, 3);
}
</pre></p>
<p>Firstly, all the <code>\t</code>s and <code>\n</code>s have been incorporated into the <code>newLine()</code> function, which creates a new line, inserts your new string and prepends the specified number of tab indents.</p>
<p>Secondly, all <code>Object3D</code> parsing is (as soon as is practicably possible) fed into one central pipeline, rather than being written and re-written for different circumstances. Within <code>getObject3dDefAsString()</code> a data object is created to contain all of the properties for the <code>Object3D</code> which need to be serialised. The first thing this function does is look for a specific parser for the <code>Object3D</code> in question. It does this by looking in the <code>_registeredObject3dTypes</code> and <code>_registeredContainerTypes</code> Dictionaries to see if a parsing function has been associated with it&#8217;s type. If the type is <code>Cube</code> for instance, the following parsing function will be found and the relevant properties for the Cube will be added to the data object:</p>
<p><pre class="brush: as3;">
private function getCubeDataObj(object3d:Object3D, obj:Object):Object
{
  var cube:Cube = Cube(object3d);
  obj.props.push(new KVP(&quot;width&quot;, cube.width+&quot;*_scale&quot;));
  obj.props.push(new KVP(&quot;height&quot;, cube.height+&quot;*_scale&quot;));
  obj.props.push(new KVP(&quot;depth&quot;, cube.depth+&quot;*_scale&quot;));

  return obj;
}
</pre></p>
<p>Next, <code>getMeshDataObj()</code> is called, which in turn calls <code>getObject3dDataObj()</code>. Between these 3 functions we should be able to glean all necessary information to serialise any <code>Primitive</code>, <code>Mesh</code> or <code>ObjectContainer3D</code> in the scene. Forcing all <code>Object3D</code>s to be parsed via this one pipeline removes the possibility for errors creeping in from copying and pasting code.</p>
<p>Also, because all Object3Ds are now parsed via the same pipeline, our position code for the ObjectContainer3D now writes out as the much more human readable:</p>
<p><pre class="brush: as3;">objectcontainer3d2.position = new Vector3D(400*_scale, 0*_scale, 0*_scale);</pre></p>
<p>As opposed to the slightly less intelligible:</p>
<p><pre class="brush: as3;">var m2:Matrix3D = new Matrix3D();
m2.rawData = Vector.([1,0,0,0,0,1,0,0,0,0,1,0,400,0,0,1]);
cont2.transform = m2;</pre></p>
<p><strong>5. Loaded Mesh Test</strong></p>
<p>The obvious visual difference between the old and the new exported scenes in the accompanying picture is that the old exporter fails to retain the rotation properties and material for the Mesh.</p>
<p>If you look at the code the exporters writes out however, the old version writes quite a long <code>buildMeshes()</code> function where the Mesh is created from an accompanying data object:</p>
<p><pre class="brush: as3;">
private function buildMeshes():void
{
...
  objs.obj0 = {name:&quot;turtle&quot;,  transform:m0, pivotPoint:new Vector3D(0,0,0), container:0, bothsides:false, material:null, ownCanvas:false, pushfront:false, pushback:false};
  objs.obj0.geo=geos[0];
...
  for(var i:int = 0;i    ref = objs[&quot;obj&quot;+i];
    if(ref != null){
      mesh = new Mesh();
      mesh.type = &quot;.as&quot;;
      mesh.bothsides = ref.bothsides;
...
}
</pre></p>
<p>In the new version these data objects are done away with and the Meshes are written out as strictly typed objects:</p>
<p><pre class="brush: as3;">
private function buildMeshes():void
{
  _meshes = [];

  var mesh0:Mesh = new Mesh();
  mesh0.name = &quot;turtle&quot;;
  mesh0.rotationY = 90;
  mesh0.rotationZ = 180;
  mesh0.material = new BitmapMaterial(new assets.TurtleTexture());
  mesh0.geometry = buildGeometry(_geometries[0], mesh0.material);
  _containers[0].addChild(mesh0);
  _meshes.push(mesh0);
}
</pre></p>
<p>The geometry data which still needs to be read in from Strings at runtime still remains in data objects within the <code>setSource()</code> function, and the business of reading it is now delegated to the new <code>buildGeometry()</code> function.</p>
<p><strong>6. Single Mesh Test</strong></p>
<p>This Test Scene targets a single <code>Mesh</code> within the scene for export rather than the scene itself. The old exporter almost works as well as the new exporter in this scenario, except it doesn&#8217;t have the benefit of the new <code>Material</code>s support.</p>
<p>Remember that the exported code for tests 6 and 7 needs to be pasted into <code>exported.ExportedMesh</code> rather than <code>exported.ExportedScene</code> as per the previous tests.</p>
<p><strong>7. Single Primitive Test</strong></p>
<p>This Test Scene allows the user to target a single <code>Primitive</code> within the scene for export rather than the scene itself. The new exporter simply extends the relevant primitive and adds the new properties like so:</p>
<p><pre class="brush: as3;">
public class ExportedMesh extends Cylinder
{
  private var _scale:Number;

  public function ExportedMesh(init:Object = null)
  {
    var ini:Init = Init.parse(init);
    _scale = ini.getNumber(&quot;scaling&quot;, 1);
    buildMeshes();
  }

  private function buildMeshes():void
  {
    segmentsW = 6;
    segmentsH = 4;
    radius = 100*_scale;
    height = 100*_scale;
    openEnded = false;
    position = new Vector3D(-730*_scale, 100*_scale, -200*_scale);
    material = new WireColorMaterial(0x26f40, {wireColor:0x0});
  }
}
</pre></p>
<p>The old exporter fails to create valid code in this instance.</p>
<p>So, in summary:</p>
<p><strong>Old Exporter Issues:</strong></p>
<ul>
<li>Fails to read <code>Materials</code> in Materials Test.</li>
<li>Fails to retain transform information in Transforms Test and Containers Test.</li>
<li>Fails to retain the rotation information for Loaded Mesh Test.</li>
<li>Fails the Single Primitive test, exporting code containing errors.</li>
</ul>
<div>
<p><strong>New Exporter Enhancements:</strong></p>
<ul>
<li>Reads <code>BitmapMaterial</code>, <code>ColorMaterial</code>, <code>WireColorMaterial</code>, <code>WireframeMaterial</code>.</li>
<li>Dynamically imports any classes that extend <code>BitmapData</code> which are being used in BitmapMaterials.</li>
<li>All <code>Object3D</code> parsing fed down one central pipeline, removing possibility for copying errors.</li>
<li>Support for specific <code>Object3DContainers</code> e.g. <code>Trident</code>.</li>
<li>Code only included in exported class if required.</li>
<li>Variable names in exported class made more readable, <code>aC = _containers</code>, <code>oList = _meshes</code>, getters wrap properties of the same name with a preceding &#8220;_&#8221;.</li>
<li><code>objs.obj..</code> and <code>Mesh</code> parsing code removed from exported class.</li>
<li>Strict typing favoured over object initialisers, though both are now supported in exported class.</li>
</ul>
</div>
<p><strong>General Issues: </strong></p>
<ul>
<li><code>LineSegment</code> requires <code>Vector3D</code> if dealing with init object and <code>Vertex</code> if using the public properties.</li>
<li><code>Object3D</code> init object doesn&#8217;t parse <code>scaleX</code>, <code>scaleY</code>, <code>scaleZ</code>, so this fails when in object initialisers mode.</li>
<li><code>Cone</code>, <code>WireCone</code>, <code>Cylinder</code> and <code>WireCylinder</code> Primitives have <code>_height /= 2</code> error.</li>
<li><code>Trident</code> primitive should be updated to accept object initialisers and have the public properties <code>axisLength</code> and <code>showLetters</code>.</li>
</ul>
<p>I hope this helps when writing the new exporter for Away3D 4 and I look forward to playing with it! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robsilverton.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robsilverton.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robsilverton.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robsilverton.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robsilverton.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robsilverton.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robsilverton.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robsilverton.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robsilverton.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robsilverton.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robsilverton.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robsilverton.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robsilverton.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robsilverton.wordpress.com/244/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=244&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://robsilverton.wordpress.com/2011/09/09/away3d-3-6-0-as3exporter-update/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/780fd0319ad01f12e5363a0471f32000?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">robsilverton</media:title>
		</media:content>

		<media:content url="http://robsilverton.files.wordpress.com/2011/09/1_primitivestest.jpg?w=101" medium="image">
			<media:title type="html">1_primitivesTest</media:title>
		</media:content>

		<media:content url="http://robsilverton.files.wordpress.com/2011/09/2_materialstest.jpg?w=68" medium="image">
			<media:title type="html">2_materialsTest</media:title>
		</media:content>

		<media:content url="http://robsilverton.files.wordpress.com/2011/09/3_transformstest.jpg?w=75" medium="image">
			<media:title type="html">3_transformsTest</media:title>
		</media:content>

		<media:content url="http://robsilverton.files.wordpress.com/2011/09/4_objconttest.jpg?w=96" medium="image">
			<media:title type="html">4_objContTest</media:title>
		</media:content>

		<media:content url="http://robsilverton.files.wordpress.com/2011/09/5_meshtest.jpg?w=100" medium="image">
			<media:title type="html">5_meshTest</media:title>
		</media:content>
	</item>
		<item>
		<title>Away3D 3.6.0: TargetCamera3D v2 &#8211; Fixed axes</title>
		<link>http://robsilverton.wordpress.com/2011/08/26/away3d-targetcamera3d-v2-fixed-axes/</link>
		<comments>http://robsilverton.wordpress.com/2011/08/26/away3d-targetcamera3d-v2-fixed-axes/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 16:18:18 +0000</pubDate>
		<dc:creator>robsilverton</dc:creator>
				<category><![CDATA[Away3D]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://robsilverton.wordpress.com/?p=210</guid>
		<description><![CDATA[View/download the Source files for this tutorial here, and view the main swf here. The tutorial also assumes you have a working build of Away3D 3.6.0. Writing that last tutorial was enough to pique my old friend Jon&#8216;s interest, who has provided me with the next bit of info I needed in order to improve my target cam. The last [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=210&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>View/download the Source files for this tutorial <a title="Source files" href="http://unwrong.com/download/rob/blog/away3d_targcam2/srcview/index.html" target="_blank">here</a>, and view the main swf <a title="Main swf" href="http://unwrong.com/download/rob/blog/away3d_targcam2/index.html" target="_blank">here</a>. The tutorial also assumes you have a working build of <a title="Away3D 3.6.0" href="http://away3d.com/download/away3d_3.6.0" target="_blank">Away3D 3.6.0</a>.</p>
<p>Writing that <a title="Away3D: TargetCamera3D spiralling problem fix" href="http://robsilverton.wordpress.com/2011/08/24/away3d-targetcamera3d-spiralling-problem-fix/" target="_blank">last tutorial</a> was enough to pique my old friend <a title="Jonathan Pace" href="http://jonathanpace.wordpress.com/" target="_blank">Jon</a>&#8216;s interest, who has provided me with the next bit of info I needed in order to improve my target cam. The last tutorial behaves in the following way:</p>
<p><a href="http://robsilverton.files.wordpress.com/2011/08/cam3d_rotate_axes.jpg"><img class="alignleft size-full wp-image-215" title="cam3d_rotate_axes" src="http://robsilverton.files.wordpress.com/2011/08/cam3d_rotate_axes.jpg?w=497&#038;h=397" alt="" width="497" height="397" /></a><br />
Position 2 is a 45 degree rotation around the X axis, which in the above diagram would be facing directly towards us. In rotation jargon, this is referred to as a change in &#8220;pitch&#8221;. You can move the camera to this position yourself by opening <a title="TargetCamera3D example" href="http://unwrong.com/download/rob/blog/away3d_targcam1/index.html" target="_blank">this example</a>, clicking the Flash to gain focus and holding the W key until you&#8217;re halfway towards the topmost point of the sphere. What we&#8217;re actually doing here is rotating the camera&#8217;s internal coordinate space around it&#8217;s 0,0,0 point, positioned in line with the centre of the sphere. If you now hold the A key to rotate left around the Y axis (referred to in the jargon as &#8220;yaw&#8221;), you are rotated around the Y axis you see in position 2, not the Y axis in position 1. This is fine as it&#8217;s logically consistent, though it&#8217;s apparently not what you would expect from camera functionality in most 3D editor programs. As with the functionality in <a title="Away3D basics - The cameras" href="http://www.flashmagazine.com/tutorials/detail/away3d_basics_the_cameras/" target="_blank">the tutorial</a> that inspired me to write these tutorials, the camera is expected to behave as follows:</p>
<p><a href="http://robsilverton.files.wordpress.com/2011/08/cam3d_rotate_fixed_axes.jpg"><img class="alignleft size-full wp-image-223" title="cam3d_rotate_fixed_axes" src="http://robsilverton.files.wordpress.com/2011/08/cam3d_rotate_fixed_axes.jpg?w=497&#038;h=397" alt="" width="497" height="397" /></a>This behaviour is a result of the fact that the X,Y and Z axes are fixed, so holding the A key will result in a leftward rotation around the fixed Y axis; the closer you are to the topmost point of the target object, the narrower your orbit. If you have a play with the latest version below, you can see this is now working.</p>
<p><a href="http://unwrong.com/download/rob/blog/away3d_targcam2/index.html"><img class="alignleft size-full wp-image-180" title="targ_cam_clickToOpen.jpg" src="http://robsilverton.files.wordpress.com/2011/08/targ_cam_clicktoopen.jpg?w=497&#038;h=398" alt="" width="497" height="398" /></a></p>
<p>So how was this achieved? Our main app class remains unchanged from the previous tutorial, but we&#8217;ve overridden the <span style="font-family:'Courier New';">pitch()</span>, <span style="font-family:'Courier New';">yaw()</span> and <span style="font-family:'Courier New';">roll()</span> methods the <span style="font-family:'Courier New';">TargetCamera3D2</span> class inherits from <span style="font-family:'Courier New';">Object3D</span>:</p>
<p><pre class="brush: as3;">
private var _pitch:Number = 0;
private var _yaw:Number = 0;
private var _roll:Number = 0;

override public function pitch(angle:Number):void
{
  _pitch += angle;
  transform = buildMatrix();
}
override public function yaw(angle:Number):void
{
  _yaw += angle;
  transform = buildMatrix();
}
override public function roll(angle:Number):void
{
  _roll += angle;
  transform = buildMatrix();
}
</pre></p>
<p>Our new methods update the <span style="font-family:'Courier New';">_pitch</span>, <span style="font-family:'Courier New';">_yaw</span> and <span style="font-family:'Courier New';">_roll</span> values, which are used to store absolute values for our rotation along the 3 axes. When these values are updated we update the object&#8217;s <span style="font-family:'Courier New';">transform</span> by calling the following method:</p>
<p><pre class="brush: as3;">
private function buildMatrix():Matrix3D
{
  var matrix:Matrix3D = new Matrix3D();            
  matrix.appendRotation( _pitch, Vector3D.X_AXIS );
  matrix.appendRotation( _yaw, Vector3D.Y_AXIS );
  matrix.appendRotation( _roll, Vector3D.Z_AXIS );
  matrix.appendTranslation(position.x, position.y, position.z);
  return matrix;
}
</pre></p>
<p>Instead of incrementally updating our object&#8217;s rotation using the current position of the axes as per the first diagram, the <span style="font-family:'Courier New';">buildMatrix()</span> method starts from scratch each time with a new <span style="font-family:'Courier New';">Matrix3D</span>, applies each rotation in turn and finally updates it&#8217;s 0,0,0 position to align with the centre of the target object. This approach ensures that the object&#8217;s rotations happen relative to fixed X,Y,Z axes which correlate with the world&#8217;s coordinate space. And there you have it. Thanks Jon!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robsilverton.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robsilverton.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robsilverton.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robsilverton.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robsilverton.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robsilverton.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robsilverton.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robsilverton.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robsilverton.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robsilverton.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robsilverton.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robsilverton.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robsilverton.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robsilverton.wordpress.com/210/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=210&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://robsilverton.wordpress.com/2011/08/26/away3d-targetcamera3d-v2-fixed-axes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/780fd0319ad01f12e5363a0471f32000?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">robsilverton</media:title>
		</media:content>

		<media:content url="http://robsilverton.files.wordpress.com/2011/08/cam3d_rotate_axes.jpg" medium="image">
			<media:title type="html">cam3d_rotate_axes</media:title>
		</media:content>

		<media:content url="http://robsilverton.files.wordpress.com/2011/08/cam3d_rotate_fixed_axes.jpg" medium="image">
			<media:title type="html">cam3d_rotate_fixed_axes</media:title>
		</media:content>

		<media:content url="http://robsilverton.files.wordpress.com/2011/08/targ_cam_clicktoopen.jpg" medium="image">
			<media:title type="html">targ_cam_clickToOpen.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>Away3D 3.6.0: TargetCamera3D spiralling problem fix</title>
		<link>http://robsilverton.wordpress.com/2011/08/24/away3d-targetcamera3d-spiralling-problem-fix/</link>
		<comments>http://robsilverton.wordpress.com/2011/08/24/away3d-targetcamera3d-spiralling-problem-fix/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 14:47:50 +0000</pubDate>
		<dc:creator>robsilverton</dc:creator>
				<category><![CDATA[Away3D]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">https://robsilverton.wordpress.com/?p=175</guid>
		<description><![CDATA[View/download the Source files for this tutorial here, and view the main swf here. The tutorial also assumes you have a working build of Away3D 3.6.0. Due to the recent developments with Molehill for Flash Player, I’ve finally decided it’s time to start playing with 3D in Flash. After a brief look around I decided that Away3D [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=175&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>View/download the Source files for this tutorial <a title="Source files" href="http://unwrong.com/download/rob/blog/away3d_targcam1/srcview/index.html" target="_blank">here</a>, and view the main swf <a title="Main swf" href="http://unwrong.com/download/rob/blog/away3d_targcam1/index.html" target="_blank">here</a>. The tutorial also assumes you have a working build of <a title="Away3D 3.6.0" href="http://away3d.com/download/away3d_3.6.0" target="_blank">Away3D 3.6.0</a>.</p>
<p>Due to the recent developments with <a href="http://labs.adobe.com/technologies/flashplatformruntimes/features/stage3d.html" target="_blank">Molehill</a> for Flash Player, I’ve finally decided it’s time to start playing with 3D in Flash. After a brief look around I decided that <a href="http://away3d.com/" target="_blank">Away3D</a> seemed to be a good bet; it looks to be pretty actively developed, has some great examples online and critically, will support Molehill.</p>
<p>Cameras are one of the initial concepts you need to get your head around. After a quick search I found this <a href="http://www.flashmagazine.com/tutorials/detail/away3d_basics_the_cameras/" target="_blank">great tutorial</a> which gives an exceptionally clear and concise overview of the main ideas. One thing did bug me a little however; if you scroll down to the TargetCamera3D example, click on the Flash example to gain focus and press the up arrow key on your keyboard until the red sphere fills your screen. Now hold down the A key so that the camera spins around the sphere. Notice how the camera is gradually drifting away from the target object.</p>
<p>If we look at the code for this example, line 69 in <a href="http://www.flashmagazine.com/articlefiles/away3d/ExTargetCamera3D.as" target="_blank">ExTargetCamera3D.as</a> tells the camera to move left by 10 units when the A key is pressed:</p>
<p><pre class="brush: as3;">case 65 : cam.moveLeft(10); break;</pre></p>
<p><span style="font-family:'Courier New';">moveLeft()</span> is a method of <span style="font-family:'Courier New';">Object3D,</span> which <span style="font-family:'Courier New';">TargetCamera3D</span> extends. The description for this method is as follows: “Moves the 3d object backwards along it&#8217;s local x axis”. Next, the code within the getter function for <span style="font-family:'Courier New';">away3d.cameras.TargetCamera3D.viewMatrix</span> forces the camera to <span style="font-family:'Courier New';">lookAt()</span> it’s target when the position is updated. So in summary, move left, perpendicular to the direction you are facing, then at the end of the move, turn to face the target object.</p>
<p>The following diagram demonstrates how this behaviour causes the camera to quickly drift out of the circular orbit you may expect into a spiral pattern, first moving directly to it&#8217;s left, then turning to face the sphere.</p>
<p><a href="http://robsilverton.files.wordpress.com/2011/08/cam3d_drift.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="cam3d_drift" src="http://robsilverton.files.wordpress.com/2011/08/cam3d_drift_thumb.jpg?w=504&#038;h=404" alt="cam3d_drift" width="504" height="404" border="0" /></a></p>
<p>In order to resolve this, I’ve made a few small changes to the tutorial. You can find all the code you&#8217;ll need in the first sentence of this tutorial.</p>
<p>The following lines in our main app class contain the first important difference from the previous tutorial:</p>
<p><pre class="brush: as3;">
// create a basic camera
cam = new TargetCamera3D2();
cam.movePivotBackward(1000);
// add cam to scene!
view.scene.addChild(cam);
</pre></p>
<p>Instead of moving the camera backward via the line:</p>
<p><pre class="brush: as3;">
cam.z = -1000;
</pre></p>
<p>We are now using the newly defined function:</p>
<p><pre class="brush: as3;">
cam.movePivotBackward(1000);
</pre></p>
<p>Also, just as critically we&#8217;re now adding the camera to the 3D scene. If we don&#8217;t do this our <span style="font-family:'Courier New';">movePivotBackward()</span> and <span style="font-family:'Courier New';">movePivotForward()</span> functions won&#8217;t work as our camera object will never be forced to validate by the scene graph, so will never get around to updating the position of the pivot.</p>
<p>The next key difference in the app code is that instead of using the <span style="font-family:'Courier New';">moveUp()</span>, <span style="font-family:'Courier New';">moveDown()</span>, <span style="font-family:'Courier New';">moveLeft()</span> and <span style="font-family:'Courier New';">moveRight()</span> functions on <span style="font-family:'Courier New';">Object3D</span> in order to move the camera, we are now using it&#8217;s rotation functions <span style="font-family:'Courier New';">pitch()</span> and <span style="font-family:'Courier New';">yaw():</span></p>
<p><pre class="brush: as3;">
private function update(e:Event):void
{
  var distance:uint = 5;
  var rotateStep:uint = 1;

  if(keyIsDown){
    // if the key is still pressed, just keep on moving
    switch(lastKey){
      case KEY_W: cam.pitch(rotateStep); break;
      case KEY_S: cam.pitch(-rotateStep); break;
      case KEY_A: cam.yaw(rotateStep); break;
      case KEY_D: cam.yaw(-rotateStep); break;
      case Keyboard.UP: cam.movePivotForward(distance); break;
      case Keyboard.DOWN: cam.movePivotBackward(distance); break;
      case Keyboard.LEFT: cam.roll(rotateStep); break;
      case Keyboard.RIGHT: cam.roll(-rotateStep); break;
    }
  }
  // render the view
  view.render();
}
</pre></p>
<p>You&#8217;ll notice I&#8217;ve also introduced the ability to roll the camera using the left and right keys, as well as defining my own functions on the camera class for the up and down keys. Using the W,A,S,D and UP, DOWN, LEFT, RIGHT keys to navigate, have a play with the version below. Try zooming into the sphere as far as you can go as before by pressing the UP key, then hold the A key down. You&#8217;ll notice that it no longer displays the spiralling behaviour.</p>
<p><a href="http://unwrong.com/download/rob/blog/away3d_targcam1/index.html" target="_blank"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="targ_cam_clickToOpen" src="http://robsilverton.files.wordpress.com/2011/08/targ_cam_clicktoopen.jpg?w=504&#038;h=404" alt="targ_cam_clickToOpen" width="504" height="404" border="0" /></a></p>
<p>You may also notice another subtle change in behaviour from the previous tutorial.</p>
<p><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="targ_cam_rotate" src="http://robsilverton.files.wordpress.com/2011/08/cam3d_rotate1.jpg?w=504&#038;h=404" alt="targ_cam_rotate" width="504" height="404" border="0" /></p>
<p>In the previous tutorial&#8217;s swf, If you move the camera to the top of the sphere by holding the W key, then hold the A key, you&#8217;ll notice the camera quickly spirals around the topmost point of the sphere (see 1. in the above diagram), then gradually drifts outwards and downwards in a path similar to the apple peel above . This is due to the fact that we are telling the camera to &#8220;move left&#8221; rather than &#8220;rotate left&#8221;, and after moving directly left it turns to face the centre of the target object again. In our new tutorial, the camera orbits around the object on the designated axis (see 2.).</p>
<p>Finally, one other point worth mentioning is the difference in implementation regarding the <span style="font-family:'Courier New';">TargetCamera3D2.target</span> property.</p>
<p><pre class="brush: as3;">
public function set target( value:Object3D ):void
{
  if ( _target == value )  return;
  _target = value;
  position = _target.position;
}
</pre></p>
<p>When our new camera&#8217;s target is set, we update the position of our camera to be the centre of the target object. When we move the camera&#8217;s internal pivot point backward using <span style="font-family:'Courier New';">movePivotBackward()</span>, it continues to look at the 0,0,0 point in it&#8217;s own coordinate space; it just so happens that it&#8217;s internal zero point is exactly aligned with the zero point of the target object&#8217;s coordinate space, hence rotating the camera within it&#8217;s internal coordinate space rotates it perfectly around the target object.</p>
<p>Hope that makes sense and is of some use to someone! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robsilverton.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robsilverton.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robsilverton.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robsilverton.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robsilverton.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robsilverton.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robsilverton.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robsilverton.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robsilverton.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robsilverton.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robsilverton.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robsilverton.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robsilverton.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robsilverton.wordpress.com/175/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=175&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://robsilverton.wordpress.com/2011/08/24/away3d-targetcamera3d-spiralling-problem-fix/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/780fd0319ad01f12e5363a0471f32000?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">robsilverton</media:title>
		</media:content>

		<media:content url="http://robsilverton.files.wordpress.com/2011/08/cam3d_drift_thumb.jpg" medium="image">
			<media:title type="html">cam3d_drift</media:title>
		</media:content>

		<media:content url="http://robsilverton.files.wordpress.com/2011/08/targ_cam_clicktoopen.jpg" medium="image">
			<media:title type="html">targ_cam_clickToOpen</media:title>
		</media:content>

		<media:content url="http://robsilverton.files.wordpress.com/2011/08/cam3d_rotate1.jpg" medium="image">
			<media:title type="html">targ_cam_rotate</media:title>
		</media:content>
	</item>
		<item>
		<title>Unwrong: Past, Present &amp; Future</title>
		<link>http://robsilverton.wordpress.com/2010/09/30/unwrong-past-present-future/</link>
		<comments>http://robsilverton.wordpress.com/2010/09/30/unwrong-past-present-future/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 10:24:13 +0000</pubDate>
		<dc:creator>robsilverton</dc:creator>
				<category><![CDATA[Editor]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://robsilverton.wordpress.com/?p=161</guid>
		<description><![CDATA[Here&#8217;s a look at what our company &#8220;Unwrong&#8221; have worked on over the last 6 years and where we&#8217;re headed, including our new custom editor framework &#8220;Bones&#8221;. Hope you like.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=161&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a look at what our company &#8220;Unwrong&#8221; have worked on over the last 6 years and where we&#8217;re headed, including our new custom editor framework &#8220;Bones&#8221;. Hope you like. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class='embed-vimeo' style='text-align:center;'><iframe src='http://player.vimeo.com/video/15187077' width='400' height='300' frameborder='0'></iframe></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robsilverton.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robsilverton.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robsilverton.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robsilverton.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robsilverton.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robsilverton.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robsilverton.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robsilverton.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robsilverton.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robsilverton.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robsilverton.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robsilverton.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robsilverton.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robsilverton.wordpress.com/161/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=161&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://robsilverton.wordpress.com/2010/09/30/unwrong-past-present-future/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/780fd0319ad01f12e5363a0471f32000?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">robsilverton</media:title>
		</media:content>
	</item>
		<item>
		<title>Basic SharedObject example in Flex, Red5 &amp; Flash Media Server</title>
		<link>http://robsilverton.wordpress.com/2008/12/04/basic-sharedobject-example-in-flex-red5-flash-media-server/</link>
		<comments>http://robsilverton.wordpress.com/2008/12/04/basic-sharedobject-example-in-flex-red5-flash-media-server/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 19:29:04 +0000</pubDate>
		<dc:creator>robsilverton</dc:creator>
				<category><![CDATA[FMS]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Red5]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://robsilverton.wordpress.com/2008/12/04/basic-sharedobject-example-in-flex-red5-flash-media-server/</guid>
		<description><![CDATA[Prerequisites: • Intermediate AS3 knowledge • Flex 3 • Flash Media Server and/or Red5 + Java EE Resources: • View Flex source • View Flash Media Server Source • View Red5 source • Download Flex source • Download Flash Media Server Source • Download Red5 source • An indispensable guide to migrating from FMS to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=153&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Prerequisites:</strong></p>
<p>• Intermediate AS3 knowledge<br />
• Flex 3<br />
• Flash Media Server and/or Red5 + Java EE</p>
<p><strong>Resources:</strong></p>
<p>• <a href="http://www.unwrong.com/download/rob/blog/simpleChat1/Flex/" target="_blank">View Flex source</a><br />
• <a href="http://www.unwrong.com/download/rob/blog/simpleChat1/FMS/" target="_blank">View Flash Media Server Source</a><br />
• <a href="http://www.unwrong.com/download/rob/blog/simpleChat1/Red5/" target="_blank">View Red5 source</a></p>
<p>• <a href="http://www.unwrong.com/download/rob/blog/simpleChat1/Flex/SimpleChat1Client.zip" target="_blank">Download Flex source</a><br />
• <a href="http://www.unwrong.com/download/rob/blog/simpleChat1/FMS/SimpleChat1FMS.zip" target="_blank">Download Flash Media Server Source</a><br />
• <a href="http://www.unwrong.com/download/rob/blog/simpleChat1/Red5/SimpleChat1.zip" target="_blank">Download Red5 source</a></p>
<p>• <a href="http://www.joachim-bauch.de/tutorials/red5/MigrationGuide.txt" target="_blank">An indispensable guide to migrating from FMS to Red5 by Joachim Bauch</a></p>
<p><strong>Includes:</strong></p>
<p>• A Flex Project that can connect to either the Red5 or FMS back end, depending which app/server you are running on localhost.<br />
• A simple FMS SharedObject demo .asc file.<br />
• The equivalent Red5 SharedObject demo Java Project.</p>
<p><strong>Tips:</strong></p>
<p>Getting errors in your Java project? Try right clicking on the Java project and going to &#8220;Properties/Java Build Path&#8221;. Remove any references to unbound libraries and click &#8220;Add External JARs&#8230;&#8221;, then navigate to red5.jar in the root of your Red5 installation.</p>
<p>Can&#8217;t select to &#8220;Debug As/Debug on Server&#8221; in your Java project? Right click on your Java project and go to &#8220;Properties/Project Facets&#8221;. Make sure to select &#8220;Dynamic Web Module&#8221; and &#8220;Java&#8221;, then apply the changes.</p>
<p> </p>
<p>The purpose of this example is to compare on a basic level the experience of developing for Red5 and FMS.<br />
The application allows users to send messages to all users who have the application open in real time.<br />
The great thing about the way Red5 is implemented is that from the Flex client&#8217;s perspective you are dealing with it in exactly the same way you would deal with FMS, so if you need to port a bunch of your existing FMS code over to Red5, you may well not need to change your Flex client code at all.</p>
<p>All the FMS and Red5 versions of the back end are doing in this example is the following:</p>
<p>• on receiving a client connection they create a non persistent server side SharedObject named &#8220;message&#8221; as a means of broadcasting messages to clients.<br />
• next they define a &#8220;sendMessage&#8221; function for the Flex client to call when the &#8220;Send&#8221; button is pressed. This function accepts a message string, which is then passed back to all connected clients via the &#8220;message&#8221; SharedObject calling the &#8220;receiveMessage&#8221; function defined in the Flex client code.</p>
<p><strong>Differences in implementation:</strong></p>
<p>In FMS the application entry point is implicitly created for you and is available as an object named &#8220;application&#8221;. As an AS3 developer coming to this it feels like stepping back in time to the fuzzy old days of AS1, pre strict typing, pre code hinting, pre clear, bug free and manageable code.<br />
In Red5 you get to explicitly declare your application entry point class in a strictly typed language. The fact that you get to declare the application, to see its dependencies and inheritance chain and have the benefit of auto code completion is very reassuring. The fact that you now have a wealth of Java libraries at your disposal is pretty cool too.<br />
In FMS you have to declare functions that can be called by clients on the client object that is received by the server side code when a user connects. I always found this a bit odd and it confused me for a while.<br />
In Red5 you can declare functions to be called by clients as methods of the application itself, or no doubt as methods of classes that are referenced by the application. Again this just feels more &#8216;proper&#8217; to me in that I&#8217;m exposing a public API for the application itself, rather than defining a list of functions that are available to a client on the server&#8217;s representation of the client object as it connects.</p>
<p><strong>Differences in user experience:</strong></p>
<p>When developing a Flex app in FMS I found myself at a loss what to do with the server side code I was creating. Ideally I wanted this to be a Flex Library, an ActionScript Project or something similar so that I could code my entire application from the same <a href="http://en.wikipedia.org/wiki/Integrated_development_environment" target="_blank">IDE</a>. The problem with that approach is that you&#8217;re trying to push a square peg into a round hole, as the notion of building the project is lost with .asc files. Instead I ended up just creating a simple folder structure for the .asc files and editing them in Flash to take advantage of the code highlighting.</p>
<p>Developing with Red5 however is light years ahead, especially with the introduction of the Red5 Eclipse Plug-in that can actually automatically create your server and client side code for you..! Red5 server side code is a Java project, so can be edited in a Java Perspective within Eclipse. This allows you to switch between the Flex and Java Perspectives within the Eclipse IDE when editing your client and server side code. You can also actually build your Java project and even run it within Eclipse by publishing a local instance of the server.</p>
<p>It seems slightly counter intuitive to me that its the free product here that&#8217;s obviously streets ahead of the quite pricey product. I&#8217;m not complaining though! Plus the free product is the one that is much more flexible in terms of where it can be installed as its built on Java rather than .Net. Ideal! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robsilverton.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robsilverton.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robsilverton.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robsilverton.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robsilverton.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robsilverton.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robsilverton.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robsilverton.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robsilverton.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robsilverton.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robsilverton.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robsilverton.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robsilverton.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robsilverton.wordpress.com/153/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=153&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://robsilverton.wordpress.com/2008/12/04/basic-sharedobject-example-in-flex-red5-flash-media-server/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/780fd0319ad01f12e5363a0471f32000?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">robsilverton</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting started with Red5 and the Eclipse Plug-in on PC</title>
		<link>http://robsilverton.wordpress.com/2008/12/03/getting-started-with-red5-and-the-eclipse-plug-in-on-pc/</link>
		<comments>http://robsilverton.wordpress.com/2008/12/03/getting-started-with-red5-and-the-eclipse-plug-in-on-pc/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 17:06:07 +0000</pubDate>
		<dc:creator>robsilverton</dc:creator>
				<category><![CDATA[Red5]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://robsilverton.wordpress.com/2008/12/03/getting-started-with-red5-and-the-eclipse-plug-in-on-pc/</guid>
		<description><![CDATA[It can be difficult to know where to start with Red5 if like me you have a reasonable level of experience with Flash/Flex/Flash Media Server, but zero experience with Java. I had a bit of a hard time trying to find relevant tutorials that worked for me as a PC user, and consequently had a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=152&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It can be difficult to know where to start with Red5 if like me you have a reasonable level of experience with Flash/Flex/Flash Media Server, but zero experience with Java.</p>
<p>I had a bit of a hard time trying to find relevant tutorials that worked for me as a PC user, and consequently had a lot of difficulty getting to my first Hello World Red5 app.</p>
<p>The following post then details what I&#8217;d wished I&#8217;d known when I started:</p>
<p>&nbsp;</p>
<p><strong>Resources:</strong></p>
<p>The definitive resource for everything Red5 (as defined by the Red5 team) is <a href="http://wiki.red5.org/">http://wiki.red5.org/</a></p>
<p>&nbsp;</p>
<p><strong>Installing the Red5 Server:</strong></p>
<p>Download the Tarball of Red5 Server 0.8 Release Candidate 1 <a href="http://jira.red5.org/confluence/display/downloads/Red5+v0.8.0+Release+Candidate+1+09.29.2008" target="_blank">from here</a>.</p>
<p>The reason for downloading the Tarball version rather than the Windows Installer version is that the latter has been known to have issues and may not work for you.</p>
<p>Un-tar (extract) the Red5 files and folders. The root folder will be called &#8220;dist&#8221;. Rename it &#8220;Red5&#8243; and move it to &#8220;C:\Program Files\&#8221;.</p>
<p>Within the Red5 folder there is a file named &#8220;Red5.bat&#8221;. Double clicking this file will start the Red5 server running in a DOS Prompt window. Closing this window will stop the server running.</p>
<p>While the server is running, go to <a title="http://localhost:5080/" href="http://localhost:5080/">http://localhost:5080/</a>. If you can see the Red5 page you know your server is running. Have a click around and play with the various demos.</p>
<p><strong></strong>&nbsp;</p>
<p><strong>Installing the Eclipse IDE for Java Developers:</strong></p>
<p>Download and install the Eclipse IDE for Java EE Developers. You can find it <a href="http://www.eclipse.org/downloads/" target="_blank">here</a>. You will need this to create and deploy your Red5 apps.</p>
<p>&nbsp;</p>
<p><strong>Installing the FlexBuilder Eclipse Plug-in:</strong></p>
<p>If you haven&#8217;t done so already you may want to switch over to the Eclipse Plug-in version of FlexBuilder for the most seamless development experience when creating Red5 apps. You can find that <a href="https://www.adobe.com/cfusion/tdrc/index.cfm?product=flex%5Feclipse&amp;loc=en%5Fus" target="_blank">here</a>.</p>
<p>&nbsp;</p>
<p><strong>Installing the Red5 Eclipse Plug-in:</strong></p>
<p>Download the plug-in <a href="http://jira.red5.org/confluence/display/tools/Installation" target="_blank">from here</a> and follow the installation instructions. If you&#8217;re using the Ganymede version of Eclipse or the installation instructions are confusing for any other reason, the &#8220;Installing Red5 Eclipse Plug-in&#8221; section of <a href="http://robsilverton.wordpress.com/2008/10/13/getting-up-and-nearly-running-with-the-red5-eclipse-plug-in/" target="_blank">this post</a> may help you. Make sure to download the version that targets v0.8 of the server.</p>
<p>&nbsp;</p>
<p><strong>Creating your first Red5 Project:</strong></p>
<p>I recommend watching <a href="http://flashalisious.com/2008/09/30/red5-and-flex-basics-part-1-keep-track-of-users/" target="_blank">this video</a> for instructions on how to create your first Red5 project, though you may want to skip the first 5 mins as its basically an introduction bringing you to the stage you should have already reached by this point, and I wouldn&#8217;t worry about changing the default code in the first instance, just see if you can get it running &#8220;as is&#8221; to begin with. Again I found that the experience using Ganymede is slightly different to the experience outlined in the video, so the &#8220;Creating a Red5 Web Project in Eclipse&#8221; section of <a href="http://robsilverton.wordpress.com/2008/10/13/getting-up-and-nearly-running-with-the-red5-eclipse-plug-in/" target="_blank">this post</a> should help you to fill in the blanks.</p>
<p>&nbsp;</p>
<p><strong>Deploying your first Red5 Project locally:</strong></p>
<p>If you skip 26 minutes into the <a href="http://flashalisious.com/2008/09/30/red5-and-flex-basics-part-1-keep-track-of-users/" target="_blank">example video</a> you&#8217;ll see how to setup and run your server. Make sure to set your Runtime Directory for the server to &#8220;C:\Program Files\Red5&#8243;. The same goes for the next paths in the setup, see the &#8220;Running your server-side app in Eclipse&#8221; section of <a href="http://robsilverton.wordpress.com/2008/10/13/getting-up-and-nearly-running-with-the-red5-eclipse-plug-in/" target="_blank">this post</a> for details.</p>
<p>The main problem that you will more than likely run into is that you can&#8217;t get the server to actually run within Eclipse. This doesn&#8217;t really matter though as you can still run the server from the &#8220;Red5.bat&#8221; file as explained above. The important thing is that in creating this instance of the Red5 server within Eclipse you&#8217;ve created a means of easily deploying your app to your Red5 installation. The first stage in attempting to run the server should have successfully copied your app over to &#8220;C:\Program Files\Red5\webapps\&#8221;, which is a pretty neat feature. </p>
<p>In future if you want to redeploy your app, while in the Java EE Perspective in Eclipse go to &#8220;Window/Show View/Servers&#8221;, where you should see your instance of the Red5 server. Right click on the server and select &#8220;Clean&#8230;&#8221;, this should redeploy your app(s) to the server installation for you.</p>
<p>&nbsp;</p>
<p><strong>Running your first Red5 Project locally:</strong></p>
<p>Now that your Red5 app is deployed, run the Red5 server by double clicking the &#8220;Red5.bat&#8221; file as explained above. When testing changes to your app after redeploying it, always remember to stop and restart the Red5 server by closing and reopening the Red5 DOS Prompt window.</p>
<p>&nbsp;</p>
<p><strong>Testing your Red5 app:</strong></p>
<p>Now that the server is up and running with your app successfully deployed, your next step is to try and connect to it from your Flex client. Go back to your auto generated Flex project within the Flex Development perspective in Eclipse, right click on the Flex project root and select &#8220;Debug As/Flex Application&#8221;. This should open your Flex app in a browser window and (all being well) successfully connect to your Red5 app.</p>
<p>&nbsp;</p>
<p>So hopefully by now you&#8217;ve created your first Hello World app in Red5. It wasn&#8217;t entirely straightforward and it didn&#8217;t work 100% as you&#8217;d expect, but overall it was pretty damn good for a Beta, and the development experience was light years ahead of Flash Media Server. </p>
<p>Please leave me a comment if you&#8217;ve read this and it helped you, I&#8217;d be happy to hear if you get up and running quickly. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robsilverton.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robsilverton.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robsilverton.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robsilverton.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robsilverton.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robsilverton.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robsilverton.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robsilverton.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robsilverton.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robsilverton.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robsilverton.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robsilverton.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robsilverton.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robsilverton.wordpress.com/152/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=152&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://robsilverton.wordpress.com/2008/12/03/getting-started-with-red5-and-the-eclipse-plug-in-on-pc/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/780fd0319ad01f12e5363a0471f32000?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">robsilverton</media:title>
		</media:content>
	</item>
		<item>
		<title>Red5 v0.8, Red5 Plugin v0.2. IT WORKS!!!! :D :D :D</title>
		<link>http://robsilverton.wordpress.com/2008/12/02/red5-v08-red5-plugin-v02-it-works-d-d-d/</link>
		<comments>http://robsilverton.wordpress.com/2008/12/02/red5-v08-red5-plugin-v02-it-works-d-d-d/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 18:10:16 +0000</pubDate>
		<dc:creator>robsilverton</dc:creator>
				<category><![CDATA[Red5]]></category>

		<guid isPermaLink="false">http://robsilverton.wordpress.com/2008/12/02/red5-v08-red5-plugin-v02-it-works-d-d-d/</guid>
		<description><![CDATA[I&#8217;m very pleased to report I&#8217;ve just had my first positive experience developing with Red5! It seems like a lot of my problems could have been caused by the fact that the Red5 Plugin simply doesn&#8217;t work with version 0.7 of the server. I&#8217;ve been advised by the main man himself to download and install [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=147&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m very pleased to report I&#8217;ve just had my first positive experience developing with Red5! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>It seems like a lot of my problems could have been caused by the fact that the Red5 Plugin simply doesn&#8217;t work with version 0.7 of the server.</p>
<p>I&#8217;ve been advised by <a href="http://blog.ff9900.org/" target="_blank">the main man himself</a> to download and install version 0.8 RC1 of Red5 and try again, but unfortunately I initially tried to install this version and it failed. So instead I was advised to downloaded the <a href="http://jira.red5.org/confluence/display/downloads/Red5+v0.8.0+Release+Candidate+1+09.29.2008" target="_blank">Tarball version</a>, un-tar it, create a Red5 directory in Program Files and copy the contents over. I assume that because I haven&#8217;t gone through the install procedure it makes sense that Red5 doesn&#8217;t show up in Add/Remove Programs or in Services anymore.</p>
<p>So the next step was to try and recreate the server within Eclipse and publish it. On doing so I was confronted with this QuickTime related error:</p>
<p><pre class="brush: java;">
Starting Red5 (org.red5.server.Shutdown)

java.lang.NoClassDefFoundError: Files\Java\jre1/6/0_07\lib\ext\QTJava/zip

Caused by: java.lang.ClassNotFoundException: Files\Java\jre1.6.0_07\lib\ext\QTJava.zip

at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)

at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

Exception in thread &quot;main&quot;
</pre></p>
<p>I was actually quite pleased to see this error as I hadn&#8217;t seen it before and felt like I might be making progress. After a quick Google I found <a href="http://osflash.org/pipermail/red5_osflash.org/2008-July/023575.html" target="_blank">this thread</a> on the Red5 mailing list by a user with a similar problem. As with the <code>JAVA_HOME</code> issue, this was again to do with <a href="http://en.wikipedia.org/wiki/Environment_variable" target="_blank">Environment Variables</a>. I checked my <code>CLASSPATH</code> var as instructed in the <a href="http://osflash.org/pipermail/red5_osflash.org/2008-July/023577.html" target="_blank">response</a> to the thread (right-click My Computer/Properties/Advanced/Environment Variables), and bizarrely it was set to:</p>
<p><pre class="brush: java;">.;C:\Program Files\Java\jre1.6.0_07\lib\ext\QTJava.zip</pre></p>
<p>The first thing I noticed was that for some reason this string starts with the characters &#8220;.;&#8221;, which really didn&#8217;t look right, so I deleted those characters, logged off and back on to reset my environment vars and tried again. No joy. Next I tried adding quotation marks to the string as suggested and the error went away.</p>
<p>BUT&#8230; then I was confronted with another error&#8230;</p>
<p><pre class="brush: java;">
Starting Red5 (org.red5.server.Shutdown)

Attempting to connect to RMI port: 9999

java.io.IOException: Failed to retrieve RMIServer stub:</pre><br />
&#8230;</p>
<p>So I Googled the first few lines of the error again, only to be confronted with 5 results, two of which were <a href="http://robsilverton.wordpress.com/2008/11/19/red5-the-next-issue-after-the-java_home-issue/" target="_blank">my own blog</a>. So it appears I&#8217;m back to the point I&#8217;d reached before when I gave up on publishing the server from Eclipse or creating the application code automatically with the plugin, and started playing with simple examples that had been <a href="http://flashalisious.com/2008/09/30/red5-and-flex-basics-part-1-keep-track-of-users/" target="_blank">published on a mac</a>. As you can imagine I was quite disappointed by this point. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>Wondering what to do next, I thought I&#8217;d just try running the server by double clicking the red5.bat in Program Files/Red5. This opened a DOS prompt and started the server successfully as you would expect. I then thought I&#8217;d just try connecting my previous Mac published example to the server to see if it works. It worked. Ok&#8230; so the next problem I was having was the <a href="http://robsilverton.wordpress.com/2008/11/27/red5-finding-it-impossible-to-develop-for-on-pc/" target="_blank">weird caching behaviour</a>. So I stopped the server by closing the DOS prompt, changed a little bit of the Java code in the tutorial, published the files by cleaning the server within Eclipse (as mentioned before this is a good way to auto deploy to the server even if you can&#8217;t get the server running in eclipse), restarted the server from the red5.bat file and ran the Flex client code within Eclipse. The changes had taken effect..! I tried it 3 or 4 more times just to make sure and it continued to work! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>My next question then was if that&#8217;s started to work.. maybe the server and client side code generated by the Red5 Eclipse Plugin would now work too..? So I created a new Red5 project with auto generated code, and went through the same deployment method as above. IT WORKED..! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Still skeptical, I tried changing and republishing the code several times just to see if the changes would take effect. IT STILL WORKED!!! I NOW HAVE A WORKING HELLO WORLD EXAMPLE!!!</p>
<p>Its been a bit of a battle, but I&#8217;m now elated to report I&#8217;ve reached the point where I can actually start writing Red5 applications! I also have to say that I feel fairly smug about the fact that the problems I was having weren&#8217;t down to simple errors of my own making (unless you consider my not knowing that v0.2 of the plug-in targets Red5 server v0.8 an error of my own making, but I don&#8217;t remember seeing any mention of that via <a href="http://www.newviewnetworks.com/nvnhome/blog/client/?p=31" target="_blank">the path I took</a> to the plugin). I notice the new <a href="http://jira.red5.org/confluence/display/tools/Installation" target="_blank">home of the plugin</a> does clearly offer two versions though for 0.8 or 0.7 or below, which is cool.</p>
<p>The plugin still doesn&#8217;t work exactly as it&#8217;s supposed to (i.e. I can&#8217;t actually publish the server), so if anyone has any suggestions on how to get it fully functional I&#8217;d be very happy to hear them. In the meantime though I can now start creating my own Red5 apps! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Big thanks to the lovely guys at Red5 for their continued support which has brought me to this point. Although I&#8217;ve never had such a battle getting something working, I&#8217;ve also never had such generous offers of support from such senior members of a team. By way of recompense my next post will be a condensed guide for Java novice PC users hoping to setup Red5 to steer them through all of the pitfalls I fell into. After that I&#8217;ll start recreating my simple FMS examples with Red5 equivalent code. Can&#8217;t wait! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robsilverton.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robsilverton.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robsilverton.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robsilverton.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robsilverton.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robsilverton.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robsilverton.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robsilverton.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robsilverton.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robsilverton.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robsilverton.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robsilverton.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robsilverton.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robsilverton.wordpress.com/147/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=147&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://robsilverton.wordpress.com/2008/12/02/red5-v08-red5-plugin-v02-it-works-d-d-d/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/780fd0319ad01f12e5363a0471f32000?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">robsilverton</media:title>
		</media:content>
	</item>
		<item>
		<title>Red5: finding it impossible to develop for on PC.</title>
		<link>http://robsilverton.wordpress.com/2008/11/27/red5-finding-it-impossible-to-develop-for-on-pc/</link>
		<comments>http://robsilverton.wordpress.com/2008/11/27/red5-finding-it-impossible-to-develop-for-on-pc/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 17:51:50 +0000</pubDate>
		<dc:creator>robsilverton</dc:creator>
				<category><![CDATA[Red5]]></category>

		<guid isPermaLink="false">http://robsilverton.wordpress.com/2008/11/27/red5-finding-it-impossible-to-develop-for-on-pc/</guid>
		<description><![CDATA[After deciding that the Red5 Eclipse Plug-in was the source of most of my Red5 related woes, I&#8217;ve just spent a whole day trying to deploy a Red5 app without it. Because the project code generated by the Plug-in doesn&#8217;t work when deployed on my PC, I&#8217;ve had to adapt the source of a simple [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=144&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After deciding that the Red5 Eclipse Plug-in was the source of most of my Red5 related woes, I&#8217;ve just spent a whole day trying to deploy a Red5 app without it.</p>
<p>Because the project code generated by the Plug-in doesn&#8217;t work when deployed on my PC, I&#8217;ve had to adapt the source of a <a href="http://flashalisious.com/2008/09/30/red5-and-flex-basics-part-1-keep-track-of-users/" target="_blank">simple example</a> that was written on a Mac.</p>
<p>However if I deploy that app by hand (i.e. copying and pasting the folder containing the META-INF &amp; WEB-INF folders into my Red5 webapps directory and renaming it Red5Tut) it doesn&#8217;t work, even after stopping and restarting the Red5 service several times.</p>
<p>But&#8230; if I deploy the app automatically from within Eclipse by cleaning the Red5 Server instance I created (as mentioned before I can&#8217;t actually run the server from within Eclipse, so cleaning it is as far as I go) then start the Red5 process externally in Services, the app actually works!</p>
<p>Once the app is up and running though, the next problem is trying to update it. Even if I manually stop the Red5 service, delete the app folder from webapps, clean the server in Eclipse (automatically redeploying the app to webapps on the server), it still exhibits same behaviour as if its just cached the last version somewhere. How could this be? Is Eclipse caching the project somehow? I tried rebuilding/resaving it multiple times&#8230;</p>
<p>Short of buying a Mac I&#8217;m pretty stumped as to how I&#8217;m actually supposed to develop using this software. I&#8217;m starting to think that FMS is well worth the license fee and that the comparatively toy town server side language is a small price to pay when you consider we managed to get the system up, running and tested in a matter of hours&#8230; I&#8217;ve had more problems with this software than any other I can recall, which is a shame as all I initially wanted it for was a free version of something I already knew how to use. I know its all in Beta, but I wasn&#8217;t prepared for the level of testing I&#8217;ve obviously signed up for.</p>
<p>Question 1: Why does it make a difference if I deploy the app using the Eclipse Plug-in instead of doing it manually?</p>
<p>Question 2: Does anyone know how to fix or at least get around this weird caching problem I&#8217;m having when trying to update app?</p>
<p>If anyone has any answers or ideas I&#8217;d be really grateful. I&#8217;m gearing up to work on a multi player game project and at the moment (as much as I&#8217;d like to be able to) it looks like I can&#8217;t use Red5.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/robsilverton.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/robsilverton.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/robsilverton.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/robsilverton.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/robsilverton.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/robsilverton.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/robsilverton.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/robsilverton.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/robsilverton.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/robsilverton.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/robsilverton.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/robsilverton.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/robsilverton.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/robsilverton.wordpress.com/144/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=robsilverton.wordpress.com&amp;blog=4412069&amp;post=144&amp;subd=robsilverton&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://robsilverton.wordpress.com/2008/11/27/red5-finding-it-impossible-to-develop-for-on-pc/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/780fd0319ad01f12e5363a0471f32000?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">robsilverton</media:title>
		</media:content>
	</item>
	</channel>
</rss>
