<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>publicreative lab</title>
	<atom:link href="http://lab.publicreative.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://lab.publicreative.com</link>
	<description></description>
	<lastBuildDate>Tue, 27 Jul 2010 15:59:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Node AMF</title>
		<link>http://lab.publicreative.com/2010/07/node-amf/</link>
		<comments>http://lab.publicreative.com/2010/07/node-amf/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 17:48:32 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[amf]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://lab.publicreative.com/?p=210</guid>
		<description><![CDATA[We&#8217;ve been having some fun with NodeJS at Public recently, and I&#8217;ve been looking for excuses to get more involved with it. We do a lot of Flash work, and make a lot of games, so Flash remoting is something we do regularly. We prefer to use AMF over XML, so I looked around for [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been having some fun with <a href="http://nodejs.org/" target="_blank">NodeJS</a> at Public recently, and I&#8217;ve been looking for excuses to get more involved with it. We do a lot of Flash work, and make a lot of games, so Flash remoting is something we do regularly. We prefer to use <a href="http://en.wikipedia.org/wiki/Action_Message_Format" target="_blank">AMF</a> over XML, so I looked around for a NodeJS module to see if we could work with AMF within Node. I figured Node might be a viable platform for creating simple multi-player back ends, or other real-time environments like chat rooms.</p>
<p>I failed to find an AMF library for Node, and I&#8217;m not hugely surprised; Flash is rather out of favour with today&#8217;s JavaScript gurus. Secretly pleased that I couldn&#8217;t find anything, I set about writing my own. It is also the first time I&#8217;ve put an open source project on Github.</p>
<p><a href="http://github.com/timwhitlock/node-amf/" target="_blank">See <strong>node-amf </strong>on Github</a><span id="more-210"></span></p>
<p>The current state of node-amf is that it&#8217;s <strong>not ready for production</strong>. I am experiencing errors in the pack and unpack functions which are taken from the excellent <a href="http://phpjs.org/" target="_blank">php.js</a> project. I hope to hear from the authors to rectify this.</p>
<p>[<strong>UPDATE</strong>] Now using <a href="http://jsfromhell.com/classes/binary-parser" target="_blank">this BinaryParser class</a> instead of the pack/unpack functions.</p>
<p>The examples in the Git repository are for a simple HTTP gateway &#8211; This is the standard way you&#8217;d use AMF to talk to PHP, for example. The next step is to see if it&#8217;s possible to work with persistent sockets carrying AMF packets. That could be pretty cool.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.publicreative.com/2010/07/node-amf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open Graph Drupal Module</title>
		<link>http://lab.publicreative.com/2010/06/open-graph-drupal-module/</link>
		<comments>http://lab.publicreative.com/2010/06/open-graph-drupal-module/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 12:27:49 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[open graph]]></category>

		<guid isPermaLink="false">http://lab.publicreative.com/?p=194</guid>
		<description><![CDATA[I needed to enable Open Graph functionality on a Drupal 6 site this week and the Drupal module directory didn&#8217;t seem to have the goods. Googling didn&#8217;t show up much either; there is a module for Drupal 7, but I&#8217;m stuck in Drupal 6 for now. So here we are, the first version of a [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to enable <a href="http://opengraphprotocol.org/" target="_blank">Open Graph</a> functionality on a <a href="http://drupal.org/" target="_blank">Drupal 6</a> site this week and the Drupal module directory didn&#8217;t seem to have the goods. <a href="http://www.google.com/search?q=drupal+open+graph+module" target="_blank">Googling</a> didn&#8217;t show up much either; there is a <a href="http://github.com/scor/opengraphprotocol" target="_blank">module for Drupal 7</a>, but I&#8217;m stuck in Drupal 6 for now. So here we are, the first version of a Drupal 6 &#8220;opengraph&#8221; module. It&#8217;s not yet in use on any live sites, so please let me know how you get on if you try it out.</p>
<p>Download version 0.2 for Drupal 6:  <strong><a rel="attachment wp-att-207" href="http://lab.publicreative.com/2010/06/open-graph-drupal-module/opengraph-6-x-0-2/">opengraph-6.x-0.2</a></strong></p>
<p><span id="more-194"></span></p>
<h3>What?</h3>
<p>If you don&#8217;t know what the Open Graph is, a crude way of explaining it could be &#8220;Facebook&#8217;s take on the semantic web&#8221;. Marking up your web pages with specific meta tags allows Facebook to extract meaning as to what the pages represent. i.e what they mean in terms of real-life entities; for example a <em>movie,</em> or a <em>landmark</em> or a <em>politician. </em>This means when a visitor to your site <em>likes</em> something (via the ubiquitous <a href="http://developers.facebook.com/docs/reference/plugins/like" target="_blank">like button</a>)<em> </em>contextual data including a neat thumbnail image is made available to the Facebook page that gets created by the action. It also allows you to claim the Facebook page by adding your Facebook user IDs to the markup.</p>
<p>For more information on the Open Graph Protocol, see <a href="http://opengraphprotocol.org/" target="_blank">opengraphprotocol.org</a></p>
<h3>The module</h3>
<p>See the README file for full information, but in short:</p>
<ol>
<li><a href="http://lab.publicreative.com/wp-content/uploads/2010/06/opengraph-6.x-0.1.tgz">Install</a> and enable it (it&#8217;s grouped into the &#8216;Facebook&#8217; section)</li>
<li>Go to the settings page at <em>admin/content/opengraph </em>
<ul>
<li>Configure site defaults</li>
<li>Map node content types to Open Graph object types</li>
</ul>
</li>
<li>On the edit screen for any type-enabled nodes you can override the default meta data</li>
<li>Add the basic like button block to test it out, or just add your own <a href="http://developers.facebook.com/plugins" target="_blank">social plugins</a></li>
</ol>
<p><em>Note</em>: I would like to contribute this to the Drupal module  directory, but this is a very early version and I don&#8217;t currently have  CVS access. Lets see if you like it first.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.publicreative.com/2010/06/open-graph-drupal-module/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Unity3D Ball and Chain &#8211; Part 1</title>
		<link>http://lab.publicreative.com/2009/10/unity3d-ball-and-chain-part-1/</link>
		<comments>http://lab.publicreative.com/2009/10/unity3d-ball-and-chain-part-1/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 12:43:11 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Physics]]></category>
		<category><![CDATA[Unity3d]]></category>

		<guid isPermaLink="false">http://lab.publicreative.com/?p=176</guid>
		<description><![CDATA[Making the transition from Flash and ActionScript to Unity and its JavaScript/C# has been very smooth, thanks to their detailed scripting reference and very active forums. Being one of those people when faced with flat-pack to assemble, grabs a hammer and gets stuck-in, there have been plenty of sticking points which have had me reaching [...]]]></description>
			<content:encoded><![CDATA[<p>Making the transition from Flash and ActionScript to Unity and its JavaScript/C# has been very smooth, thanks to their detailed scripting reference and very active forums. Being one of those people when faced with flat-pack to assemble, grabs a hammer and gets stuck-in, there have been plenty of sticking points which have had me reaching for the instructions.</p>
<p>This is a tech demo of Unity that was created over the weekend to overcome some of the challenges that might arise when working on commercial Unity work. Initially it was created as a one off, but after finding and solving quite a few problems, I thought it might be nice to share my solutions to some of these problems as I develop the project in my spare time.</p>
<p>Controls: Up &#038; Down (or W &#038; S) to raise or lower the spinner, scroller adjusts spinning speed, and Space Bar to release the ball.</p>
<p><em>Please view the full post to see the Unity content.</em></p>
<p><span id="more-176"></span></p>
<p><strong>Moving skyboxes = multiple cameras.</strong></p>
<p>One of the fastest things to set up is a simple skybox. It creates a visually pleasing backdrop and can add a lot to a game. After looking at a static skybox for a long time, it can get a bit “samey”. A quick look on the official forums and people were suggesting using multiple camera and setting up combinations of Clear Flags and Culling Masks. That’s all pretty easy to sort out, add another camera, I chose to make it a child of my main camera, and set its Clear Flags to “Skybox” and Culling mask to “Nothing”. Setting the main camera Clear Flags to “DepthOnly” and its Culling Mask to “Everything” gave me the correct result in each camera, just the skybox through the child and everything else with a blank area for the Skybox to sit. The problem was the child rendering the skybox on top of everything, the solution?</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;">skyCamera.camera.depth = <span style="color: #000000; font-weight:bold;">1</span>;
mainCamera.camera.depth = <span style="color: #000000; font-weight:bold;">2</span>;</pre></div></div>

<p>Setting the camera depth property programmatically solved the issue. So now the skybox is rendered through a different camera, it’s free to rotate slowly and give you a dynamic backdrop.</p>
<p><strong>Scripted Joints.</strong></p>
<p>An annoying problem with a very simple solution! I wanted the chain to be made out of a varying number of links, so I could create short and long ones out of the same code. Another self-imposed requirement was making something useable out of the physics components. So, dynamic joints and rigidbodies were the order of the day. After messing about with the properties of configurable joints, I couldn’t understand why none of them had any discernable affect on my rigidbodies. One of those classic palm-to-forehead moments ensued when I realised you need to set the connected rigidbody AFTER setting all the variables!</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #009900;">//Set all variables, then:</span>
cJoint.connectedBody = myChild.<span style="color: #004993;">transform</span>.rigidbody;</pre></div></div>

<p>These were two of the “little things” that caused me frustration, if my solutions solved either of the problems for you, I hope you found this post sooner rather than later!</p>
<p>Check back for more problem based solutions as I develop the project further. If there’s any interest, I’ll post the project source code after each project step. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.publicreative.com/2009/10/unity3d-ball-and-chain-part-1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Let&#8217;s talk about the iPhone</title>
		<link>http://lab.publicreative.com/2009/10/lets-talk-about-the-iphone/</link>
		<comments>http://lab.publicreative.com/2009/10/lets-talk-about-the-iphone/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 10:37:38 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://lab.publicreative.com/?p=171</guid>
		<description><![CDATA[I had a very interesting day at Over The Air 09 in London a month ago &#8211; both the keynotes, sessions, and attendees were heavily geared towards turning web developers into mobile developers. Widgets got bounced around a lot. At the opening of the conference, an informal poll revealed that out of the 200 or [...]]]></description>
			<content:encoded><![CDATA[<p>I had a very interesting day at <a href="http://overtheair.org">Over The Air 09</a> in London a month ago &#8211; both the keynotes, sessions, and attendees were heavily geared towards turning web developers into mobile developers. Widgets got bounced around a lot. At the opening of the conference, an informal poll revealed that out of the 200 or so attendees present maybe only a dozen were &#8216;native&#8217; (ie, Obj-C, .net, etc) software engineers. The keynote speakers genuinely all seemed to believe that native apps were on the way out, to be replaced by cross platform widgets.<span id="more-171"></span></p>
<p>To be honest, it all seemed terribly false. The Vodafone keynote was delivered by Rick Fant, &#8216;Head of Internet Discovery&#8217; (which apparently means being in charge of the &#8216;development and deployment of consumer and developer services associated with internet enabled applications). I heard a lot about Vodafone&#8217;s vision of a &#8216;unified app store&#8217;, and their &#8216;Vodafone 360&#8242; effort. It&#8217;s unfortunate then, that in less than a week after telling the conference attendees Vodafone was committed to a single, carrier based App Store they decided to start carrying the iPhone in the UK. Which won&#8217;t be part of their unified app service. And yet will probably be their biggest selling smartphone.</p>
<p>In fact, throughout the conference the iPhone was a big, hulking presence that nobody wanted to really talk about. &#8220;There are other devices out there&#8221;, was the mantra, &#8220;&#8230;the iPhone isn&#8217;t everything&#8221;. This is true &#8211; but shortsighted. It&#8217;s not about the hardware. It&#8217;s about the <em>software. </em>Consider this &#8211; the iPhone may only have a fraction of the overall cell phone market share, but the iPod <em>dominates</em> all competing portable media players. 40% of all iPhone OS devices are iPod based.</p>
<p>There&#8217;s a huge market for iPhone OS based software outside of the cellular arena&#8230;a market that mobile networks can&#8217;t penetrate. No other mobile OS can hope to achieve this &#8211; Android may be readily available for non-mobile devices, but no Android media player can hope to make significant inroads against the iPod&#8217;s Walkman-like position as the de-facto playback device. Furthermore, iPhone and iPod users are used to certain UI paradigms and conventions. Developers who attempt to code for multiple devices and platforms using &#8216;widgets&#8217; won&#8217;t break into iPhone territory, because their apps simply won&#8217;t take advantage of what users expect and demand from their apps.</p>
<p>We can ignore the iPhone at conferences like OTA, and we can pretend that carrier-operated &#8216;global app stores&#8217; and widgets are the future of mobile development&#8230;but in the end, Apple&#8217;s still left getting revenue from their devices, revenue from app sales, <em>and</em> in many cases a cut of customer&#8217;s monthly contract fees. The mobile market is at a similar point to the early PC market &#8211; many, fragmented, and competing platforms and devices. We can try to code for all of them, but it seems certain that at some point devices one platform is going to break forward and become the de-facto standard of choice.</p>
<p>Put it this way &#8211; the iPod was introduced in 2001. Many people thought it a useless device that would sell very little.  It took three, maybe four years until it really started to make a major impact with the Mini and new generation iPod models. We&#8217;re only two years into the iPhone OS platform, and already it rivals Blackberry in terms of users. Pushing widgets as the technology of the future for mobile development is surely unwise when we consider the future potential for the iPhone platform.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.publicreative.com/2009/10/lets-talk-about-the-iphone/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Blank Canvas</title>
		<link>http://lab.publicreative.com/2009/10/blank-canvas/</link>
		<comments>http://lab.publicreative.com/2009/10/blank-canvas/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 11:57:13 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://lab.publicreative.com/?p=156</guid>
		<description><![CDATA[Reminiscing.
This is a post about the new HTML5 canvas element. If you could indulge me while I reminisce when I was a student completing a Diploma in Digital Media for a moment. Our first ever Actionscript based project was to create an interactive application that an artist of the past, who did not live in [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Reminiscing</strong>.</p>
<p>This is a post about the new HTML5 canvas element. If you could indulge me while I reminisce when I was a student completing a Diploma in Digital Media for a moment. Our first ever Actionscript based project was to create an interactive application that an artist of the past, who did not live in the digital age, would have made if they did live in these times and had Flash as a tool. I choose <a href="http://en.wikipedia.org/wiki/Len_Lye">Len Lye</a>, an experimental New Zealand artist that is famous for his kinetic sculptures and experimental film techniques.</p>
<p>I remember the joy, writing AS2 using Flash 7, of being able to freely create and experiment with code and interaction without any concern for technical detail or expectation other than it worked, ran at an OK frame rate and looked cool.</p>
<p>Those carefree days quickly disappeared as I left the comfort of my Diploma and entered the real world. Since then it’s been a non-stop learning curve keeping up with technology, expectations and tight deadlines.</p>
<p><em>If you would like to cut to the chase and have a play with my canvas experement click on the image below, or click on the keep reading link.</em><br />
<a href="http://lab.publicreative.com/impressionist/"><img src="http://lab.publicreative.com/uploads/canvas/screenshot2.jpg" alt="impressionist screenshot" /></a></p>
<p><a href="http://www.chromeexperiments.com/detail/impressionist/"><img src="http://www.chromeexperiments.com/img/badge-white_white.png" alt="See my Experiment on ChromeExperiments.com" /></a></p>
<p><span id="more-156"></span></p>
<p><strong>Recently</strong></p>
<p>Which brings us to today, when one of the most exciting developments on the web of late in my opinion, has been the evolution of JavaScript from a tool for form validation to a fully blown interactive scripting language for the web. This is helped in no small part by the continuing evolution of great JavaScript libraries like jQuery, MooTools, Prototype and many more and the amazing speed at which modern browsers execute JavaScript enabling fully blown interactive web apps built with not a line of Actionscript in sight.</p>
<p>Even more exciting is the speed at which modern browsers open source browsers are integrating HTML5 specifications bringing us many exciting tools. Like application cache that give the ability to run web apps when not connected to the web. Web workers that enable coders to separate out heavy lifting code to a separate thread on the user’s computer so as not to interfere with the user experience. Geolocation that, with the users permission, use a devices GPS to let the web app know where a user is and many more exciting <a href="http://www.smashingmagazine.com/2009/07/16/html5-and-the-future-of-the-web/">propositions</a>. </p>
<p><strong>Satisfaction</strong></p>
<p>However the new HTML5 feature that I’ve been paying with most is the new canvas element that enables you to draw in the browser with code, literally like a canvas. Much like Actionscript’s drawing API lets you draw to the stage.</p>
<p>Why I love this feature and playing with its possibilities so much is that it reminds me of those days I described above when I first discovered the creative potential of Actionscript and Flash. Obviously canvas doesn’t have anywhere near the feature set that AS3 does today, but this in itself is the attraction to me. Limited but useful features breeds creativity as developers push what’s possible to produce some pretty neat eye candy. It’s that feeling of playing with something new, where there are no conventions, expectations or standards just yet. Take a look at <a href="http://www.chromeexperements.com/">chromeexperements</a> to see some great examples of what people have come up with using canvas &amp; svg.</p>
<p>Obviously the canvas elements role on the web will evolve from something new to play with to something very useful. For example, nice font replacement with tools such as <a href="http://wiki.github.com/sorccu/cufon/about">cufon</a>. However its widespread adoption may be held up by Microsoft’s reluctance to implement in Internet Explorer, no doubt to protect the future of their multimedia plugin Silverlight. Microsoft&#8217;s VML in IE browsers can be hacked to offer similar features to canvas and projects like explorercanvas <a href="http://code.google.com/p/explorercanvas/">http://code.google.com/p/explorercanvas/</a> should help to exploit this.</p>
<p><strong>My Experiment.</strong></p>
<p>Anyhow, my experiment with canvas didn’t start out as an idea or concept, rather it evolved from playing around and seeing where it ended up. It’s nothing revolutionary or amazing, but was fun to build and play with and demonstrates just some of the potential of the canvas element.</p>
<p>You can upload an image, or choose an existing one. This source image is used to determine the colours that are painted on the canvas element as you draw. Or you can let the application paint for you by pushing the start button. Have a play with the parameters and then you can save the canvas you’ve created to your computer using the toDataURL method. Click <a href="http://lab.publicreative.com/impressionist/">here</a> to launch the application. View source if you want to check out what&#8217;s going on.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.publicreative.com/2009/10/blank-canvas/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Selling SEO</title>
		<link>http://lab.publicreative.com/2009/10/selling-seo/</link>
		<comments>http://lab.publicreative.com/2009/10/selling-seo/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 13:38:03 +0000</pubDate>
		<dc:creator>Gary</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://lab.publicreative.com/?p=148</guid>
		<description><![CDATA[I have been catching up on some SEO articles in the past few weeks and I have really started to detest the whole marketing and sales of SEO. SEO is not something that should be forced, but should be natural, if a site is well built with clear naming conventions then it should be easy [...]]]></description>
			<content:encoded><![CDATA[<p>I have been catching up on some SEO articles in the past few weeks and I have really started to detest the whole marketing and sales of SEO. SEO is not something that should be forced, but should be natural, if a site is well built with clear naming conventions then it should be easy for the user to navigate as it should be for a spider to crawl. If a site is usable and accessible to a human then it is only natural that a robot will have a similar experience with your site.</p>
<p>It takes far more skill and knowledge to build good, useable websites than it does to make sure that keywords/links are forced into places where they are not comfortable.</p>
<p>Forcing SEO can also be a distraction for a designer, when SEO is sold it can result in the designer being forced to add elements to a page that that suddenly become out of context, this could result in an unhappy designer who’s time could be better spent making the site user friendly.</p>
<p>There is also an argument to suggest that fully optimising a site for search can affect the user’s experience due to additional content that could possibly deemed as confusing to the user, and also taking up space on the page that would have been better holding a more functional feature such as a search box itself.</p>
<p>For me it is simple, if you want to pay for SEO then pay for sponsored links, otherwise spend extra money on a well thought out site, built and designed by a team who build and design sites properly.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.publicreative.com/2009/10/selling-seo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FP10 drawTriangles demo</title>
		<link>http://lab.publicreative.com/2009/07/fp10-drawtriangles-demo/</link>
		<comments>http://lab.publicreative.com/2009/07/fp10-drawtriangles-demo/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 17:30:58 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[experements]]></category>
		<category><![CDATA[FP10]]></category>

		<guid isPermaLink="false">http://lab.publicreative.com/?p=130</guid>
		<description><![CDATA[<script type="text/javascript" src="http://lab.publicreative.com/wp-includes/js/jquery/jquery.js"></script><script type="text/javascript" src="http://lab.publicreative.com/wp-content/plugins/pb-embedflash/js/sbadapter/shadowbox-jquery.js"></script><script type="text/javascript" src="http://lab.publicreative.com/wp-content/plugins/pb-embedflash/js/shadowbox.js"></script><script type="text/javascript"><!--
window.onload = function() {var options ={assetURL:'',loadingImage:'http://lab.publicreative.com/wp-content/plugins/pb-embedflash/css/images/loading.gif',flvPlayer:'http://lab.publicreative.com/wp-content/plugins/pb-embedflash/swf/mediaplayer.swf',animate:true,animSequence:'wh',overlayColor:'#000',overlayOpacity:0.9,overlayBgImage:'http://lab.publicreative.com/wp-content/plugins/pb-embedflash/css/images/overlay-85.png',listenOverlay:true,autoplayMovies:true,showMovieControls:true,resizeDuration:0.35,fadeDuration:0.35,displayNav:true,continuous:false,displayCounter:true,counterType:'default',viewportPadding:20,handleLgImages:'resize',initialHeight:160,initialWidth:320,enableKeys:true,keysClose:['c', 'q', 27],keysPrev:['p', 37],keysNext:['n', 39],handleUnsupported:'',text: {cancel:'Cancel',loading: 'loading',close:'<span class="shortcut">C</span>lose',next:'<span class="shortcut">N</span>ext',prev:'<span class="shortcut">P</span>revious',errors:{single: 'You must install the <a href="{0}">{1}</a> browser plugin to view this content.',shared: 'You must install both the <a href="{0}">{1}</a> and <a href="{2}">{3}</a> browser plugins to view this content.',either: 'You must install either the <a href="{0}">{1}</a> or the <a href="{2}">{3}</a> browser plugin to view this content.'}}};Shadowbox.init(options);}
--></script>Experimentation using Flash Player 10’s new Drawing API drawTriangles method.
Here perlin noise is used as the source for moving vertices of a mesh according to colour values.
(Please open the article to see the flash file or player.)
source
]]></description>
			<content:encoded><![CDATA[<p>Experimentation using Flash Player 10’s new Drawing API drawTriangles method.</p>
<p>Here perlin noise is used as the source for moving vertices of a mesh according to colour values.</p>
<p><small>(Please open the article to see the flash file or player.)</small></p>
<p><a href="http://lab.publicreative.com/uploads/fp10dt/FP10dt.zip" target="_self">source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lab.publicreative.com/2009/07/fp10-drawtriangles-demo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embedding asset classes with AS3.</title>
		<link>http://lab.publicreative.com/2009/07/embedding-asset-classes-with-as3/</link>
		<comments>http://lab.publicreative.com/2009/07/embedding-asset-classes-with-as3/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 17:13:11 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[AS3]]></category>

		<guid isPermaLink="false">http://lab.publicreative.com/?p=138</guid>
		<description><![CDATA[For many projects these days I find that just about everything is created in code except for a handful of elements that need to be created in the Flash IDE. In these cases on small projects I recently discovered this method of embedding each asset class within a swf file very handy.
You can define any [...]]]></description>
			<content:encoded><![CDATA[<p>For many projects these days I find that just about everything is created in code except for a handful of elements that need to be created in the Flash IDE. In these cases on small projects I recently discovered this method of embedding each asset class within a swf file very handy.</p>
<p>You can define any stage instances within the asset as public variables in the defining class. This will mean everything is strongly typed and nice and tidy. Just make sure “Automatically declare stage instances” is turned off in your ActionScript 3 settings. It’s probably easiest if I show you what I mean.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> com.publicreative.assets 
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">MovieClip</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<span style="color: #004993;">TextField</span>;
&nbsp;
       <span style="color: #009900;">// In the assets.fla library you set the linkage class to the symbol definition here</span>
	<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;/assets.swf&quot;</span>, symbol=<span style="color: #990000;">&quot;DemoTextField&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> DemoTextField extends <span style="color: #004993;">MovieClip</span>
	<span style="color: #000000;">&#123;</span>
               <span style="color: #009900;">// there is a textfield on the stage with this instance name</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> field_txt<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">TextField</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> DemoTextField<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> 
		<span style="color: #000000;">&#123;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>So now when you want a new DemoTextField… you just need to go.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">import</span> com.publicreative.assets.DemoTextField;
<span style="color: #6699cc; font-weight: bold;">var</span> _demoTF<span style="color: #000000; font-weight: bold;">:</span>DemoTextField = <span style="color: #0033ff; font-weight: bold;">new</span> DemoTextField<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
_demoTF.field_txt.<span style="color: #004993;">text</span> = “<span style="color: #004993;">some</span> <span style="color: #004993;">text</span>”;</pre></div></div>

<p>You can have as many asset classes as you need all published from the same .fla file. Clearly this will get out of hand on a larger project and when assets need to be loaded dynamically. But on smaller projects I think this is an excellent tool to use.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.publicreative.com/2009/07/embedding-asset-classes-with-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PureMVC Twitter Feed Demo</title>
		<link>http://lab.publicreative.com/2009/05/puremvc-twitter-feed-demo/</link>
		<comments>http://lab.publicreative.com/2009/05/puremvc-twitter-feed-demo/#comments</comments>
		<pubDate>Wed, 13 May 2009 16:39:21 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[PureMVC]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://lab.publicreative.com/?p=122</guid>
		<description><![CDATA[I’ve looked at many frameworks over the years including Cairngorm, Mate, Hive and Gaia to name a few.
None of them have ever really caught my attention enough to feel like I should invest time mastering it.
Enter testing out PureMVC. Obviously this is one of the heavyweights of open source frameworks. I’ve had passing looks at [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve looked at many frameworks over the years including <a href="http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm" target="_blank">Cairngorm</a>, <a href="http://mate.asfusion.com/" target="_blank">Mate</a>, <a href="http://code.google.com/p/as-hive/" target="_blank">Hive</a> and <a href="http://www.gaiaflashframework.com/" target="_blank">Gaia</a> to name a few.</p>
<p>None of them have ever really caught my attention enough to feel like I should invest time mastering it.</p>
<p>Enter testing out PureMVC. Obviously this is one of the heavyweights of open source frameworks. I’ve had passing looks at it in the past but never really got into it so thought I’d put together a basic twitter app to give it a go.</p>
<p>The following application simply searches Twitter for the terms “creative”,”inspired”,”amazing” and “bored”,”frustrated”,”stressed” then compares the two sets of positive and negative emotions in a graph to see how inspired the world is feeling at any point in time.</p>
<p><small>(Please open the article to see the flash file or player.)</small></p>
<p><span id="more-122"></span><br />
PureMVC does have a quite steep learning curve and just getting to the “Hello World” state does take quite a lot of code. But things are really starting to make sense and I feel like a more mature developer by using it as I can see how much this framework naturally encourages code re-use, scalability and separation of interests.</p>
<p>In my opinion the most important thing is getting your head around the roles and responsibilities of the Mediator, Proxy and Command classes. My understanding of each is as follows.</p>
<p>Proxy classes are cached by the Model and contain code that manipulates a portion of data. Each Proxy represents a data object that may be asynchronous or not and can expose all or part of the data object it represents.</p>
<p>Mediator classes interact with view components and are cached by the View. The Mediator classes interact with the rest of the system to update and respond to interaction to and from the view component it represents.</p>
<p>Commands are only created when needed and is where the logic of the application resides. You create maps to notifications in the Application Facade. When a notification is sent from somewhere in the system that is mapped, a Command instance is created and executed interacting with other actors in the system and sending further notifications as necessary. It can for instance interact with multiple Proxy classes manipulating data in each and send a notification when complete that multiple Mediators are listening to, updating their respective view components as required.</p>
<p>As this is my first experience using PureMVC, any feedback would be most welcome.</p>
<p>Apart from PureMVC there are a number of open source projects that I use and encourage you to investigate if you don’t use them already including:<br />
<a href="http://code.google.com/p/bulk-loader/" target="_blank">Bulkloader </a>for loading my external assets.<br />
<a href="http://blog.greensock.com/tweenliteas3/" target="_blank">TweenLite </a>for tweening.<br />
<a href="http://demonsterdebugger.com/" target="_blank">DeMonsterDebugger </a>for debugging (this is awesome!)<br />
<a href="http://twitterscript.googlecode.com/" target="_blank">Twitterscript </a>for Twitter API interface.</p>
<p>And <a href="http://lab.publicreative.com/host/twitterhead/src.zip">here </a>is the source.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.publicreative.com/2009/05/puremvc-twitter-feed-demo/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Inside the Classic</title>
		<link>http://lab.publicreative.com/2009/04/inside-the-classic/</link>
		<comments>http://lab.publicreative.com/2009/04/inside-the-classic/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 16:19:52 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Collada]]></category>
		<category><![CDATA[Maya]]></category>
		<category><![CDATA[Papervision]]></category>

		<guid isPermaLink="false">http://lab.publicreative.com/?p=105</guid>
		<description><![CDATA[It’s been a while between posts for me. Mainly because I have been heavily involved in creating the Remaster the Classic project for the last month or so.
The site was made for K-Swiss and MTV to promote the K-Swiss Classic Remastered trainer. Users have the opportunity to customise their Classic by expressing their creativity using [...]]]></description>
			<content:encoded><![CDATA[<p>It’s been a while between posts for me. Mainly because I have been heavily involved in creating the <a href="http://www.remastertheclassic.com/gb#/create">Remaster the Classic</a> project for the last month or so.</p>
<p>The site was made for K-Swiss and MTV to promote the K-Swiss Classic Remastered trainer. Users have the opportunity to customise their Classic by expressing their creativity using paint, graphics and uploading images not to mention adding chains, diamonds and/or studs to their shoe.</p>
<p>Designs are applied to the shoe (a Collada  model rendered with Papervision, created in Maya) in real time. Users can continue to edit the shoe until they are happy with it and then submit the shoe to the competition and <a href="http://www.remastertheclassic.com/gb#/gallery">gallery</a> when both the texture and a thumbnail of the designed shoe are saved.</p>
<p>There were many challenges and many (very) late nights but well worth it as the end result has proven to be extremely popular. Below is a high level overview of the site in relation to the functionality of the Shoe.</p>
<p><span id="more-105"></span><br />
<strong>Creating the model and applying materials.</strong></p>
<p>The shoe model and the additions you can add to it (the chains and the studs) were created in Maya and exported as Collada  files using the <a href="http://sourceforge.net/project/showfiles.php?group_id=136478">Collada plugin</a>. The chains and studs are separate Collada files with individual textures that are mapped to each of them. These are added as children to the main shoe DAE.</p>
<p>Most people reading this will probably be aware that when you export a Collada file from Maya (or Max) that you want to use with Papervision you need a Collada (.dae) file and the texture/material image that has been mapped to that model.</p>
<p>The trick is getting this material image to map correctly to the model in Papervision. To do this you need to know where to look.</p>
<p>With a Collada file exported from Maya I found you need to search the Collada file for the triangles node.</p>
<p>Here it is in our Collada file.</p>

<div class="wp_syntax"><div class="code"><pre class="xml xml" style="font-family:monospace;">triangles material=&quot;a_Backed_Shoe2SG&quot; count=&quot;1958&quot;</pre></div></div>

<p>You need the name of the material, in our case &#8220;a_Backed_Shoe2SG&#8221;.</p>
<p>Then when you are creating the MaterialsList to use with the DAE in Papervision you pass it this name.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #009900;">// create a BitmapMaterial instance using the BitmapData from the loaded texture image.</span>
_shoeMaterial = <span style="color: #0033ff; font-weight: bold;">new</span> BitmapMaterial<span style="color: #000000;">&#40;</span>_loader.getBitmapData<span style="color: #000000;">&#40;</span>_shoeTexture<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #009900;">// create a new materials list. Pass it the bitmap material and give it the name we found in the Collada file from the triangles node.		 </span>
_materialsList = <span style="color: #0033ff; font-weight: bold;">new</span> MaterialsList<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; _materialsList.addMaterial<span style="color: #000000;">&#40;</span> _shoeMaterial , <span style="color: #990000;">&quot;a_Backed_Shoe2SG&quot;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #009900;">// the shoeDae is an instance of a DAE class and is passed the loaded DAE file in binary form and the materials list we created above.</span>
_shoeDae.<span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span>_loader.getBinary<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;shoe_model&quot;</span><span style="color: #000000;">&#41;</span> ,_materialsList<span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #009900;">// the DAE is then added to the Papervision scene</span>
scene.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>_shoeDae<span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>NB: _loader is an instance of the Bulk Loader class. You can check out this library <a href="http://code.google.com/p/bulk-loader/">here</a>.</p>
<p><strong>Swapping textures at runtime.</strong></p>
<p>To swap the material at runtime which obviously happens often I made a setter function on the Shoe class.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> material<span style="color: #000000;">&#40;</span> material<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">BitmapData</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
        <span style="color: #009900;">// if the shoe material exists, dispose of the bitmap</span>
	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_shoeMaterial<span style="color: #000000;">&#41;</span> _shoeMaterial.bitmap.<span style="color: #004993;">dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #009900;">// make a new bitmap material</span>
	_shoeMaterial = <span style="color: #0033ff; font-weight: bold;">new</span> BitmapMaterial<span style="color: #000000;">&#40;</span> material <span style="color: #000000;">&#41;</span>;
	<span style="color: #009900;">// replace the material using the name that we found in the Collada  file above</span>
	_shoeDae.replaceMaterialByName<span style="color: #000000;">&#40;</span> _shoeMaterial , <span style="color: #990000;">&quot;a_Backed_Shoe2SG);
}</span></pre></div></div>

<p>One of the trickiest challenges was turning the area of the shoe the user was editing into the BitmapData to pass to this function and use as the new material for the shoe.</p>
<p>In brief the recipe for this was:<br />
1.	Grab a copy of the current shoe material with everything the user has already created on it. This is a 1600&#215;1600 Bitmap.<br />
2.	Create a holder sprite to build the new image in. Add this current shoe material as the bottom layer.<br />
3.	Grab a copy of the original material, a clean canvas with nothing on it.<br />
4.	Mask the original material with the exact shape of the area the user is editing. This mask needs to be rotated, scaled and translated to the correct position on the original material. Layer this on top of the current shoe material.<br />
5.	So now the resulting image should show everything the user has added to the rest of the texture but the current area they are editing will be clear.<br />
6.	Grab the BitmapData from the area of the shoe the user is currently editing with all the graphics etc the user has added.<br />
7.	Again mask this so that graphics that go outside the editable area are not going to be included on the final image.<br />
8.	Layer this on top, rotating, scaling and translating as necessary with a Multiply blend mode so the stitching comes through from the original texture.<br />
9.	BitmapData.draw the resulting holder sprite with these layers on it and pass to the material function above to swap out the material.</p>
<p>Everything is easier to understand in pictures so here it is:<br />
<a title="Shoe Layering" rel="shadowbox" href="http://lab.publicreative.com/wp-content/uploads/2009/04/shoelayering.jpg"><img src="http://lab.publicreative.com/wp-content/uploads/2009/04/shoelayering-300x158.jpg" alt="" /></a></p>
<p><em><strong>Here is the original shoe material:</strong></em><br />
<a title="Original Texture" rel="shadowbox" href="http://lab.publicreative.com/wp-content/uploads/2009/04/texture_image_original1.jpg"><img src="http://lab.publicreative.com/wp-content/uploads/2009/04/texture_image_original1-300x300.jpg" alt="" /></a></p>
<p><em><strong>And here it is an example of what it looks like once edited:</strong></em><br />
<a title="Edited Texture&lt;/i&gt;" rel="shadowbox" href="http://lab.publicreative.com/wp-content/uploads/2009/04/texture_image_edited.jpg"><img src="http://lab.publicreative.com/wp-content/uploads/2009/04/texture_image_edited-300x300.jpg" alt="" /></a></p>
<p><strong>Preformance and Rendering</strong></p>
<p>Other things to consider were balancing performance with quality. We tried to keep the polygons on the shoe model as low as possible before it really became noticeable and keep the quality of the material image high.</p>
<p>When both the chains and the studs are added, as these are additional models the polygon count goes up considerably so we really tried hard to keep this as low as possible. When flash is asked to render anything over 3000 triangles, it really starts to show.</p>
<p>Additional to that we had problems with Z-Sorting due to the many overlapping parts of the shoe, especially around the laces. To solve this we needed to employ the services of the QuadrantRenderEngine with the Z sorting filter. However, as there are more calculations with every render, this slowed things down even more.</p>
<p>To use this advanced render engine, and keep the polygon count high while not affecting performance we made it so instead of constantly rendering, the Papervision scene was only updated when needed, i.e. when rotated or the texture has been changed.</p>
<p><strong>Saving the entries.</strong></p>
<p>A major part of this campaign is the competition. Every shoe designed and submitted needs to be saved for the gallery and judging.</p>
<p>To do this there are two main things that are needed. The main texture of the shoe, the 1600&#215;1600 jpg that holds the users design and the small thumbnail of the shoe with the design in place for use in the gallery.</p>
<p>The main texture of the shoe is always present in the current BitmapMaterial of the shoe. We just get it out using the BitmapMaterial.bitmap property.</p>
<p>Capturing the thumbnail is a little more involved. First we needed to rotate the shoe to the correct position so that all thumbnails are in the same position. Then we do a BitmapData.draw of the viewport after doing a bit of Matrix scaling and translating.</p>
<p>So we now have the two BitmapData objects for the two images, we just need to save them to the server along with the rest of the users entry details. To save the images we encode the images with Adobes JPGEncoder class (for the big texture) and the PNGEncoder (for the thumbnail). These are both available in the <a href="http://code.google.com/p/as3corelib/">corelib</a>.</p>
<p>Next we encode the resulting ByteArrays with the Base64 encoder. You can grab this from <a href="http://dynamicflash.com/goodies/base64/">Dynamic Flash</a>.</p>
<p>Code for saving the main image.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #009900;">// the bitmap data for the current shoe material</span>
<span style="color: #6699cc; font-weight: bold;">var</span> imageBd<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">BitmapData</span> = Shoe2.getInstance<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.shoeMaterial.bitmap; imageBd = Shoe2.getInstance<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.shoeMaterial.bitmap;
<span style="color: #009900;">// the jpg encoder and the resulting ByteArray</span>
<span style="color: #6699cc; font-weight: bold;">var</span> j<span style="color: #000000; font-weight: bold;">:</span>JPGEncoder = <span style="color: #0033ff; font-weight: bold;">new</span> JPGEncoder<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">50</span><span style="color: #000000;">&#41;</span>; 
<span style="color: #6699cc; font-weight: bold;">var</span> bytes<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">ByteArray</span> = j.encode<span style="color: #000000;">&#40;</span> imageBd<span style="color: #000000;">&#41;</span>; bytes.<span style="color: #004993;">position</span> = 0; 
<span style="color: #009900;">// Encoding to Base64 and saving as part of the entry data object.</span>
entryData.texture_image = Base64.encodeByteArray<span style="color: #000000;">&#40;</span>bytes<span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>The whole package containing the users entry data along with the Base64 encoded images are sent to our custom PHP backend in one tidy package via AMFPHP.</p>
<p>The obvious final step is PHP decoding the base64 images and saving them to disk storing the resultant URL with the rest of the entry data.</p>
<p><strong>Summary.</strong></p>
<p>As I warned at the start of this post, the above is only a very brief overview of how things were done. There was so much more to this than just the shoe but obviously this was the focus and main technical challenge of the site. Any feedback, questions or requests for further detail are obviously welcomed.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.publicreative.com/2009/04/inside-the-classic/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
