<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4698512362740560993</id><updated>2012-01-29T00:25:16.373Z</updated><category term='FPSC'/><category term='colour blind'/><category term='swfaddress'/><category term='QR'/><category term='development'/><category term='snowflake'/><category term='Files'/><category term='click to activate'/><category term='Math'/><category term='adobe'/><category term='fullscreen'/><category term='api'/><category term='listener'/><category term='Channel 4'/><category term='annual'/><category term='chrome'/><category term='e-book'/><category term='elearning'/><category term='JQuery'/><category term='mouse'/><category term='cartesian'/><category term='player'/><category term='cinema 4d'/><category term='genius'/><category term='drag'/><category term='license'/><category term='video'/><category term='paint shop pro'/><category term='x3d'/><category term='actionscript'/><category term='dot com'/><category term='alternative'/><category term='sort'/><category term='tom ang'/><category term='weather'/><category term='colour'/><category term='sitepoint'/><category term='C4'/><category term='wallaby'/><category term='graphics'/><category term='avid'/><category term='ideas'/><category term='anaglyph'/><category term='happy new year'/><category term='rotate'/><category term='painter'/><category term='descartes'/><category term='mixer'/><category term='shaders'/><category term='mac'/><category term='premiere elements'/><category term='design'/><category term='mx2004'/><category term='google'/><category term='unity'/><category term='designer'/><category term='dv'/><category term='education'/><category term='coordinates'/><category term='nasa'/><category term='hexadecimal'/><category term='creative commons'/><category term='application'/><category term='creativity'/><category term='Audio'/><category term='sound'/><category term='plugin'/><category term='animation'/><category term='DJ'/><category term='draw'/><category term='code'/><category term='trigonometry'/><category term='Freeware'/><category term='truespace'/><category term='embed'/><category term='navigation'/><category term='dreamweaver'/><category term='photography'/><category term='parralax mapping'/><category term='photoshop'/><category term='hypercard'/><category term='astronomical'/><category term='MP3'/><category term='Real Player'/><category term='parasite'/><category term='stealing'/><category term='easing'/><category term='Internet Explorer 8'/><category term='copyright'/><category term='setInterval'/><category term='wireless'/><category term='twitter'/><category term='server'/><category term='serif'/><category term='carrara'/><category term='3D glasses'/><category term='adobe exchange'/><category term='computer arts'/><category term='BBC'/><category term='narnia.com'/><category term='magazine'/><category term='3d'/><category term='YQL'/><category term='web3d'/><category term='digital camera'/><category term='VADO HD'/><category term='maxon'/><category term='firefox'/><category term='Flash'/><category term='ivan chermayeff'/><category term='accessibility'/><category term='datatype conversion'/><category term='css'/><category term='toString'/><category term='function'/><category term='doodle'/><category term='.net'/><category term='snow fall'/><category term='freelance'/><category term='mute'/><category term='xml'/><category term='movieclip'/><category term='vivaty'/><category term='query string'/><category term='mysql'/><category term='arrays'/><category term='security'/><category term='caligari'/><category term='object'/><category term='game'/><category term='all rights reserved'/><category term='user'/><category term='component'/><category term='follow'/><category term='geometry'/><category term='blueonyx'/><category term='custom'/><category term='theft'/><category term='photoplus'/><category term='software'/><category term='IE8'/><category term='HTML'/><category term='swf'/><category term='editing'/><category term='flashvars'/><category term='projector'/><category term='Free'/><category term='testing'/><category term='creative COW'/><category term='progress bar'/><category term='NYE'/><category term='web design'/><category term='Eolas'/><category term='sandbox'/><category term='daz'/><category term='url'/><category term='yahoo'/><category term='javascript'/><category term='normal map'/><category term='blender'/><category term='codecs'/><category term='nvu'/><category term='help'/><category term='the gimp'/><category term='form'/><category term='switch'/><category term='ColorCode'/><category term='pixar'/><category term='problem solving'/><category term='download'/><category term='chaser'/><category term='crime'/><category term='browser'/><category term='bryce'/><category term='narnia'/><category term='utrecht university'/><category term='meeus'/><category term='HTML5'/><category term='3D week'/><category term='monster.com'/><category term='key'/><category term='flash 8'/><category term='platform'/><category term='stereoscopy'/><category term='php'/><category term='ajax'/><category term='convert'/><category term='tutorial'/><category term='polarization'/><category term='2010'/><category term='flv'/><category term='interactive media'/><category term='symantec'/><category term='sliding'/><category term='quick reference'/><category term='book'/><category term='time'/><category term='rotation'/><category term='blogger'/><category term='clock'/><category term='as2'/><category term='frontpage'/><category term='microsoft'/><category term='unreal'/><category term='job hunting'/><category term='MYST'/><category term='mozilla'/><category term='Listen Again'/><category term='snow'/><category term='identity theft'/><category term='deep linking'/><title type='text'>Dan's Interactive Media Pages</title><subtitle type='html'>General comments, discoveries, hints, tips and waffle about all areas of interactive media as they affect me.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>93</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-3149343320492125276</id><published>2012-01-27T23:07:00.002Z</published><updated>2012-01-29T00:25:16.381Z</updated><title type='text'>Normal Maps from Photos</title><content type='html'>&lt;a href="http://en.wikipedia.org/wiki/Normal_mapping"&gt;Normal mapping&lt;/a&gt; is a vital part of 3D modelling and rendering these days. In some cases it take hours off your modelling time, and in others hours off your rendering time (and sometimes both).&lt;br /&gt;&lt;br /&gt;A while ago I came across &lt;a href="http://www.zarria.net/nrmphoto/nrmphoto.html"&gt;this tutorial about making normal maps from photos&lt;/a&gt;. I finally got round to trying it.&lt;br /&gt;&lt;br /&gt;Introducing the fruits of my labours - this example of mine is the side of a well worn pound coin. &lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-xS8RCfhofuA/TySBg4lTNsI/AAAAAAAAADQ/TKdCRcSlWLo/s1600/head+normal+balanced.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-xS8RCfhofuA/TySBg4lTNsI/AAAAAAAAADQ/TKdCRcSlWLo/s320/head+normal+balanced.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;You don't need Photoshop to do this, and to prove it I used the &lt;a href="http://www.gimp.org/"&gt;GIMP image manipulation program&lt;/a&gt; to make the normal map, and then applied and rendered in Carrara below.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-5H9YEAWti-w/TySBxwCT_kI/AAAAAAAAADY/0c2aVSct2oE/s1600/coin+render+1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://1.bp.blogspot.com/-5H9YEAWti-w/TySBxwCT_kI/AAAAAAAAADY/0c2aVSct2oE/s320/coin+render+1.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;You can see from this render that it works, but some of the edges need to be sharper.&lt;br /&gt;&lt;br /&gt;A brief critique of this attempt shows the angle of the light source was too low when photographing the coin, making long shadows, and positioning the light source slightly higher would shorten the shadows and give sharper less buttery results, but having tested it using the &lt;a href="http://code.google.com/p/gimp-normalmap/"&gt;3D preview mode in the GIMP Normal Map Filter&lt;/a&gt;, it isn't half bad, and much quicker than trying to build a high res mesh, or digitally painting a height map for &lt;a href="http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop"&gt;conversion to a normal map using tools like the Nvidia Normal Map Filter&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;For some objects you really should give this a try.&lt;br /&gt;&lt;br /&gt;Of course, even this early attempt is usable if supported by other channels such as shine and highlight (specular) using a grayscale map based on the same photos as the normal map. I also used the same grayscale map to mix two shades of coin colour to show a diffrence where dirt gets ingrained and where it gets rubbed off and used the same map again to give two levels of reflection because dirt is not as reflective as metal. Combining all these with the normal map brings a whole different level of realism.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Zns8xKl6hdQ/TySQ_MeXWWI/AAAAAAAAADg/5YkPBTnriRE/s1600/coin+render+2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://4.bp.blogspot.com/-Zns8xKl6hdQ/TySQ_MeXWWI/AAAAAAAAADg/5YkPBTnriRE/s320/coin+render+2.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;I'll explain how I used the same photos as the normal map to make the grayscale specular map that I also used for reflection and grime in my next post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-3149343320492125276?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/3149343320492125276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2012/01/normal-maps-from-photos.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/3149343320492125276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/3149343320492125276'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2012/01/normal-maps-from-photos.html' title='Normal Maps from Photos'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-xS8RCfhofuA/TySBg4lTNsI/AAAAAAAAADQ/TKdCRcSlWLo/s72-c/head+normal+balanced.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-4137110329409377638</id><published>2011-10-18T11:07:00.003+01:00</published><updated>2011-10-18T11:53:25.925+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>Game Development - High Score Leader Boards in Flash</title><content type='html'>One way of increasing the repeat appeal of a game, particularly for 1 player games, is to include a leader board of high scores. This gives the player an additional goal of beating their previous best score, allowing them to compete with themselves, and other players, even if the game has only 1 player mode.&lt;br /&gt;&lt;br /&gt;As long as your game stores the player's score under the variable "score" this example should provide a good starting point for your own leader board or high score board.&lt;br /&gt;&lt;br /&gt;In this example I am using ActionScript 2.0 in Flash. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Code&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The code for this is split into 3 parts. First we create a multidimensional array for keeping the scores and player signatures. Second, we store the score from the game, third we create the leader board that transfers data in and out of the array.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Part 1 - Create a Multidimensional Array&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In my game the leader board only shows the top 10 scorers. For each one it displays the score and a 3 character signature from the player.&lt;br /&gt;&lt;br /&gt;Before we can store data we need to create the place to store it. In this case I am using a multidimensional array. Multidimensional because I want to store 10 elements (1 for each of the top 10) with 2 data elements (score and signature) per player. Doing it this way allows me to sort them later based on score so I can display them from highest scorer to lowest scorer.&lt;br /&gt;&lt;br /&gt;My approach was as follows:&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/*NEW ARRAY*/&lt;br /&gt;/*Make a new array object*/&lt;br /&gt;var leaderboard_array:Array = new Array ();&lt;/div&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/*'Push' data elements onto the array*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;leaderboard_array.push ({initials:"---", score:"0"});&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;leaderboard_array.push ({initials:"---", score:"0"});&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;leaderboard_array.push ({initials:"---", score:"0"});&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;leaderboard_array.push ({initials:"---", score:"0"});&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;leaderboard_array.push ({initials:"---", score:"0"});&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;leaderboard_array.push ({initials:"---", score:"0"});&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;leaderboard_array.push ({initials:"---", score:"0"});&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;leaderboard_array.push ({initials:"---", score:"0"});&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;leaderboard_array.push ({initials:"---", score:"0"});&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;leaderboard_array.push ({initials:"---", score:"0"});&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This code must run &lt;u&gt;only once&lt;/u&gt;, run it again and you will add to the end of your array, eventually making it huge.&lt;br /&gt;&lt;br /&gt;In effect we create an array of 10 elements, that each contain an array of 2 elements. An array within an array. Using the approach I have, where I have named each 'sub'-element "initials" and "score" means that later I can refer to these directly &lt;i&gt;by name&lt;/i&gt; - which makes coding a bit easier to do and debug.&lt;br /&gt;&lt;br /&gt;My new array includes pre-coded default values, this means something will display the first time and we don't get a blank leader board.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Part 2 - The Game&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Your game is your own. The important thing is that you store the players "score" at the end of the game.&lt;b&gt; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Because the &lt;span style="font-family: courier new;"&gt;my_array.sort(Array.NUMERIC)&lt;/span&gt;in Flash does not work correctly (&lt;a href="http://dansinteractive.blogspot.com/2009/09/sorting-numeric-arrays-with.html"&gt;see here&lt;/a&gt;), we cannot use strict datatyping&amp;nbsp; when we define our variables. So, when you first define the "score" variable, all you need to do is:&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;var score = 0;&lt;/div&gt;&lt;br /&gt;&lt;u&gt;Don't&lt;/u&gt; do:&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;var score:Number = 0;&lt;/div&gt;&lt;br /&gt;Or the code won't work later, when we have to treat "score" as a string for sorting.&lt;br /&gt;&lt;br /&gt;When the game is over, just make sure you store the player's score in the "score" variable, e.g.:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;score = endgamescore;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Part 3 - The Leaderboard&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;At this point we have an array, and a "score". In this part of the program we need to do the following as essential elements.&lt;br /&gt;&lt;br /&gt;a. Test whether the player's latest "score" is greater than the lowest score on the current leader board.&lt;br /&gt;b. If it is, allow the player to input a 3 character signature and store it, along with the "score" in the array replacing the previous lowest score.&lt;br /&gt;c. Sort the array by score so each one is listed in order of greatness.&lt;br /&gt;d. Display the contents of the array in text box to show the leader board to the player.&lt;br /&gt;&lt;br /&gt;There is more to it than that, especially since &lt;a href="http://dansinteractive.blogspot.com/2009/09/sorting-numeric-arrays-with.html"&gt;sorting numerically in Flash is not actually possible by direct means - I have gone into detail on that on another post&lt;/a&gt; - so much of the code is required to solve that problem.&lt;br /&gt;&lt;br /&gt;The following code relies on the stage containing:&lt;br /&gt;&lt;br /&gt;1. A text input box with the instance name "initials_txt"&lt;br /&gt;2. A button with the instance name "button_btn"&lt;br /&gt;3. A dynamic text box with the instance name "lb_txt"&lt;br /&gt;&lt;br /&gt;The code is then as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/* vars */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/* strict datatyping is off for score and sortscore in order to sort it due to restriction in Flash */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;var sortscore = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;var initials:String = "";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/*set character limit on input text*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;_root.initials_txt.maxChars = 3;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/*PRE-POPULATE LEADERBOARD WITH CURRENT DATA FROM ARRAY*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;for (var i = 0; i &amp;lt; leaderboard_array.length; i++) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _root.lb_txt.text += leaderboard_array[i].initials + " " + leaderboard_array[i].score + "\n";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/*ADD NEW SCORE ON SUBMIT*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;_root.button_btn.onPress = function () {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* get player name value*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; initials = _root.initials_txt.text;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*convert score to decimals ready for correct sorting*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortscore = score / 10000;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*convert score values in array to decimals ready for correct sorting*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i = 0; i &amp;lt; leaderboard_array.length; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;leaderboard_array[i].score = leaderboard_array[i].score / 10000;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*sort current board by score - low to high*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; leaderboard_array.sortOn ("score");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*if player score is higher than lowest score on board, replace it with player score and name*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (sortscore &amp;gt; leaderboard_array[0].score) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _root.leaderboard_array[0].initials = initials;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _root.leaderboard_array[0].score = sortscore;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*sort again to position the new score and initials correctly in order compared to other scores in array*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; leaderboard_array.sortOn ("score");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*convert all the 'decimaled' scores back again to real scores*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i = 0; i &amp;lt; leaderboard_array.length; i++) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; leaderboard_array[i].score = leaderboard_array[i].score * 10000;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*reverse the order of the array to show scores from high to low*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; leaderboard_array.reverse ();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*clear existing text from the leader board text box*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _root.lb_txt.text = "";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*print new array content to the leader board text box*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i = 0; i &amp;lt; leaderboard_array.length; i++) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _root.lb_txt.text += leaderboard_array[i].initials + " " + leaderboard_array[i].score + "\n";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;};&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That's the main thrust of it - read the comments in the code to see what each lump of code is doing. Of course there is scope to develop on this yourself, but I hope this helps. Happy leader board-ing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-4137110329409377638?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/4137110329409377638/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2011/10/game-development-high-score-leader.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4137110329409377638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4137110329409377638'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2011/10/game-development-high-score-leader.html' title='Game Development - High Score Leader Boards in Flash'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-5831486218584397912</id><published>2011-06-17T23:11:00.002+01:00</published><updated>2011-06-17T23:13:12.866+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='quick reference'/><category scheme='http://www.blogger.com/atom/ns#' term='QR'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Generating QR Codes from the Google Chart API</title><content type='html'>Quick Reference (QR) Codes are a type of Matrix Barcode capable of storing much more information than your normal stripy barcode. &lt;br /&gt;&lt;br /&gt;Many organisations have taken to using QR codes as part of an integrated marketing campaign to store web page URLs, allowing users to capture the 'barcode' on their mobile phone cameras in order to visit the site in a quick and easy fashion.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;QR Codes from Google Chart API&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;The &lt;a href="http://code.google.com/apis/chart/image/docs/gallery/qr_codes.html"&gt;Google Chart API&lt;/a&gt; has, among other things, the facility to generate QR codes of all types, encoding within them text, binary data or Kanji strings that you define - up to the maximum data limit of a QR code.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://code.google.com/apis/chart/image/docs/gallery/qr_codes.html"&gt;Google Chart API is very simple to understand&lt;/a&gt; and returns a PNG file in response to the parameters you set.&lt;br /&gt;&lt;br /&gt;Below I have a JavaScript/HTML implementation of the Google Chart API, that returns a QR code based on the text you input.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Generate a QR Code - JavaScript Implementation of Google Chart API&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;function changeSrc()  {  var qrCodeText = document.getElementById('qrText').value;  document.getElementById("qrImage").src="http://chart.apis.google.com/chart?cht=qr&amp;chs=150x150&amp;chl="+qrCodeText;  document.getElementById("qrLink").value="http://chart.apis.google.com/chart?cht=qr&amp;chs=150x150&amp;chl="+qrCodeText;  }&lt;/script&gt;&lt;br /&gt;&lt;style&gt;.DAtextbox {width:250px;font-size:12pt;padding:5px;}.DAsubmitbut {width:250px;font-size:12pt;padding:5px;text-align:center;}.DAimg {border:1px solid #CCCCCC;padding:0px 50px 0px 50px;}&lt;/style&gt;&lt;br /&gt;&lt;input class="DAtextbox" id="qrText" name="qrText" type="text" value="Enter Your Text" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;input class="DAsubmitbut" name="Submit" onclick="changeSrc()" type="submit" value="Generate QR Code" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img class="DAimg" height="150" id="qrImage" src="http://chart.apis.google.com/chart?cht=qr&amp;amp;chs=150x150&amp;amp;chl=hello%20world" width="150" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;textarea class="DAtextbox" cols="18" id="qrLink" name="textfield" readonly="readonly" rows="6"&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;QR Code Generator Source&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The source code for my JavaScript implementation above:&lt;br /&gt;&lt;br /&gt;&lt;textarea cols="40" name="textfield" readonly="readonly" rows="20"&gt;&amp;lt;script type="text/javascript"&amp;gt; function changeSrc()   {   var qrCodeText = document.getElementById('qrText').value;   document.getElementById("qrImage").src="http://chart.apis.google.com/chart?cht=qr&amp;amp;chs=150x150&amp;amp;chl="+qrCodeText;   document.getElementById("qrLink").value="http://chart.apis.google.com/chart?cht=qr&amp;amp;chs=150x150&amp;amp;chl="+qrCodeText;   } &amp;lt;/script&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;style&amp;gt; .DAtextbox { width:250px; font-size:12pt; padding:5px; } .DAsubmitbut { width:250px; font-size:12pt; padding:5px; text-align:center; } .DAimg { border:1px solid #CCCCCC; padding:0px 50px 0px 50px; } &amp;lt;/style&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;p&amp;gt;  &amp;lt;input name="qrText" type="text" class="DAtextbox" id="qrText" value="Enter Your Text"&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&amp;lt;input name="Submit" type="submit" class="DAsubmitbut" value="Generate QR Code" onclick="changeSrc()"&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&amp;lt;img class="DAimg" id="qrImage" src="http://chart.apis.google.com/chart?cht=qr&amp;amp;chs=150x150&amp;amp;chl=http://dansinteractive.blogspot.com/2011/06/generating-qr-codes-from-google-chart.html" width="150" height="150" /&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;  &amp;lt;textarea name="textfield" cols="18" rows="6" readonly class="DAtextbox" id="qrLink"&amp;gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;Happy QR Code Generating.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-5831486218584397912?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/5831486218584397912/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2011/06/generating-qr-codes-from-google-chart.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5831486218584397912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5831486218584397912'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2011/06/generating-qr-codes-from-google-chart.html' title='Generating QR Codes from the Google Chart API'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-7233115042075420593</id><published>2011-05-14T01:17:00.000+01:00</published><updated>2011-05-14T01:17:09.368+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='codecs'/><category scheme='http://www.blogger.com/atom/ns#' term='VADO HD'/><category scheme='http://www.blogger.com/atom/ns#' term='editing'/><category scheme='http://www.blogger.com/atom/ns#' term='premiere elements'/><category scheme='http://www.blogger.com/atom/ns#' term='convert'/><title type='text'>Editing Vado HD Video With Premiere Elements 7</title><content type='html'>If like me you have had some frustration trying to get Premiere Elements to work with VADO HD video, without hanging on import, you may find this solution helpful.&lt;br /&gt;&lt;br /&gt;When for a recent birthday I was the glad recipient of a &lt;a href="http://www.amazon.co.uk/gp/product/B003U3VRHY/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&amp;amp;tag=digitalarena-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=B003U3VRHY"&gt;new VADO HD pocket video camera&lt;/a&gt;, and a &lt;a href="http://www.amazon.co.uk/gp/product/B001ELK950/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&amp;amp;tag=digitalarena-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=B001ELK950"&gt;new sealed Premiere Elements 7&lt;/a&gt;, I was excited to get editing some footage. However I quickly ran into trouble - when importing the VADO footage into Elements it would either hang, or if it did import would apparently have no picture. Worse, because of the way the Elements video library previews video assets from &lt;i&gt;all&lt;/i&gt; your projects by default, Elements would fail to start up and hang - purely because some VADO HD footage was in the library.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;If Premiere Elements won't start because of a dodgy video file in the library&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;First, if Elements won't start, or hangs, because you have some incompatible footage in the library the simplest cure is to rename the suspect file, or rename the folder it is in, before you start elements. This will break the link Elements has to the file. Then Elements will start properly and give you a 'file not found' icon where the video thumbnail once was in the library. At this point you can simply click on it in the library and delete it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Making Premiere Elements read VADO HD video files&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In trying to solve this I have tried 2 conversion methods (one using Super, and another using Prism), but either of those means a laborious process of mass conversion, and you end up with duplicate files in different formats, and the converted files are either much larger than the originals, or a lower quality I found.&lt;br /&gt;&lt;b&gt; &lt;/b&gt;&lt;br /&gt;The best solution was simply to&lt;a href="http://download.cnet.com/K-Lite-Mega-Codec-Pack/3000-13632_4-10794603.html"&gt; install the K-Lite Codec Pack&lt;/a&gt;. The installer checked for conflicting codecs as it went along, giving me the option to remove them automatically (which I did). I used the advanced installer option so I could choose what to install, and selected the "lots of stuff" option so I got pretty much everything - including the all important h.264.&lt;br /&gt;&lt;br /&gt;Once installed I ran Premiere Elements, imported a native unconverted VADO HD video file and added it to the timeline with barely a pause in the action.&lt;br /&gt;&lt;br /&gt;Forget laborious file conversion - try installing the K-Lite Codec Pack before you do anything else.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Still stuck?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you still have problems you may find the following helpful:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.federicopistono.org/blog/howto-batch-convert-flip-mino-and-creative-vado-hd-videos-for-final-cut"&gt;Batch converting VADO HD&lt;/a&gt;&lt;br /&gt;&lt;a href="http://handbrake.fr/downloads.php"&gt;Handbrake Video Transcoder&lt;/a&gt;&lt;br /&gt;&lt;a href="http://forums.adobe.com/message/2340435"&gt;Converting Video for Premiere&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-7233115042075420593?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/7233115042075420593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2011/05/editing-vado-hd-video-with-premiere.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/7233115042075420593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/7233115042075420593'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2011/05/editing-vado-hd-video-with-premiere.html' title='Editing Vado HD Video With Premiere Elements 7'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-4040017690639280995</id><published>2011-04-29T21:47:00.001+01:00</published><updated>2011-04-29T21:48:49.948+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wallaby'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='convert'/><title type='text'>Convert Flash to HTML5 with Adobe Wallaby</title><content type='html'>.NET magazine reports this month that Adobe has released a "Flash-to-web-standards converter" called Wallaby, that basically takes your FLA file and spits out standards compliant HTML5 with accompanying JavaScript.&lt;br /&gt;&lt;br /&gt;I must say I was waiting for Adobe to make a move like this ever since Apple got the mardies and decided to not support the Flash Player on its mobile devices. But I thought it might be a feature of CS6, I didn't expect it to be a free Adobe AIR app that I could &lt;a href="http://adobe.ly/ewFJsm"&gt;download today&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;.NET quotes senior product manager at Flash Professional as saying "Wallaby's initial focus is on converting banner ads and simple animations to HTML5, to cater for iOS, but that future development will be driven by consumer requirements..." &lt;a href="http://www.myfavouritemagazines.co.uk/design/net-magazine-subscription/"&gt;buy .NET for more info&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;So, while not expecting great shakes for some of my more advanced Flash work, I can't wait to see what it can do... I'm going to have a play.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-4040017690639280995?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/4040017690639280995/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2011/04/convert-flash-to-html5-with-adobe.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4040017690639280995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4040017690639280995'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2011/04/convert-flash-to-html5-with-adobe.html' title='Convert Flash to HTML5 with Adobe Wallaby'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6560431587800164482</id><published>2011-04-09T00:21:00.003+01:00</published><updated>2011-04-09T00:29:57.954+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DJ'/><category scheme='http://www.blogger.com/atom/ns#' term='Audio'/><category scheme='http://www.blogger.com/atom/ns#' term='sound'/><category scheme='http://www.blogger.com/atom/ns#' term='object'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='mixer'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Experimenting with Sound in Flash - DJ Music Mixer</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-fRnNyPvrZyE/TZ-NaLy-1WI/AAAAAAAAAC8/qRD4HFC400o/s1600/mini-j-pic.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" r6="true" src="http://2.bp.blogspot.com/-fRnNyPvrZyE/TZ-NaLy-1WI/AAAAAAAAAC8/qRD4HFC400o/s1600/mini-j-pic.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;As soon as I realised the possibilities available with Sound Objects in Flash I realised that &lt;a href="http://www.digitalarena.co.uk/teach/dj_mixer/"&gt;you could write a simple sound mixing app using ActionScript&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I started this experiment ages ago, but ran into a problem with the sound I couldn't solve straight away. 18 months later I remember it exists and blow the dust off to find the problem still waiting for me.&lt;br /&gt;&lt;br /&gt;Just in case any one else has struggled with the same problem...&amp;nbsp;I now have the solution, or at least know why that particular approach wouldn't work and have an alternative.&lt;br /&gt;&lt;br /&gt;Once you set up a Sound Object you can either &lt;a href="http://dansinteractive.blogspot.com/2010/08/controlling-sounds.html"&gt;use&amp;nbsp;&lt;em&gt;attachSound&lt;/em&gt; to connect an embedded sound from your document Library&lt;/a&gt;, or you can use &lt;em&gt;loadSound&lt;/em&gt; to load in an external MP3 file. But... and this is where I went wrong... you can't do both. In other words, if the first time you initialise the sound object you use &lt;em&gt;attachSound&lt;/em&gt; you can't later change the sound using &lt;em&gt;loadSound&lt;/em&gt; and expect it to behave normally. At least that was my experience.&lt;br /&gt;&lt;br /&gt;My experimental app was a 2 channel audio mixer that used 2 Sound Objects, one for each channel. The mixing was done very simply by reducing the volume of one Sound Object while simultaneously increasing the volume of the other. So far so good.&lt;br /&gt;&lt;br /&gt;However, for the Sound Objects to properly initialise, (and therefore the volume control code work properly) they needed to have a sound loaded into them straight away. The most obvious solution to me was to use &lt;em&gt;attachSound&lt;/em&gt; to connect a sound embedded in the movie. So I made a couple of MP3s of 0 second duration and used those embedded within the app. Fine, the Objects initialised OK.&lt;br /&gt;&lt;br /&gt;However, to be useful you need to be able to load external MP3s in, or it's only a 2 song show. And that's where the problem arose, because I would need switch from using &lt;em&gt;attachSound&lt;/em&gt; to &lt;em&gt;loadSound&lt;/em&gt; after the object initialised, and all of a sudden the volume control stops working as expected.&lt;br /&gt;&lt;br /&gt;And that's what stumped me. It was only coming back with fresh eyes that allowed me to spot this discrepancy.&lt;br /&gt;&lt;br /&gt;So, how to overcome it?&lt;br /&gt;&lt;br /&gt;Simples - use &lt;em&gt;loadSound&lt;/em&gt; from the first, but get Flash to load a non-existent sound by getting it to load nothing (e.g. ""). Sure, Flash will error, and complain it can't find the file, but the Sound Object will still initialise correctly - and the error is only visible when you test the movie from within the authoring software, not once exported.&lt;br /&gt;&lt;br /&gt;Hey presto, when I load an external sound it all works, because I used &lt;em&gt;loadSound&lt;/em&gt; all along and didn't change method later on. My &lt;a href="http://www.digitalarena.co.uk/teach/dj_mixer/"&gt;music mixing app&lt;/a&gt; finally works.&lt;br /&gt;&lt;br /&gt;It's possible there are other factors or other solutions - happy to hear about them, but that's how I got round it.&lt;br /&gt;&lt;br /&gt;If it helps, happy to help.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6560431587800164482?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6560431587800164482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2011/04/experimenting-with-sound-in-flash-dj.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6560431587800164482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6560431587800164482'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2011/04/experimenting-with-sound-in-flash-dj.html' title='Experimenting with Sound in Flash - DJ Music Mixer'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-fRnNyPvrZyE/TZ-NaLy-1WI/AAAAAAAAAC8/qRD4HFC400o/s72-c/mini-j-pic.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6439802910363087315</id><published>2011-04-02T10:49:00.003+01:00</published><updated>2011-04-02T10:56:53.015+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='api'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='yahoo'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='weather'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Graphically Displaying Yahoo Weather API Data in Flash</title><content type='html'>&lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" height="600" width="330"&gt;   &lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/weatherstation1a.swf"&gt;&lt;param name=quality value=high&gt;&lt;embed src="http://www.digitalarena.co.uk/diblog/weatherstation1a.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="330" height="600"&gt;&lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;In my &lt;a href="http://dansinteractive.blogspot.com/2011/03/finding-weather-with-yql-and-yahoo-api.html"&gt;last post&lt;/a&gt; I looked at querying the Yahoo&amp;nbsp;GEO and Weather APIs from within flash in order to return an XML file containing weather and forecast information.&lt;br /&gt;&lt;br /&gt;Last time I simply pulled out the location and the weather condition text that gave a general description of the current weather. But actually the XML contains many more items than that. One of which is the prevailing temperature of the location being queried.&lt;br /&gt;&lt;br /&gt;Displaying the temperature as text is relatively easy but you can also be more graphic, as in my virtual thermometer above.&lt;br /&gt;&lt;br /&gt;In this prototype I am simply using the temperature data, which Yahoo provides as an integer, to determine the length of the 'mercury' in the thermometer.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How it was done&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;The Graphics&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;First I made all the pretty graphics in Fireworks (but you could use Photoshop, Paint.net, PhotoPlus etc.), and imported the assets into Flash. The important thing is that your scale (that's the Celcius and Farenheit rulers are correctly in line with each other, and the increments are spaced evenly on each scale).&lt;br /&gt;&lt;br /&gt;To do this you need to understand the following:&lt;br /&gt;&lt;br /&gt;-40C is the same as -40F (that's where the two scales meet)&lt;br /&gt;0C is the same as +32F&lt;br /&gt;+50C is the same as +122F&lt;br /&gt;&lt;br /&gt;On that basis you should be able to construct C and F scales that line up the way they should. I did it by making two the same and then scaling the F scale smaller vertically so that -40 F and 122 F lined up with -40 C and 50 C respectively.&lt;br /&gt;&lt;br /&gt;I also chose to run my scales from -40C to +50C because using the Yahoo Weather API I needed a scale that would reasonably take all global temperatures. I figure that somewhere might get close to -40C and somewhere might get up to +50C. If it turns out my scale isn't big enough I can always ammend it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;The 'Mechanics'&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Once the graphics are in Flash I create a small red rectangle for the 'mercury' and turn it into a MovieClip (press F8) with the &lt;em&gt;registration point&lt;/em&gt; at the bottom left, and with the &lt;em&gt;instance name&lt;/em&gt; "liquid_mc". Then I create a transparent rectangle for the tube in which the 'mercury' travels&amp;nbsp;and turn it into a MovieClip with the &lt;em&gt;instance name&lt;/em&gt; "tube_mc" - this needs to be exactly the same height as the distance between the lowest temperature on your graphical scale (in my case -40C) and the highest temperature (in my case +50C) - for me this turned out to be 360 pixels, but it will vary depending on the size and shape of your graphical representation of the scale.&lt;br /&gt;&lt;br /&gt;I place the two MovieClips on top of the graphic in the right place at the bottom of the graphical glass tube so when the the 'mercury' grows it will grow up from the bottom.&lt;br /&gt;&lt;br /&gt;Then I select the graphic, the "tube_mc" and the "liquid_mc" and turn them all into a MovieClip with the &lt;em&gt;instance name&lt;/em&gt; "thermometer_mc", so that "tube_mc" and "liquid_mc" are inside "thermometer_mc".&lt;br /&gt;&lt;br /&gt;Finally, create a button, and add it to the stage with the instance name "submit_btn". Users will need to press this to&amp;nbsp;run the query of the Yahoo API&amp;nbsp;and display the result.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;The Code&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Then I create a new layer, give it the name 'actions' (so all my code is neatly in one place), and put in the following actionscript. Read my comments in the code to see what is happening:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;stop ();&lt;br /&gt;/*Thermometer*/&lt;br /&gt;/*calculate the pixel height of 1 degree c by dividing the height of the thermometer tube by the number of degrees c it covers*/&lt;br /&gt;var degree:Number = _root.thermometer_mc.tube_mc._height / 90;&lt;br /&gt;/*calculate zero - because our thermometer starts at -40C we use this to ensure future calculations take account of this fact*/&lt;br /&gt;var zero:Number = degree * 40;&lt;br /&gt;/*Accessing the Yahoo API to find out the weather in any location using postcode and country code*/&lt;br /&gt;/*set the search terms as variables, you can pull these from user input with some different ActionScript */&lt;br /&gt;_root.submit_btn.onPress = function () {&lt;br /&gt;var zip = "SW1A 1AA";&lt;br /&gt;var country = "UK";&lt;br /&gt;/*Find the WOEID*/&lt;br /&gt;woeidXml = new XML ();&lt;br /&gt;woeidXml.ignoreWhite = true;&lt;br /&gt;/* run the loadWoeid function when the XML file loads that contains Yahoo's reply to our query below*/&lt;br /&gt;woeidXml.onLoad = loadWoeid;&lt;br /&gt;/* ASK QUESTION 1 - query the Yahoo API using YQL and the search terms above */&lt;br /&gt;woeidXml.load ("http://query.yahooapis.com/v1/public/yql?q=select%20woeid%20from%20geo.places%20where%20text%3D%22" + zip + "%2C" + country + "%22&amp;amp;diagnostics=true");&lt;br /&gt;/* this function will run when the XML file loads that contains Yahoo's reply to our query */&lt;br /&gt;function loadWoeid () {&lt;br /&gt;/*parse the XML response and store the woeid value as a variable in Flash called 'woeid'*/&lt;br /&gt;woeid = woeidXml.childNodes[0].childNodes[1].childNodes[0].childNodes[0].childNodes[0];&lt;br /&gt;/*find the WEATHER from the WOEID just gathered*/&lt;br /&gt;/* we nest this function for question 2 within the function for question 1 because doing it this way means that question 2 is not asked until question 1 has an answer*/&lt;br /&gt;weatherXml = new XML ();&lt;br /&gt;weatherXml.ignoreWhite = true;&lt;br /&gt;/* run the loadWeather function when the XML file loads that contains Yahoo's reply to our query below*/&lt;br /&gt;weatherXml.onLoad = loadWeather;&lt;br /&gt;/* ASK QUESTION 2 - query the Yahoo Weather API using the woeid we found out in question 1 above */&lt;br /&gt;weatherXml.load ("http://weather.yahooapis.com/forecastrss?w=" + woeid + "&amp;amp;u=c");&lt;br /&gt;/* this function will run when the XML file loads that contains Yahoo's reply to our query */&lt;br /&gt;function loadWeather () {&lt;br /&gt;/*parse the XML response and store the current temperature condition value as a variable in Flash called 'temp_xml'*/&lt;br /&gt;temp_xml = weatherXml.childNodes[0].childNodes[0].childNodes[12].childNodes[5].attributes.temp;&lt;br /&gt;/*set current temperature variable from XML*/&lt;br /&gt;var temp_c:Number = temp_xml;&lt;br /&gt;/*set height of the thermometer liquid_mc graphic based on the temperature extracted from the XML*/&lt;br /&gt;_root.thermometer_mc.liquid_mc._height = (temp_c * degree) + zero;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}; &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;As you will see, this is virtually the same code as in my previous post, the main difference is how we use the extracted data to change the height of a MovieClip that represents the 'mercury' in the thermometer. To find the temperature of a different location simply change the values of &lt;em&gt;zip&lt;/em&gt; and &lt;em&gt;country&lt;/em&gt; on lines 10 and 11.&lt;br /&gt;&lt;br /&gt;I went a bit further (not explained in this post) and put in some text input fields so that the user can define their own location (maybe I will get time to explain that in a future post).&lt;br /&gt;&lt;br /&gt;Meanwhile, happy temperature... er... displaying.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6439802910363087315?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6439802910363087315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2011/04/graphically-displaying-yahoo-weather.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6439802910363087315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6439802910363087315'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2011/04/graphically-displaying-yahoo-weather.html' title='Graphically Displaying Yahoo Weather API Data in Flash'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-1760131610637471773</id><published>2011-03-21T02:02:00.003Z</published><updated>2011-03-21T21:20:12.804Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='api'/><category scheme='http://www.blogger.com/atom/ns#' term='yahoo'/><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='weather'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='YQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Finding the Weather with YQL and the Yahoo API</title><content type='html'>I spent some of this weekend examining the potential of the Google API for finding out the weather in my area. My long term aim is to include some nod to local weather in a Flash app I am working on. While the Google API was easy to tap into (&lt;a href="http://www.google.com/ig/api?weather=london,uk"&gt;see here&lt;/a&gt;) it is not very well documented and apparently unofficial and may change or vanish without warning (&lt;a href="http://www.google.com/support/forum/p/apps-apis/thread?tid=718560d8c2c913ff&amp;amp;hl=en"&gt;see discussion here&lt;/a&gt;) - which wouldn't bode well for inclusion in an app.&lt;br /&gt;&lt;br /&gt;It was &lt;a href="http://blog.emerick.org/2008/05/07/google-weather-api-feed-documentation/"&gt;Jason Emerick's blog&lt;/a&gt; that pointed me towards the Yahoo API as an alternative with better documentation and official support. Now I have always been a fan of Google over Yahoo, but&amp;nbsp;needing reliability I sloped over to Yahoo and revived my dormant account. It wasn't long before I was utterly convinced that Yahoo have an excellent API with excellent support, and &lt;a href="http://developer.yahoo.com/yql/console/"&gt;a&amp;nbsp;terrific console&lt;/a&gt; to help you try out your queries and test the results.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Differences between getting Google weather and Yahoo weather &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;While powerful, the Yahoo API didn't give me the weather information I was after with quite the same ease as the Google API. With the Google API all you needed to do is call the API URL and append your location to the end:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;http://www.google.com/ig/api?weather=london,uk&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The results are XML you can parse using your chosen language (in my case ActionScript).&lt;br /&gt;&lt;br /&gt;Yahoo on the other hand isn't quite as straightforward (though much better once you get the hang of it). This is because you can't directly query Yahoo's weather API using your chosen location as you can with Google. Yahoo instead requires you to specify the WOEID (Yahoo's proprietary "Where On Earth ID") of the location you want to know the weather for.&lt;br /&gt;&lt;br /&gt;Once you know the WOEID of the location, finding the weather for that location is as simple as:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;http://weather.yahooapis.com/forecastrss?w=44418&amp;amp;u=c&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;WOEIDs appear to be an invention of Yahoo for&amp;nbsp;identifying&amp;nbsp;locations. Actually they are a really good idea, as it means your query &lt;a href="http://developer.yahoo.com/geo/geoplanet/guide/concepts.html"&gt;will always work, even when places and names change&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;The challenge is, of course,&amp;nbsp;that most people won't know what the WOEID for their location is and so won't be able to use it to find out the weather in their area. I don't know my WOEID, that's for sure.&lt;br /&gt;&lt;br /&gt;So we have to first find out our WOEID from our known location. You can do that like this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;http://query.yahooapis.com/v1/public/yql?q=select%20woeid%20from%20geo.places%20where%20text%3D%22SW1A%202AA%2Cuk%22&amp;amp;diagnostics=true&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://developer.yahoo.com/yql/console/#h=select%20woeid%20from%20geo.places%20where%20text%3D%22SW1A%202AA%2Cuk%22"&gt;The Yahoo API console&lt;/a&gt; is very helpful in letting you experiment with the queries, and producing URLs like the &lt;a href="http://developer.yahoo.com/yql/console/#h=select%20woeid%20from%20geo.places%20where%20text%3D%22SW1A%202AA%2Cuk%22"&gt;one above&lt;/a&gt; for you to call in your code.&lt;br /&gt;&lt;br /&gt;So knowing that with 2 questions I can still get the information I need from Yahoo, I felt more confident pressing ahead with the Yahoo API with its better documentation and promise to give 6 months notice to any changes. A far cry from Google's&amp;nbsp;relative silence on the issue with their unofficial weather API.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Using ActionScript to query the Yahoo geo and weather APIs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;So ultimately&amp;nbsp;I have to ask 2 questions of Yahoo with my ActionScript. First - what is the WOEID for my location given as postcode, country? Second - what is the weather forecast for this WOEID?&lt;br /&gt;&lt;br /&gt;For question 1 my ActionScript will use this query via the Yahoo YQL API to find out the location's WOEID:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;a href="http://query.yahooapis.com/v1/public/yql?q=select%20woeid%20from%20geo.places%20where%20text%3D%22SW1A 2AA%2Cuk%22&amp;amp;diagnostics=true"&gt;http://query.yahooapis.com/v1/public/yql?q=select%20woeid%20from%20geo.places%20where%20text%3D%22SW1A 2AA%2Cuk%22&amp;amp;diagnostics=true&lt;/a&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;For question 2 my ActionScript will simply reference Yahoo's weather API using the WOEID from question 1 as a query term, resulting in an XML file containing weather information for the location represented by that WOEID:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;a href="http://weather.yahooapis.com/forecastrss?w=26355493&amp;amp;u=c"&gt;http://weather.yahooapis.com/forecastrss?w=26355493&amp;amp;u=c&lt;/a&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The trick with the ActionScript&amp;nbsp;is to ask the questions in the right order, and to write your code so question 2 is not asked until it has the answer to question 1 (else you won't get a&amp;nbsp;proper reply and your ActionScript won't get the XML it is expecting and will return 'undefined' where you were expecting the weather status).&lt;br /&gt;&lt;br /&gt;Here's my solution, read the comments to see what I am doing there:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/*Accessing the Yahoo API to find out the weather in any location using postcode and country code*/&lt;br /&gt;/*set the search terms as variables, you can pull these from user input with some different ActionScript */&lt;br /&gt;var zip = "SW1A 2AA";&lt;br /&gt;var country = "uk";&lt;br /&gt;/*Find the WOEID*/&lt;br /&gt;woeidXml = new XML ();&lt;br /&gt;woeidXml.ignoreWhite = true;&lt;br /&gt;/* run the loadWoeid function when the XML file loads that contains Yahoo's reply to our query below*/&lt;br /&gt;woeidXml.onLoad = loadWoeid;&lt;br /&gt;/* ASK QUESTION 1 - query the Yahoo API using YQL and the search terms above */&lt;br /&gt;woeidXml.load ("http://query.yahooapis.com/v1/public/yql?q=select%20woeid%20from%20geo.places%20where%20text%3D%22" + zip + "%2C" + country + "%22&amp;amp;diagnostics=true");&lt;br /&gt;/* this function will run when the XML file loads that contains Yahoo's reply to our query */&lt;br /&gt;function loadWoeid () {&lt;br /&gt;/*parse the XML response and store the woeid value as a variable in Flash called 'woeid'*/&lt;br /&gt;woeid = woeidXml.childNodes[0].childNodes[1].childNodes[0].childNodes[0].childNodes[0];&lt;br /&gt;/*test the value we have stored with a trace*/&lt;br /&gt;trace (woeid); &lt;br /&gt;/*find the WEATHER from the WOEID just gathered*/&lt;br /&gt;/* we nest this function for question 2 within the function for question 1 because doing it this way means that question 2 is not asked until question 1 has an answer*/&lt;br /&gt;weatherXml = new XML ();&lt;br /&gt;weatherXml.ignoreWhite = true;&lt;br /&gt;/* run the loadWeather function when the XML file loads that contains Yahoo's reply to our query below*/&lt;br /&gt;weatherXml.onLoad = loadWeather;&lt;br /&gt;/* ASK QUESTION 2 - query the Yahoo Weather API using the woeid we found out in question 1 above */&lt;br /&gt;weatherXml.load ("http://weather.yahooapis.com/forecastrss?w=" + woeid + "&amp;amp;u=c");&lt;br /&gt;/* this function will run when the XML file loads that contains Yahoo's reply to our query */&lt;br /&gt;function loadWeather () {&lt;br /&gt;/*parse the XML response and store the current weather condition value as a variable in Flash called 'condition_xml'*/&lt;br /&gt;condition_xml = weatherXml.childNodes[0].childNodes[0].childNodes[12].childNodes[5].attributes.text;&lt;br /&gt;/*parse the XML response and store the current weather place name value as a variable in Flash called 'place_xml'*/&lt;br /&gt;place_xml = weatherXml.childNodes[0].childNodes[0].childNodes[6].attributes.city;&lt;br /&gt;/*test the values we have stored with a couple of traces*/&lt;br /&gt;trace (condition_xml);&lt;br /&gt;trace (place_xml);&lt;br /&gt;}&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And that's a wrap. Ideally I wanted to get a single answer from Yahoo by linking the 2 questions in their API, but that proved difficult using just YQL because Yahoo would not provide weather data using YQL unless you knew the location (another apparently random code different again to the woeid) or you provided a US zip code (so no good to us Europeans). So I settled on this 2 stage solution that works for me.&lt;br /&gt;&lt;br /&gt;Bugs or traits include being able to swap where I input a postcode with the name of a city, and you still get working results from Yahoo provided it has heard of the city.&lt;br /&gt;&lt;br /&gt;Anyway, I know how I will use this, so if you have a use for this happy coding.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Addendum&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Here's an implementation of the above code that takes user input and delivers the result.&lt;br /&gt;&lt;br /&gt;&lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" height="100" width="430"&gt;   &lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/woeid_weather_finder_app.swf"&gt;&lt;param name=quality value=high&gt;&lt;embed src="http://www.digitalarena.co.uk/diblog/woeid_weather_finder_app.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="430" height="100"&gt;&lt;/embed&gt; &lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-1760131610637471773?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/1760131610637471773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2011/03/finding-weather-with-yql-and-yahoo-api.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1760131610637471773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1760131610637471773'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2011/03/finding-weather-with-yql-and-yahoo-api.html' title='Finding the Weather with YQL and the Yahoo API'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-8031413420292601375</id><published>2011-03-19T15:34:00.006Z</published><updated>2011-03-19T16:06:45.047Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='clock'/><category scheme='http://www.blogger.com/atom/ns#' term='meeus'/><category scheme='http://www.blogger.com/atom/ns#' term='astronomical'/><category scheme='http://www.blogger.com/atom/ns#' term='time'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='utrecht university'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='annual'/><category scheme='http://www.blogger.com/atom/ns#' term='nasa'/><title type='text'>Annual Clock Flash App</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.digitalarena.co.uk/teach/annual_clock/images/annual_clock_featurepic.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="160" r6="true" src="http://www.digitalarena.co.uk/teach/annual_clock/images/annual_clock_featurepic.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Some projects are just plain fun. You get an idea, you get inspiration on how it should look, you research the maths that goes behind it and crack on until it is done. The &lt;a href="http://www.digitalarena.co.uk/teach/annual_clock/index.htm"&gt;Annual Clock&lt;/a&gt; is one such project for me. I actually finished it as a Flash application almost a year ago, but only just got round to converting it into a screensaver.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Idea&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Visually it was inspired by astronomical clocks of yester-year (such as the one below).&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://plus.maths.org/latestnews/sep-dec05/calendar/astroclock.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="211" r6="true" src="http://plus.maths.org/latestnews/sep-dec05/calendar/astroclock.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;My aim however was not to portray the movement of heavenly bodies as much as it was to portray the passage of time in a more unique way than&amp;nbsp;the standard hour, minute and second hands. Something about a clock that showed all layers of 'time' passing at once seemed an exciting and relatively unique prospect. My approach took a series of discs, each portraying a different element of time measurement, radiating out from the centre, with each disc moving progressively more slowly working from the instant, through seconds, minutes, hours, daylight, days, moon phases, months and seasons. I stopped there since the next levels (e.g. years, centuries, milleniums etc) would give the clock a lifespan, something I wanted to avoid. Rather than using hands I had the discs rotate instead, with the centre point representing the person - the instance of time in which we exist now.&lt;br /&gt;&lt;br /&gt;But enough of concept.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Maths&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The code for the passage of time&amp;nbsp;is pretty straightforward. You take the current computer&amp;nbsp;system time and date,&amp;nbsp;and use it to rotate the discs as a proportion of 360 degrees. Not too difficult. The tricky part was dealing with items that don't stick rigidly to our calendar such as Easter, the moon phases, and the solstices and equinoxes.&lt;br /&gt;&lt;br /&gt;For the Easter calculation I did an ActionScript implementation of&amp;nbsp;a formula on the &lt;a href="http://www.bbc.co.uk/dna/h2g2/A653267"&gt;BBC H2G2 website&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;For the solstices and equinoxes I did an ActionScript implementation based on the astronomical algorithms of &lt;a href="http://en.wikipedia.org/wiki/Jean_Meeus"&gt;Jean Meeus&lt;/a&gt; (Astronomical Algorithms, 1st Ed., 1991) which someone had posted online somewhere (can't remember where now). Meeus's formulas&amp;nbsp;calculate the date of the current year's solstices and equinoxes, but gives the result as a date using the Julian calendar. (In fact Meeus's formulas calculate the time of the events to within 4 minutes of actual with any error down to orbital perturbation - how cool is that?)&lt;br /&gt;&lt;br /&gt;However a Julian date was not&amp;nbsp;suitable for my needs, and&amp;nbsp;meant some highly complex conversion from the Julian to the Gregorian calendar based on a formula published online by &lt;a href="http://www.astro.uu.nl/~strous/AA/en/reken/juliaansedag.html"&gt;Utrecht University&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I confess I didn't understand most of the formulas (but then I am not an astrophysicist or mathematician - and I gave all sources their dues in my ActionScript comments). But that's the great thing about ActionScript's mathematical functions - if someone has written it out, it is fairly logical how you need to set up the same thing in ActionScript.&lt;br /&gt;&lt;br /&gt;The moon phases are based on the mean moon phase duration as reported by NASA from the year 2000 (so it won't be perfect forever, but pretty good for this purpose).&lt;br /&gt;&lt;br /&gt;So, my particular thanks go to Meeus, Utrecht University and&amp;nbsp;NASA for helping me with the bit I could never work out on my own without some serious long term astronomical observations of my own. The practical upshot is a Flash based clock application that not only shows the passage of time from&amp;nbsp;seconds to seasons, but also one that can predict Easter, the equinoxes and solstices, and understands that moon phases are not precisely 28 days long. Thanks folks.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Free Download&lt;/strong&gt; &lt;br /&gt;&amp;nbsp; &lt;br /&gt;Feel free to visit the application page and &lt;a href="http://www.digitalarena.co.uk/teach/annual_clock/index.htm"&gt;download the v0.9 release as a screensaver&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-8031413420292601375?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/8031413420292601375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2011/03/annual-clock-flash-app.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/8031413420292601375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/8031413420292601375'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2011/03/annual-clock-flash-app.html' title='Annual Clock Flash App'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-341605186764013097</id><published>2011-02-03T10:20:00.002Z</published><updated>2011-03-21T21:24:32.954Z</updated><title type='text'>Sliding Image Viewer in Flash</title><content type='html'>&lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" height="307" width="430"&gt;   &lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/sliderselector.swf"&gt;  &lt;param name=quality value=high&gt;  &lt;embed src="http://www.digitalarena.co.uk/diblog/sliderselector.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="430" height="307"&gt;&lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;You may have come across flash menus where you drag a selector over a row of small images which slides a larger row of the same images into view. This code example is a basic solution to that problem.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Method&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. First produce all your images. You need a large version and a thumbnail version of each. Then import them into Flash.&lt;br /&gt;&lt;br /&gt;2. Place your thumbnail images in a row on the stage. Make sure the &lt;strong&gt;centres&lt;/strong&gt; of the images are equally spaced. Then select them all, and press &lt;strong&gt;F8&lt;/strong&gt; to convert them into a MovieClip.&lt;br /&gt;&lt;br /&gt;3. Place your larger image in a row on the stage above the thumbnails, in the same sequence as the thumbnails. Make sure the centres of the images are equally spaced. Then select them all, and press F8 to convert them into a MovieClip. Give the MovieClip the instance name &lt;strong&gt;&lt;em&gt;items_mc&lt;/em&gt;&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;4. Create a draggable selector. Mine has a transparent fill so that I can click on it anywhere, but still see through it. Convert it into a MovieClip called &lt;strong&gt;&lt;em&gt;slider_mc&lt;/em&gt;&lt;/strong&gt;. Place it over the &lt;strong&gt;centre&lt;/strong&gt; of the first thumbnail in the row.&lt;br /&gt;&lt;br /&gt;5. Find out the distance in pixels between the &lt;strong&gt;centre&lt;/strong&gt; of the first large image and the &lt;strong&gt;centre&lt;/strong&gt; of the last large image. This will be used for the variable &lt;strong&gt;itemwidth&lt;/strong&gt; in the ActionScript.&lt;br /&gt;&lt;br /&gt;6. Find out the coordinate of the &lt;strong&gt;centre&lt;/strong&gt; of the first thumbnail. This will be used for the variable &lt;strong&gt;sliderleft&lt;/strong&gt; in the ActionScript.&lt;br /&gt;&lt;br /&gt;7. Find out the coordinate of the &lt;strong&gt;centre&lt;/strong&gt; of the&amp;nbsp;last thumbnail. This will be used for the variable &lt;strong&gt;sliderright&lt;/strong&gt; in the ActionScript.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And that is all your preparation done.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Code&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Insert the following code in the first keyframe of your movie. Then replace the values of the &lt;strong&gt;itemwidth, sliderleft &lt;/strong&gt;and &lt;strong&gt;sliderright&lt;/strong&gt; variables with the values you worked out in steps 5-7 above.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/*This whole mechanism assumes that the CENTRES of all items are equally spaced.*/&lt;br /&gt;/*starting x coordinate of the CENTRE of the first item in the row*/&lt;br /&gt;var itemstart = _root.items_mc._x;&lt;br /&gt;/*Item width is the distance between the CENTRE of the first item in the row and the CENTRE of the last item in the row*/&lt;br /&gt;var itemwidth = 1920;&lt;br /&gt;/*this time I use the difference between coordinates of the CENTRE of the first and last items to determine the width*/&lt;br /&gt;var sliderleft = 40;&lt;br /&gt;var sliderright = 520;&lt;br /&gt;var sliderwidth = sliderright-sliderleft;&lt;br /&gt;/*slider*/&lt;br /&gt;/*Allows us to drag the slider in a straight line between 2 fixed coordinates when the mouse button is clicked on it*/&lt;br /&gt;_root.slider_mc.onPress = function () {&lt;br /&gt;this.startDrag(false, sliderleft, 340, sliderright, 340);&lt;br /&gt;}&lt;br /&gt;/*stop drag when we let go*/&lt;br /&gt;_root.slider_mc.onRelease = function () {&lt;br /&gt;stopDrag();&lt;br /&gt;}&lt;br /&gt;/*stop drag when we let go if we happen to be outside the boundaries of the flash movie*/&lt;br /&gt;_root.slider_mc.onReleaseOutside = function () {&lt;br /&gt;stopDrag();&lt;br /&gt;}&lt;br /&gt;/*repositions the items_mc depending on how far we have dragged the slider is based on a ratio of how far the slider has been dragged along the available length. 0 means the slider is at the start, 1 means it is at the end, 0.5 would mean it is in the middle*/&lt;br /&gt;onEnterFrame = function () {&lt;br /&gt;sliderratio = (_root.slider_mc._x - sliderleft)/sliderwidth;&lt;br /&gt;_root.items_mc._x = itemstart - (itemwidth*sliderratio);&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;When you are done, press CTRL+ENTER to test. You should be able to bring any of the larger images into view by dragging the slider over the thumbnail version of the same image.&lt;br /&gt;&lt;br /&gt;And that's a wrap.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-341605186764013097?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/341605186764013097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2011/02/sliding-image-viewer-in-flash.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/341605186764013097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/341605186764013097'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2011/02/sliding-image-viewer-in-flash.html' title='Sliding Image Viewer in Flash'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6944431694134607394</id><published>2010-08-26T12:45:00.001+01:00</published><updated>2010-08-26T12:54:59.238+01:00</updated><title type='text'>Link Flash Buttons to Web Pages</title><content type='html'>This is simple stuff compared to doodling apps and platform games, but no less vital if that's what the job requires. Here I give a brief intro to making Flash link to external URLs.&lt;br /&gt;&lt;br /&gt;We can often think of Flash as creating standalone apps that talk only internally, but sometimes there is a need for your Flash work to link to external web pages, either because you are making a Flash menu for a website, or because you want your Flash based CD ROM interface to link to your website.&lt;br /&gt;&lt;br /&gt;Whatever the reason, it's really simple.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Example&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In this example I have 2 simple buttons that link to other websites. &lt;br /&gt;&lt;br /&gt;&lt;object align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0" height="180" width="250"&gt; &lt;param name="allowFullScreen" value="true"&gt;&lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/buttons1.swf"&gt;&lt;param name="bgcolor" value="#333333"&gt;&lt;embed src="http://www.digitalarena.co.uk/diblog/buttons1.swf" allowfullscreen="true" bgcolor="#333333" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" width="250" height="180"&gt;&lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Make some buttons&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In this example I have a simple button symbol in the Library. I drag 2 instances of the button onto the stage and give each the following instance names: "google_btn" and "bbc_btn".&lt;br /&gt;&lt;br /&gt;&lt;b&gt; &lt;/b&gt;&lt;br /&gt;&lt;b&gt; &lt;/b&gt;Then I add the following ActionScript.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Code&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This ActionScript is added to the first keyframe on the root timeline:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;_root.bbc_btn.onPress = function () {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;getURL("http://www.bbc.co.uk/","&lt;/code&gt;&lt;code&gt;_blank&lt;/code&gt;&lt;code&gt;");&lt;br /&gt;}&lt;br /&gt;_root.google_btn.onPress = function () {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;getURL("http://www.google.co.uk/","_blank");&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How does it work?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Nothing could be simpler. We use a simple onPress event handler, so as soon as the button is pressed the action happens. The action is very easy to follow - we are using getURL and then specifying the URL and the target window.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;getURL("http://URL_GOES_HERE","_TARGET_WINDOW_HERE");&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And that's a wrap.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6944431694134607394?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6944431694134607394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/link-flash-buttons-to-web-pages.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6944431694134607394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6944431694134607394'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/link-flash-buttons-to-web-pages.html' title='Link Flash Buttons to Web Pages'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-5771568883150164322</id><published>2010-08-25T00:17:00.002+01:00</published><updated>2010-08-26T11:53:51.743+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='platform'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>Simple Platform Game Engine in Flash</title><content type='html'>This year my students will be learning about game engines. For 3D they will most likely use the Unreal Development Kit, along with 3DS Max/Carrara 8 Pro for content creation. But that's all 3D - what about the 2D games? Well, for 2D, my platform of choice is Flash.&lt;br /&gt;&lt;br /&gt;Problem is, that unlike the UDK, or Unity, or even the FPSC, Flash is not a game engine - and that means, not only creating and scripting content for 2D games, but also scripting the whole engine.&lt;br /&gt;&lt;br /&gt;It's something I have been meaning to do for a while. And while I know that many talented developers have posted Platform game solutions online, there is something about working through the problem yourself that I really like. Besides, I don't always get on well with other people's code - and if I am to teach my students to code their own, I need a solution I have worked out so I know it inside out and backwards and can really explain it to them.&lt;br /&gt;&lt;br /&gt;Many of you will want the code now, but I am still fine tuning it. Meanwhile, here is version 4d as a peep of how it is going so far (I am currently on version 4f).&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Controls: &lt;br /&gt;JetPack = SPACE&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Left = LEFT ARROW&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Right = RIGHT ARROW&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Climb Ladder = UP/DOWN ARROW&lt;/i&gt;&lt;i&gt; &lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;object align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0" height="300" width="450"&gt; &lt;param name="allowFullScreen" value="true"&gt;&lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/dansplatform4d.swf"&gt;&lt;param name="bgcolor" value="#333333"&gt;&lt;embed src="http://www.digitalarena.co.uk/diblog/dansplatform4d.swf" allowfullscreen="true" bgcolor="#333333" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" width="450" height="300"&gt;&lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;When it is finished I will post the code and an explanation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-5771568883150164322?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/5771568883150164322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/simple-platform-game-engine-in-flash.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5771568883150164322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5771568883150164322'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/simple-platform-game-engine-in-flash.html' title='Simple Platform Game Engine in Flash'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-39789400964773699</id><published>2010-08-20T20:45:00.011+01:00</published><updated>2010-08-26T12:12:42.806+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sound'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Controlling Sounds</title><content type='html'>The basic way of including sound in your Flash movies is to add them to keyframes in the timeline. And this is fine for sounds that must coincide with animated events, or simple audio feedback on button rollovers. But if you want more sophisticated control over sounds, like starting and stopping them individually, or changing their volume, then you need to use ActionScript.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Preparing sound for ActionScript control&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In Flash you can either load an external sound, or you can export sounds in your document Library for ActionScript. If you want to learn more about loading external sounds read my post on making an MP3 player in Flash. In this post I am going to just look at exporting sounds from the Library. &lt;br /&gt;&lt;br /&gt;First off then you need to import all the sounds you need into your document Library of your .fla file. To do this click &lt;i&gt;File &amp;gt; Import &amp;gt; Import to Library&lt;/i&gt;. Then browse for the sound file you need and click "OK". The sound will be imported into your Library. If you can't see your Library click &lt;i&gt;CTRL+L (Cmd+L on the Mac).&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Repeat this import step as often as you need to for every sound you need to appear in the Library.&lt;br /&gt;&lt;br /&gt;Once they are imported you need to change their &lt;i&gt;linkage&lt;/i&gt; settings to you can access the sounds with ActionScript. To do this &lt;i&gt;right-click&lt;/i&gt; one of the sounds in the Library and choose &lt;i&gt;linkage&lt;/i&gt;. When the &lt;i&gt;Linkage Properties&lt;/i&gt; box opens tick the &lt;i&gt;Export for ActionScript&lt;/i&gt; option, the &lt;i&gt;Export in first frame&lt;/i&gt; will automatically be selected, this is fine. Then you&amp;nbsp;need to give the sound an &lt;i&gt;Identifier&lt;/i&gt;. By default the &lt;i&gt;Identifier&lt;/i&gt; will be the same as the sound's original filename, but I find it helpful to give it an &lt;i&gt;Identifier&lt;/i&gt; that makes it easy to remember what it is e.g. "backgroundmusic" or "whizzysound". Once you have given it a new &lt;i&gt;Identifier&lt;/i&gt; you can click the "OK" button.&lt;br /&gt;&lt;br /&gt;Repeat this step for every sound in the Library that you want to control with ActionScript.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Controlling sound with ActionScript&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;All this code should be added to the first frame of your Flash movie. I like to create a separate layer called "Actions" just for the code to keep it separate from other layers and so I know where all my code is when I want to edit it.&lt;br /&gt;&lt;br /&gt;So far you have set some sounds in the Library to export for use with ActionScript and given those sounds Identifiers. Now we write the code to make use of those sounds.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;Creating a sounds object and attaching a sound&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;First&amp;nbsp;you create a sound object for each of the sounds you want to use, and then attach those library sounds to the objects. In this example let's pretend we have just one sound in the library with the identifier "backgroundloopsound". Here's how you create the sound object, and then attach "backgroundloopsound":&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* create a sound object */&lt;br /&gt;var sound1_snd:Sound = new Sound(&lt;span style="color: blue;"&gt;sound1_mc&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;/* attach a sound from the library to the sound object */&lt;br /&gt;sound1_snd.attachSound("backgroundloopsound");&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In the above code I have created a sound object called "sound1_snd". &lt;u&gt;I have given the object a target of &lt;i&gt;&lt;span style="color: blue;"&gt;sound1_mc&lt;/span&gt; &lt;/i&gt;which will allow me to control the sound independent of other sounds - but for this to work I must also add an empty MovieClip to the stage called "sound1_mc". I do this by creating a new MovieClip symbol in the library with nothing in it. Then I drag this symbol to the stage and give it the instance name "sound1_mc".&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;Then I have used "attachSound" to attach "backgroundloopsound".&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;Controlling the sound through the sound object&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Now that we have a sound object with a sound attached, we can control the sound by controlling the object. Here are some examples.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;Starting Sound&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* to make it play automatically, just put it in your code near the top */&lt;br /&gt;sound1_snd.start(0, 100);&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In the code above, the first 0 in the parenthesis means that the sound should be started at the beginning. If you have a 20 second sound, and you want to start it from 10 seconds in, then you should write &lt;i&gt;sound1_snd.start(10, 100)&lt;/i&gt;. The 100 in the parenthesis tells Flash how many times to loop the sound, when setting this, think about how long someone might stay on the scene and make sure you have enough loops or the sound will stop before they leave.&lt;br /&gt;&lt;br /&gt;The previous start sound code starts the sound as soon as the frame loads in the flash movie. If you only want a sound to start when the user clicks a button, you need to first make the button and give it an instance name such as &lt;i&gt;startSoundButton_btn&lt;/i&gt;, and you need to surround it by an event handler such as onPress:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;_root.startSoundButton_btn.onPress = function () {&lt;br /&gt;sound1_snd.start(0, 100);&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;Other ways of controlling sound&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;You can stop the sound:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;sound1_snd.stop();&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You can change the volume of the sound:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* 0 = no volume, 100 = full volume, 50 = half volume etc... */&lt;br /&gt;sound1_snd.setVolume(50);&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you want any of these to work when the user clicks a button, once again, you need to make a button and an event handler.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Here's an example&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;object align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0" height="300" width="300"&gt; &lt;param name="allowFullScreen" value="true"&gt;&lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/soundcontrol1.swf"&gt;&lt;param name="bgcolor" value="#333333"&gt;&lt;embed src="http://www.digitalarena.co.uk/diblog/soundcontrol1.swf" allowfullscreen="true" bgcolor="#333333" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" width="300" height="300"&gt;&lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;For this example I have 2 sounds in the library, one is a recording of me saying the word 'background" once. The other is a recording of me saying the word 'button' once. These were saved as WAVs and imported into the stage.&lt;br /&gt;&lt;br /&gt;Then I &lt;i&gt;right-clicked&lt;/i&gt; the 'background' WAV in the Library and chose "Linkage" and I set it to &lt;i&gt;export for actionscript&lt;/i&gt; and gave it the handler "backgroundsound".&lt;br /&gt;&lt;br /&gt;Then I &lt;i&gt;right-clicked&lt;/i&gt; the 'button' WAV in the Library and  chose "Linkage" and I set it to &lt;i&gt;export for actionscript&lt;/i&gt; and gave  it the handler "buttonsound".&lt;br /&gt;&lt;br /&gt;Then I made an empty MovieClip by creating a new MovieClip symbol in the Library with nothing in it.&lt;br /&gt;&lt;br /&gt;Then I dragged an instance of the empty MovieClip onto the stage and gave it the instance name "bgsound_mc".&lt;br /&gt;&lt;br /&gt;Then I dragged another instance of the empty MovieClip onto the stage and  gave it the instance name "buttonsound_mc".&lt;br /&gt;&lt;br /&gt;Then I made a button symbol in the Library and dragged 4 instances onto the stage. The buttons were given the instance names: "button_btn", "bgmute_btn", "allmute_btn" and "unmute_btn".&lt;br /&gt;&lt;br /&gt;I then added static text by each button to remind me which was which.&lt;br /&gt;&lt;br /&gt;Once all that was done it was time to add the code.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* create a sound object for the background sound */&lt;br /&gt;var background_snd:Sound = new Sound (bgsound_mc);&lt;br /&gt;/* attach a sound from the library to the sound object */&lt;br /&gt;background_snd.attachSound ("backgroundsound");&lt;br /&gt;/* create a sound object for the button sound */&lt;br /&gt;var button_snd:Sound = new Sound (buttonsound_mc);&lt;br /&gt;/* attach a sound from the library to the sound object */&lt;br /&gt;button_snd.attachSound ("buttonsound");&lt;br /&gt;/* start the background sound loop and set it to mute as default */&lt;br /&gt;background_snd.start (0, 1000000);&lt;br /&gt;background_snd.setVolume (0);&lt;br /&gt;/* set the button sound to play on button roll-over */&lt;br /&gt;_root.button_btn.onRollOver = function () {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; button_snd.start (0, 1);&lt;br /&gt;};&lt;br /&gt;/* making the mute background button work */&lt;br /&gt;_root.bgmute_btn.onPress = function () {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; background_snd.setVolume (0);&lt;br /&gt;};&lt;br /&gt;/* making the mute every sound button work */&lt;br /&gt;_root.allmute_btn.onPress = function () {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; background_snd.setVolume (0);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; button_snd.setVolume (0);&lt;br /&gt;};&lt;br /&gt;/* making the un-mute button work */&lt;br /&gt;_root.unmute_btn.onPress = function () {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; background_snd.setVolume (100);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; button_snd.setVolume (100);&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;That's it&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;That's the basics. You can of course use different event handlers such as onRollOver, onRollOut, onDragOver to trigger the sounds or change their volume. You can of course use event handlers to trigger more than one sound, or more than one action, you might start one sound while changing the volume of another at the same time for instance.&lt;br /&gt;&lt;br /&gt;It's up to you to be creative, now you know the basics.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-39789400964773699?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/39789400964773699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/controlling-sounds.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/39789400964773699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/39789400964773699'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/controlling-sounds.html' title='Controlling Sounds'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-5848988661135515265</id><published>2010-08-19T17:04:00.004+01:00</published><updated>2010-08-25T00:16:11.689+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sliding'/><category scheme='http://www.blogger.com/atom/ns#' term='interactive media'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Slider Input With a Difference</title><content type='html'>Slider or sliding inputs for user interfaces are not new, we get them in desktop software and on the web. But this one is slightly different. Instead of sliding the handle along a bar, the handle stays still and the bar moves. This is helpful when the bar contains measurements that are too big to fit on the screen.&lt;br /&gt;&lt;br /&gt;In this example we are pretending to measure height. Just click and drag the pointer to measure.&lt;br /&gt;&lt;br /&gt;&lt;object align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0" height="266" width="366"&gt; &lt;param name="allowFullScreen" value="true"&gt;&lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/rulerslider.swf"&gt;&lt;param name="bgcolor" value="#333333"&gt;&lt;embed src="http://www.digitalarena.co.uk/diblog/rulerslider.swf" allowfullscreen="true" bgcolor="#333333" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" width="366" height="266"&gt;&lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;As you can see the code that prevents the ruler dropping off the end is a bit clunky, but it will do for now.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to make it&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Make a MovieClip of a ruler, with the scale spaced evenly along its entire length - set the registration point to be the bottom-left of the MovieClip. Then make another MovieClip for the ruler pointer - set the registration point to be the bottom-left of the MovieClip too.&lt;br /&gt;&lt;br /&gt;Place both MovieClips onto the stage and scale them so that the fit together nicely, but also so the ruler is much much longer than the stage is high.&lt;br /&gt;&lt;br /&gt;Give the ruler the instance name 'ruler_mc' and the pointer the instance name 'pointer_mc'.&lt;br /&gt;&lt;br /&gt;Then insert the following code onto the first frame of the movie.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The code&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The comments will give you some idea of what does what:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var damping:Number = 20;&lt;br /&gt;/*the higher the number the slower the ruler will move*/&lt;br /&gt;var rulerdivisions:Number = 20;&lt;br /&gt;/*this helps us work out the how far the along the ruler you are*/&lt;br /&gt;/*make the rule move when the pointer is dragged on*/&lt;br /&gt;moveruler = function () {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (_root.ruler_mc._y &amp;gt;= _root.pointer_mc._y &amp;amp;&amp;amp; (_root.ruler_mc._y - _root.ruler_mc._height) &amp;lt;= _root.pointer_mc._y) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;movefactor = (clickstart - _ymouse) / damping;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;_root.ruler_mc._y += movefactor;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;} else if (_root.ruler_mc._y &amp;lt;= _root.pointer_mc._y) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;_root.ruler_mc._y = _root.pointer_mc._y;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;} else if (_root.ruler_mc._y - _root.ruler_mc._height) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;_root.ruler_mc._y = (_root.pointer_mc._y + _root.ruler_mc._height);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;measure = Math.floor ((_root.ruler_mc._y - _root.pointer_mc._y) / (_root.ruler_mc._height / rulerdivisions));&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;measure_txt.text = measure+" cm";&lt;br /&gt;};&lt;br /&gt;/*check when the pointer is dragged*/&lt;br /&gt;_root.pointer_mc.onPress = function () {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;clickstart = _ymouse;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;moveRulerInterval = setInterval (moveruler, 15);&lt;br /&gt;};&lt;br /&gt;/*check when the dragging stops*/&lt;br /&gt;_root.pointer_mc.onRelease = function () {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;clearInterval (moveRulerInterval);&lt;br /&gt;};&lt;br /&gt;_root.pointer_mc.onReleaseOutside = function () {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;clearInterval (moveRulerInterval);&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And that's all there is to it. If you have a neater way of stopping the ruler from dropping off either end, feel free to post your solution as a comment.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Making it useful&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you&lt;b&gt; &lt;/b&gt;want to use the input of this interface for something useful, perhaps to base other calculations on it, simply use the 'measure' variable within your formula, to represent the user's input.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-5848988661135515265?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/5848988661135515265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/sliding-input-with-difference.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5848988661135515265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5848988661135515265'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/sliding-input-with-difference.html' title='Slider Input With a Difference'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6265468293929669547</id><published>2010-08-05T00:38:00.002+01:00</published><updated>2010-08-19T16:56:55.896+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='application'/><category scheme='http://www.blogger.com/atom/ns#' term='draw'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='doodle'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Doodling Program in Flash AS2</title><content type='html'>Inspired by Dragon's Den this week, when 2 guys demonstrated a fun drawing program they had made, I decided to learn some more about Flash's drawing API to make a very much simpler doodling application in Flash.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Try It&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;object align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0" height="266" width="366"&gt; &lt;param name="allowFullScreen" value="true"&gt;&lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/virtualpaper 2c.swf"&gt;&lt;param name="bgcolor" value="#333333"&gt;&lt;embed src="http://www.digitalarena.co.uk/diblog/virtualpaper 2c.swf" allowfullscreen="true" bgcolor="#333333" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" width="366" height="266"&gt;&lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;It might look complex, but the hardest bit is only 26 lines of ActionScript, including comments. What makes me laugh the most, is that the whole application comes out as less than 2Kb.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Code&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;It's getting late in my time zone, so I won't dissect the code in this post. But enjoy the code, and I'll explain it another time:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//Code from http://dansinteractive.blogspot.com&lt;br /&gt;//default settings&lt;br /&gt;var layernum = 0;&lt;br /&gt;var curcolour:String = "0x000000";&lt;br /&gt;var curlineweight = 5;&lt;br /&gt;//draw the line&lt;br /&gt;drawline = function () {&lt;br /&gt;["layer"+layernum+"_mc"]lineStyle(curlineweight, curcolour, 100);&lt;br /&gt;["layer"+layernum+"_mc"]lineTo(_xmouse, _ymouse);&lt;br /&gt;};&lt;br /&gt;//start drawing on mouse press&lt;br /&gt;_root.paper_mc.onPress = function() {&lt;br /&gt;layernum += 1;&lt;br /&gt;startx = _xmouse;&lt;br /&gt;starty = _ymouse;&lt;br /&gt;createEmptyMovieClip("layer"+layernum+"_mc", this.getNextHighestDepth());&lt;br /&gt;["layer"+layernum+"_mc"]moveTo(startx, starty);&lt;br /&gt;drawlineInterval = setInterval(drawline, 10);&lt;br /&gt;};&lt;br /&gt;//stop drawing on mouse release&lt;br /&gt;_root.paper_mc.onRelease = function() {&lt;br /&gt;clearInterval(drawlineInterval);&lt;br /&gt;}&lt;br /&gt;_root.paper_mc.onReleaseOutside = function() {&lt;br /&gt;clearInterval(drawlineInterval);&lt;br /&gt;}&lt;br /&gt;//colour selector&lt;br /&gt;_root.black_mc.onPress = function () {&lt;br /&gt;curcolour = "0x000000";&lt;br /&gt;}&lt;br /&gt;_root.blue_mc.onPress = function () {&lt;br /&gt;curcolour = "0x0000FF";&lt;br /&gt;}&lt;br /&gt;_root.cyan_mc.onPress = function () {&lt;br /&gt;curcolour = "0x00FFFF";&lt;br /&gt;}&lt;br /&gt;_root.green_mc.onPress = function () {&lt;br /&gt;curcolour = "0x00FF00";&lt;br /&gt;}&lt;br /&gt;_root.magenta_mc.onPress = function () {&lt;br /&gt;curcolour = "0xFF00FF";&lt;br /&gt;}&lt;br /&gt;_root.red_mc.onPress = function () {&lt;br /&gt;curcolour = "0xFF0000";&lt;br /&gt;}&lt;br /&gt;_root.white_mc.onPress = function () {&lt;br /&gt;curcolour = "0xFFFFFF";&lt;br /&gt;}&lt;br /&gt;_root.yellow_mc.onPress = function () {&lt;br /&gt;curcolour = "0xFFFF00";&lt;br /&gt;}&lt;br /&gt;//line thickness selector&lt;br /&gt;_root.line1_mc.onPress = function () {&lt;br /&gt;curlineweight = 1;&lt;br /&gt;}&lt;br /&gt;_root.line3_mc.onPress = function () {&lt;br /&gt;curlineweight = 3;&lt;br /&gt;}&lt;br /&gt;_root.line5_mc.onPress = function () {&lt;br /&gt;curlineweight = 5;&lt;br /&gt;}&lt;br /&gt;_root.line10_mc.onPress = function () {&lt;br /&gt;curlineweight = 10;&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Happy doodling.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6265468293929669547?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6265468293929669547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/doodling-program-in-flash-as2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6265468293929669547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6265468293929669547'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/doodling-program-in-flash-as2.html' title='Doodling Program in Flash AS2'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-5602060887705337507</id><published>2010-08-02T23:42:00.003+01:00</published><updated>2010-08-05T00:26:47.309+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rotation'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='rotate'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Simpler Click and Drag Rotation in Flash AS2</title><content type='html'>Although this is more lines of code, the code is easier to follow.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://dansinteractive.blogspot.com/2010/08/click-and-drag-rotation-in-flash-as2.html"&gt;last example&lt;/a&gt; used trigonometry to calculate the angle of rotation and gave a realistic simulation of dragging an object in a circle. This is much more basic, and sets the rotation of the object based on a horizontal drag only.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Script&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* sets the starting point for the maths that follows */&lt;br /&gt;var objectnewdeg = 0;&lt;br /&gt;var objectdeg = 0;&lt;br /&gt;var mindeg = 0;&lt;br /&gt;var maxdeg = 300;&lt;br /&gt;/* this function rotates the object live as the user drags */&lt;br /&gt;rotateobject = function () {&lt;br /&gt;/* this checks whether the user is rotating within the max and min rotation factors defined in the variables above, it only allows rotation if it is within the set limits, otherwise the object won't move */&lt;br /&gt;if (objectnewdeg&amp;gt;=mindeg &amp;amp;&amp;amp; objectnewdeg&amp;lt;=maxdeg) { &lt;br /&gt;curpoint = _xmouse; &lt;br /&gt;objectnewdeg = objectdeg+(curpoint-objectstartdeg); &lt;br /&gt;_root.object_mc._rotation = objectnewdeg; &lt;br /&gt;} &lt;br /&gt;};&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;/* This starts the object rotation function and sets the starting point of the user's click - all rotation is then based on the difference between where the user first clicks and where they drag to */&lt;br /&gt;_root.object_mc.onPress = function() { &lt;br /&gt;objectstartdeg = _xmouse; &lt;br /&gt;objectrotInterval = setInterval(rotateobject, 10); &lt;br /&gt;};&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;/* This stops the rotation as soon as the user let's go. It also checks that the user has not been able to drag further than the min or max limits before the code could correct them, and if they have, adjusts the rotation to fit within the limit boundaries */&lt;br /&gt;_root.object_mc.onRelease = function() { &lt;br /&gt;clearInterval(objectrotInterval); &lt;br /&gt;if (objectnewdeg&lt;mindeg) (objectnewdeg="" _root.object_mc._rotation="mindeg;" if="" objectnewdeg="mindeg;" {="" }=""&gt;maxdeg) {&lt;br /&gt;_root.object_mc._rotation=maxdeg;&lt;br /&gt;objectnewdeg = maxdeg;&lt;br /&gt;}&lt;br /&gt;objectdeg = objectnewdeg;&lt;br /&gt;};&lt;/mindeg)&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;mindeg) (objectnewdeg="" _root.object_mc._rotation="mindeg;" if="" objectnewdeg="mindeg;" {="" }=""&gt;/* This is the same as the function above, but executes if the user has drifted off the object when they stop dragging */&lt;br /&gt;_root.object_mc.onReleaseOutside = function() {&lt;br /&gt;clearInterval(objectrotInterval);&lt;br /&gt;if (objectnewdeg&lt;mindeg) (objectnewdeg="" _root.object_mc._rotation="mindeg;" if="" objectnewdeg="mindeg;" {="" }=""&gt;maxdeg) {&lt;br /&gt;_root.object_mc._rotation=maxdeg;&lt;br /&gt;objectnewdeg = maxdeg;&lt;br /&gt;}&lt;br /&gt;objectdeg = objectnewdeg;&lt;br /&gt;};&lt;br /&gt;&lt;/mindeg)&gt;&lt;/mindeg)&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;While this code may have more lines, it's much simpler to follow. In addition it also allows you to set a maximum and minimum rotation factor, so you can set how far you want the user to be allowed to rotate the object in either direction.&lt;br /&gt;&lt;br /&gt;To use it, simply paste it into frame 1, and create and &lt;i&gt;MovieClip&lt;/i&gt; on the stage with the instance name 'object_mc'. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Try It&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;object align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0" height="266" width="366"&gt; &lt;param name="allowFullScreen" value="true"&gt; &lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/simpledragrotate.swf"&gt; &lt;param name="bgcolor" value="#333333"&gt; &lt;embed src="http://www.digitalarena.co.uk/diblog/simpledragrotate.swf" allowfullscreen="true" bgcolor="#333333" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" width="366" height="266"&gt;&lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Making it Useful&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Let's say you wanted to use this to make a user input for a program. The user rotates the object (say a dial or a volume knob) and you want to use the numerical value of the object's rotation for something. Nothing could be simpler.&lt;br /&gt;&lt;br /&gt;If you want the numerical value only once the user has stopped dragging then base your program on the variable &lt;i&gt;objectdeg&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;If you want the numerical value to constantly update as the user drags, then base your program on the variable &lt;i&gt;objectnewdeg&lt;/i&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-5602060887705337507?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/5602060887705337507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/simpler-drag-rotation-in-flash-as2.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5602060887705337507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5602060887705337507'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/simpler-drag-rotation-in-flash-as2.html' title='Simpler Click and Drag Rotation in Flash AS2'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-2182080440718725843</id><published>2010-08-02T22:59:00.001+01:00</published><updated>2010-08-05T00:27:42.911+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='drag'/><category scheme='http://www.blogger.com/atom/ns#' term='rotation'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='rotate'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Click and drag rotation in Flash AS2</title><content type='html'>In Flash I often find that some things which seem hard, are easy, and some things which ought to be easy are hard. Making things rotate when you click and drag them is, for me, one of the latter. It doesn't take much code, but figuring the code out hurt my brain.&lt;br /&gt;&lt;br /&gt;You'd think this would be easier - you'd think there would be a class already in existence for this. But as there isn't here's an ActionScript 2 solution.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Script With Comments&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;The comments explain how it works:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/*sets starting points for the maths that comes later*/&lt;br /&gt;var objectnewdeg = 0;&lt;br /&gt;var objectdeg = 0;&lt;br /&gt;/* This is the Rotate Object function, it updates the rotation of the object continuously as the user drags */&lt;br /&gt;rotateobject = function () {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;curpoint = (Math.atan2(_root._ymouse-_root.object_mc._y, _root._xmouse-_root.object_mc._x)/Math.PI)*180;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;objectnewdeg = objectdeg+(curpoint-objectstartdeg);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;_root.object_mc._rotation = objectnewdeg;&lt;br /&gt;};&lt;br /&gt;/* This initiates the &lt;/code&gt;&lt;code&gt;Rotate Object function&lt;/code&gt;&lt;code&gt; when the user clicks on the object */&lt;br /&gt;_root.object_mc.onPress = function() {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* This finds the position around the object that is first clicked in degrees and sets it as a variable that is used in the function above */&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;objectstartdeg = (Math.atan2(_root._ymouse-_root.object_mc._y, _root._xmouse-_root.object_mc._x)/Math.PI)*180;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* starts the function above and sets the repeat frequency as 10 */&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;objectrotInterval = setInterval(rotateobject, 10);&lt;br /&gt;};&lt;br /&gt;/* This stops the &lt;/code&gt;&lt;code&gt;Rotate Object function&lt;/code&gt;&lt;code&gt; when the user releases the object, so it stays where the user left it, then records the new rotation of the object as objectdeg ready for when it is rotated again. */&lt;br /&gt;_root.object_mc.onRelease = function() {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* stops the function above */&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;clearInterval(objectrotInterval);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/*records the new rotation of the object as set by the user's drag as variable objectdeg, ready for next time they drag */&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;objectdeg = objectnewdeg;&lt;br /&gt;};&lt;br /&gt;/* This is almost a repeat of the release code above, but takes account of the fact the user might drift off the object when they drag it, hence onReleaseOutside. */&lt;br /&gt;_root.object_mc.onReleaseOutside = function() {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* stops the function above */&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;clearInterval(objectrotInterval);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* records the new rotation of the object as set by the user's drag as variable objectdeg, ready for next time they drag */&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;objectdeg = objectnewdeg;&lt;br /&gt;};&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Script Without Comments&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;And if that code above looks scary, it's not so bad without comments - only 19 lines.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var objectnewdeg = 0;&lt;br /&gt;var objectdeg = 0;&lt;br /&gt;rotateobject = function () {&lt;br /&gt;curpoint = (Math.atan2(_root._ymouse-_root.object_mc._y, _root._xmouse-_root.object_mc._x)/Math.PI)*180;&lt;br /&gt;objectnewdeg = objectdeg+(curpoint-objectstartdeg);&lt;br /&gt;_root.object_mc._rotation = objectnewdeg;&lt;br /&gt;};&lt;br /&gt;_root.object_mc.onPress = function() {&lt;br /&gt;objectstartdeg = (Math.atan2(_root._ymouse-_root.object_mc._y, _root._xmouse-_root.object_mc._x)/Math.PI)*180;&lt;br /&gt;objectrotInterval = setInterval(rotateobject, 10);&lt;br /&gt;};&lt;br /&gt;_root.object_mc.onRelease = function() {&lt;br /&gt;clearInterval(objectrotInterval);&lt;br /&gt;objectdeg = objectnewdeg;&lt;br /&gt;};&lt;br /&gt;_root.object_mc.onReleaseOutside = function() {&lt;br /&gt;clearInterval(objectrotInterval);&lt;br /&gt;objectdeg = objectnewdeg;&lt;br /&gt;};&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Copy and paste the code into the first frame. Then place a &lt;i&gt;MovieClip&lt;/i&gt; on the stage and give it the instance name 'object_mc'. &lt;br /&gt;&lt;br /&gt;Test the movie and you should be able to click the object anywhere and drag it to rotate it.&lt;br /&gt;&lt;br /&gt;The centre of rotation is the &lt;i&gt;Registration point&lt;/i&gt; that you set when you made the object into a &lt;i&gt;MovieClip&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;If you want to re-use the code yourself, just replace every instance of the name &lt;i&gt;object_mc&lt;/i&gt; with the instance name of your object. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Try It&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;object align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0" height="266" width="366"&gt; &lt;param name="allowFullScreen" value="true"&gt; &lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/rotateobjectwithdrag.swf"&gt; &lt;param name="bgcolor" value="#333333"&gt; &lt;embed src="http://www.digitalarena.co.uk/diblog/rotateobjectwithdrag.swf" allowfullscreen="true" bgcolor="#333333" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" width="366" height="266"&gt;&lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Applying it to something useful&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I originally developed this for use with my &lt;a href="http://www.digitalarena.co.uk/teach/virtual_compass/index.htm"&gt;VirtualCompass teaching aid&lt;/a&gt;.&amp;nbsp;&lt;b&gt; &lt;/b&gt;This uses drag rotation to allow the user to position several different elements on the screen.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-2182080440718725843?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/2182080440718725843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/click-and-drag-rotation-in-flash-as2.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/2182080440718725843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/2182080440718725843'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/click-and-drag-rotation-in-flash-as2.html' title='Click and drag rotation in Flash AS2'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-5883228598940741110</id><published>2010-08-02T14:43:00.002+01:00</published><updated>2010-08-02T14:49:29.942+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='designer'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='ivan chermayeff'/><title type='text'>Design: Another Reconsideration - Ivan Chermayeff, 1969</title><content type='html'>When, as a young college design student,&amp;nbsp;I discovered the existence of &lt;a href="http://www.aiga.org/content.cfm/medalist-ivanchermayeffandtomgeismar"&gt;Ivan Chermayeff&lt;/a&gt; I felt I had found the one professional graphic designer that really understood the purpose and role of his vocation. His approach resonated with me as being honest, open and direct - and as such was a refreshing change from what can seem to be a rat race of&amp;nbsp;mimicking styles and trends at speed without pause for genuineness or genius. Chermayeff's own philosophy has had a massive impact on my own thinking about my role as a designer, and the ideals I hold about how I should apply my craft.&lt;br /&gt;&lt;br /&gt;Years later, when studying at University I came across an article originally written by Chermayeff in 1969 (and if memory serves correctly re-published&amp;nbsp;in Idea: Special Issue: Chermayeff &amp;amp; Geismar, 1981) entitled "Design: Another Reconsideration". I drank in every word, photocopied it, and used it to fuel part of my dissertation. Since then I have often wanted to read it again, but never found it re-printed or archived anywhere on the Internet.&lt;br /&gt;&lt;br /&gt;Yesterday, when visiting my parents, I took a look in their attic and found some of my old college work. Stuffed into one of my essays I was suprised and pleased to find the photocopy I must have made over 10 years ago.&lt;br /&gt;&lt;br /&gt;I wouldn't know how to get hold of it now, so I have attempted to transcribe the article from my photocopy.&amp;nbsp; If Ivan Chermayeff or IP owners of Idea magazine object, I will gladly take this down. &lt;br /&gt;&lt;br /&gt;But in my opinion, this is too good to miss.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Design: Another Reconsideration&lt;br /&gt;&lt;br /&gt;Every few years, or is it months – on some days it seems like minutes – I ask myself, as I'm quite sure most other designers do, what is it I do every day. What is design anyway? And whatever it is, do I personally really want to do any more of it? Is it of any importance? To society? To communications? Even to clients?&lt;br /&gt;It is easier to begin answering these questions by sneaking up on them; by deciding what design is not.&lt;br /&gt;Design is not what a considerable number of self-described designers think it is.&lt;br /&gt;Design is not art.&lt;br /&gt;Design is not terribly significant.&lt;br /&gt;Design is not always better than nothing.&lt;br /&gt;Design is the solution to problems, real, important or unimportant. The problems of design are not designer problems, they are client problems. Design must therefore grow out of a reasonable understanding of these problems, and their goals and aspirations.&lt;br /&gt;If design solutions do not come directly out of the problems they face, then they will not be design solutions, but be arbitrary, and will probably lean heavily on current fads of typographic or illustrational style. Such designs will also be no good, or to put it another way, will not be design. Truman Capote when asked what he thought of the writing in some best seller, a few years back, replied, “That's not writing, that's typing.” The same thing applies to design. If it's not an answer to a problem, it's not design, it's layout.&lt;br /&gt;I suppose I should backtrack and make clear that “design” refers to Graphic Design or other predominantly visually oriented areas of activity. It include the shell of the typewriter but not the guts.&lt;br /&gt;Because design is concerned with symbols rather than structures, looks of machines rather than their works, typefaces rather than words, a concerned designer can get frustrated.&lt;br /&gt;In order to design a good symbol the designer must understand what it will represent and the more he investigates, presuming a highly cynical, objective, and unbiased questioning attitude, the more likely the designer will want to influence the structure, to change it for the better, or quit.&lt;br /&gt;Every problem of every client is different, and every client is different. (You can argue that they are all the same, but that would be a confession the design is a waste of time and money.) Under these circumstances the only way to keep up or reach a high level of design (in no way synonymous with successful) is to maintain a continuous and unrelenting interest in what the problem at hand really is. It is an old adage that once a problem is truly described, the solution comes along with the description.&lt;br /&gt;Herein lies one fundamental problem with design as a viable activity.&lt;br /&gt;Simply put:&lt;br /&gt;Design problems are more interesting than design solutions.&lt;br /&gt;It seems more challenging to design a new concept, than to design an ad about it. Talking about problems, visually or in print, is not as rewarding or interesting as dealing with them intimately.&lt;br /&gt;All this, of course, is only true if the problems are interesting. Not all problems are either interesting, valid or worth working on or thinking about for a second, unless it's a matter of survival.&lt;br /&gt;I feel it is extremely important for designers to be more interested in areas outside their own. Design is a service operation. Thinking about and developing solutions to other people's problems.&lt;br /&gt;Designers usually don't write very well.&lt;br /&gt;Designers don't usually even communicate very well, even thought communication, or one form of it, is their life's work.&lt;br /&gt;Designers should read.&lt;br /&gt;Designers should make themselves aware of everything.&lt;br /&gt;Designers must be selective.&lt;br /&gt;Designers must think.&lt;/blockquote&gt;&lt;blockquote&gt;&lt;em&gt;Ivan Chermayeff&lt;/em&gt;&lt;br /&gt;New York, May 1969&lt;/blockquote&gt;(Source believed to be: Chermayeff, I. (1981). Design: Another Reconsideration. &lt;a href="http://designarchives.aiga.org/#/entries/%2Bcredits%3A%22Seibundo%2BShinkosha%22/_/detail/relevance/desc/0/7/13178/idea-special-issue/1"&gt;Idea Special Issue: Chermayeff &amp;amp; Geismar&lt;/a&gt;. Unknown (1), Unknown.)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-5883228598940741110?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/5883228598940741110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/design-another-reconsideration-ivan.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5883228598940741110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5883228598940741110'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/08/design-another-reconsideration-ivan.html' title='Design: Another Reconsideration - Ivan Chermayeff, 1969'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6959302322318434074</id><published>2010-03-30T19:13:00.003+01:00</published><updated>2010-03-30T19:18:58.210+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='3D glasses'/><category scheme='http://www.blogger.com/atom/ns#' term='3d'/><category scheme='http://www.blogger.com/atom/ns#' term='stereoscopy'/><title type='text'>3D Explained a different way</title><content type='html'>To add to my earlier posts about 3D stereoscopy, this BBC clip compares different ways of perceiving 3D that can all be used by artists and animators.&lt;br /&gt;&lt;br /&gt;&lt;object width="400" height="400"&gt;&lt;param name="movie" value="http://www.bbc.co.uk/emp/external/player.swf"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;param name="FlashVars" value="playlist=http%3A%2F%2Fwww%2Ebbc%2Eco%2Euk%2Fiplayer%2Fplaylist%2Fp0073mk6&amp;amp;config_settings_showUpdatedInFooter=true&amp;amp;config_settings_skin=silver&amp;amp;config_settings_showFooter=true&amp;amp;"&gt;&lt;embed src="http://www.bbc.co.uk/emp/external/player.swf" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" flashvars="playlist=http%3A%2F%2Fwww%2Ebbc%2Eco%2Euk%2Fiplayer%2Fplaylist%2Fp0073mk6&amp;amp;config_settings_showUpdatedInFooter=true&amp;amp;config_settings_skin=silver&amp;amp;config_settings_showFooter=true&amp;amp;" width="400" height="400"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6959302322318434074?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6959302322318434074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/03/3d-explained-different-way.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6959302322318434074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6959302322318434074'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/03/3d-explained-different-way.html' title='3D Explained a different way'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-8255991664049806271</id><published>2010-03-16T22:04:00.002Z</published><updated>2010-03-16T22:13:01.378Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='web design'/><category scheme='http://www.blogger.com/atom/ns#' term='JQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='Free'/><category scheme='http://www.blogger.com/atom/ns#' term='sitepoint'/><title type='text'>Free web design helps from SitePoint - JQuery and more...</title><content type='html'>I have probably mentioned SitePoint before, but that is because they have some really useful things for web designers.&lt;br /&gt;&lt;br /&gt;The offering that prompted me to blog tonight was some free sample chapters from their JQuery book, and better still - 100 free JQuery codes as well.&lt;br /&gt;&lt;br /&gt;Get it here: &lt;a href="http://bit.ly/a0sN6a"&gt;http://bit.ly/a0sN6a&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Their website is well worth checking out while you are there to see what other freebies are available.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-8255991664049806271?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/8255991664049806271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/03/free-web-design-helps-from-sitepoint.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/8255991664049806271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/8255991664049806271'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/03/free-web-design-helps-from-sitepoint.html' title='Free web design helps from SitePoint - JQuery and more...'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-2170369582599255279</id><published>2010-03-15T20:40:00.004Z</published><updated>2010-03-15T20:58:51.722Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='web design'/><category scheme='http://www.blogger.com/atom/ns#' term='dot com'/><title type='text'>Boom to Bust - Where have all the websites gone?</title><content type='html'>&lt;a href="http://news.bbc.co.uk/1/hi/magazine/8568509.stm"&gt;This BBC article&lt;/a&gt; about some of the once big names of the Internet brought back memories for me. It is strange to think that most of my current students were only kids at the time, anything between 5 and 10 years old. They probably won't remember most of these. But for me, as one who was working in a new web industry as a brand new web and graphic designer, many of these were the every day names we saw as examples of success.&lt;br /&gt;&lt;br /&gt;It is interesting to see that not one of those names survives today.&lt;br /&gt;&lt;br /&gt;For students of web design now, it is well worth looking at these early examples to see how things have changed (technology), and how some things have not (usability issues and big corporation buy-outs).&lt;br /&gt;&lt;br /&gt;It is also interesting to see how Boo.com might have survived if it were launched today. While back then the internet was too slow to cope with the technology they were trying to use, today it would be no bother. Too ahead of its time perhaps? Or too willing to ignore the constraints of the time? You decide - but the lessons are still important now.&lt;br /&gt;&lt;br /&gt;Any way - enjoy the article:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://news.bbc.co.uk/1/hi/magazine/8568509.stm"&gt;http://news.bbc.co.uk/1/hi/magazine/8568509.stm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And if you want to see what those sites might have looked like why not look them up in the Wayback Machine:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.archive.org/"&gt;http://www.archive.org/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-2170369582599255279?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/2170369582599255279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/03/boom-to-bust-where-have-all-websites.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/2170369582599255279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/2170369582599255279'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/03/boom-to-bust-where-have-all-websites.html' title='Boom to Bust - Where have all the websites gone?'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-496676981885862583</id><published>2010-03-05T18:45:00.005Z</published><updated>2010-03-05T21:33:50.547Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='unity'/><category scheme='http://www.blogger.com/atom/ns#' term='unreal'/><category scheme='http://www.blogger.com/atom/ns#' term='3d'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='FPSC'/><title type='text'>Game Engines go Free</title><content type='html'>If you have been tempted to cross the boundary between 2D interactive media or games or 3D animation into 3D games, you will probably know you need to get a decent 3D game physics engine.&lt;br /&gt;&lt;br /&gt;That's where my brain has been lately, and consequently I have turned my attention to physics engines. In my mind it was initially a toss-up between Epic's &lt;a href="http://www.unrealtechnology.com/features.php?ref=editor"&gt;UnrealEd&lt;/a&gt;, which comes with Unreal Tournament, or the &lt;a href="http://www.fpscreator.com/"&gt;FPS Creator&lt;/a&gt; from The Game Makers.&lt;br /&gt;&lt;br /&gt;UnrealEd would have been first choice since I know it is used by a local university on their Game Art degree, on the other hand the FPSC had good features too, and in some ways was less complex and perhaps more suitable for allowing (high school level) students to quickly preview their characters and in-game objects.&lt;br /&gt;&lt;br /&gt;However as I did some digging I found that the current plethora of game engines out there, including some open source offerings, has made the area highly competitive. So competitive in fact that well respected commercial engines are now becoming available FREE for personal use, or under developer licenses where you only pay if you make money. This combined with all the free stuff, makes for quite a choice.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Commercial Game Engines for Free &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.udk.com/"&gt;&lt;span style="font-weight: bold;"&gt;UDK&lt;/span&gt;&lt;/a&gt; - Unreal have released what they call the Unreal Development Kit, it contains all the tools previously only available to commercial developers or those with a lot of spare cash. This now seems to replace UnrealEd from my point of view.&lt;br /&gt;&lt;br /&gt;&lt;a style="font-weight: bold;" href="http://www.fpscreator.com/free_download.html"&gt;FPSC&lt;/a&gt; - The Game Makers have released a free developers edition of FPSC. It has all the features of the pay for version minus network games and compile - but the &lt;a href="http://www.thegamecreators.com/"&gt;pay for is only £30&lt;/a&gt; these days anyway.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://unity3d.com/unity/download/"&gt;&lt;span style="font-weight: bold;"&gt;Unity&lt;/span&gt;&lt;/a&gt; - Described as being the best game engine this side of a $million, it normally retailed at about $200, but a free development version is now available too, and looks pretty amazing.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Freeware or Open Source Game Engines&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.blender.org/"&gt;Blender&lt;/a&gt; - Has long been capable of producing 3D games made interactive with Python scripting.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sandboxgamemaker.com/"&gt;Platinum Arts Sandbox 3D Game Maker&lt;/a&gt; - purports to be popular with educational environments.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Cheap Game Engines&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://t3dgm.thegamecreators.com/"&gt;The 3D Game Maker&lt;/a&gt;  - I thought I would throw this one in. Although very limited in terms of customisation, for some educational purposes (e.g. Level 1 and 2) this could be ideal. With a bit of technical know how students can include their own 3D models (.x format) in their games.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Well, I already owned FPSC, the 3D Game Maker, and UnrealED, but now I have downloaded Unity and the UDK (be interested to see how UDK is different from UnrealEd). I can hardly wait to get started.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-496676981885862583?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/496676981885862583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/03/game-engines-go-free.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/496676981885862583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/496676981885862583'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/03/game-engines-go-free.html' title='Game Engines go Free'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-4879365233017580322</id><published>2010-02-18T19:53:00.007Z</published><updated>2010-02-18T20:30:41.937Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='fullscreen'/><category scheme='http://www.blogger.com/atom/ns#' term='mx2004'/><category scheme='http://www.blogger.com/atom/ns#' term='flash 8'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>True Full Screen in Flash Player 7 or 8</title><content type='html'>Most flash based video players have a "full screen" option that makes the video fill your screen even if it originated from a small square in a web page.&lt;br /&gt;&lt;br /&gt;But it can be used to make any SWF file fill the screen.&lt;br /&gt;&lt;br /&gt;I use both MX 2004 or CS3 depending on which computer I am using. And I know there are still a lot of MX or 8 users out there. So, in case I forget, and in case anyone else finds it helpful, here's how you do full screen in MX 2004 or 8.&lt;br /&gt;&lt;br /&gt;The whole thing is summed up in detail here:&lt;br /&gt;&lt;a href="http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode_04.html"&gt;http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The ActionScript&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here is my AS2 implementation:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/*first set the initial fullscreen value which is 0 because we are not yet in fullscreen */&lt;br /&gt;var fullscr_status = 0;&lt;br /&gt;/*Then a function that runs when the fullscreen button is pressed, this tests whether we are in fullscreen (1) or not (0). If not we go into fullscreen mode. If allready in fullscreen mode we come out of it. */&lt;br /&gt;_root.button_btn.onRelease = function() {&lt;br /&gt; if (fullscr_status == 0) {&lt;br /&gt;  //Fullscreen on&lt;br /&gt;  fullscr_status = 1;&lt;br /&gt;  Stage["displayState"] = "fullScreen";&lt;br /&gt; } else if (fullscr_status == 1) {&lt;br /&gt;  //Fullscreen off&lt;br /&gt;  fullscr_status = 0;&lt;br /&gt;  Stage["displayState"] = "normal";&lt;br /&gt; }&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;The thing that is different for MX 2004 and 8, when compared to using ActionScript 2 in CS3 is this:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Stage["displayState"] = "fullScreen";&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;and&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Stage["displayState"] = "normal";&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;these are different in CS3.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The HTML&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The fullscreen ActionScript won't have any effect unless the &lt;span style="font-style: italic;"&gt;object&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;embed&lt;/span&gt; parameters are set to allow fullscreen as follows:&lt;br /&gt;&lt;br /&gt;For object:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;param name="allowFullScreen" value="true"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;For embed:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;allowFullScreen="true"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The HTML object and embed I use is described on the Adobe site here:&lt;br /&gt;&lt;a href="http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode_04.html"&gt;http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode_04.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;An Example&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Just click the square.&lt;br /&gt;&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0" align="middle" width="300" height="200"&gt;&lt;br /&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;br /&gt;&lt;param name="movie" value="http://www.digitalarena.co.uk/teach/virtual_compass/tester.swf"&gt;&lt;br /&gt;&lt;param name="bgcolor" value="#333333"&gt;&lt;br /&gt;&lt;embed src="http://www.digitalarena.co.uk/teach/virtual_compass/tester.swf" allowfullscreen="true" bgcolor="#333333" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" width="300" height="200"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-4879365233017580322?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/4879365233017580322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/02/true-full-screen-in-flash-player-7-or-8.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4879365233017580322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4879365233017580322'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/02/true-full-screen-in-flash-player-7-or-8.html' title='True Full Screen in Flash Player 7 or 8'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-5208098487882303575</id><published>2010-02-10T19:07:00.005Z</published><updated>2010-02-10T19:14:23.261Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='crime'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='problem solving'/><title type='text'>Design Out Crime</title><content type='html'>I received an email today from the Design Council and was immediately interested in an article about using design to cut crime. For me this is exactly what design is about, that is solving real world problems. As Ivan Chermayeff would encourage me to think - these solutions should come out of an understanding of the problem.&lt;br /&gt;&lt;br /&gt;So what was the article about? Beer glasses, that don't break, or if they do, cause less damage to people - we are talking about cutting down incidence and opportunity for 'glassing' attacks.&lt;br /&gt;&lt;br /&gt;That means designing something that has some aesthetic value, a practical use, and limited abuse.&lt;br /&gt;&lt;br /&gt;Read the full article here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.designcouncil.org.uk/Design-Council/Files/Landing-pages/Design-Out-Crime/Alcohol-related-crime/?id=5335&amp;amp;WT.dcsvid=NDA5OTYwNDIwOAS2&amp;amp;WT.mc_id"&gt;http://www.designcouncil.org.uk/Design-Council/Files/Landing-pages/Design-Out-Crime/Alcohol-related-crime/?id=5335&amp;amp;WT.dcsvid=NDA5OTYwNDIwOAS2&amp;amp;WT.mc_id&lt;/a&gt;=&lt;br /&gt;&lt;br /&gt;And you can watch a video about it below:&lt;br /&gt;&lt;br /&gt;&lt;object width="400" height="225"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=9191412&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=9191412&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://vimeo.com/9191412"&gt;Designing the next generation British pint glass - the design story&lt;/a&gt; from &lt;a href="http://vimeo.com/designcouncil"&gt;Design Council&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-5208098487882303575?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/5208098487882303575/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/02/design-out-crime.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5208098487882303575'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5208098487882303575'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/02/design-out-crime.html' title='Design Out Crime'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6659524501881838673</id><published>2010-01-04T20:37:00.005Z</published><updated>2010-01-04T20:56:16.052Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pixar'/><category scheme='http://www.blogger.com/atom/ns#' term='3D glasses'/><category scheme='http://www.blogger.com/atom/ns#' term='3d'/><category scheme='http://www.blogger.com/atom/ns#' term='polarization'/><title type='text'>What makes an 'Imax' 3D cinema image 3D?</title><content type='html'>I was discussing 3D stereograms &lt;a href="http://dansinteractive.blogspot.com/2009/11/channel-4-3d-week.html"&gt;last year in relation to Channel-4's 3D week&lt;/a&gt;, but I came across this interesting video clip on the &lt;a href="http://news.bbc.co.uk/1/hi/entertainment/8049721.stm"&gt;BBC website&lt;/a&gt; when I was looking for information on 'The Pixar Story' a documentary "about the pioneering computer animation studio ".&lt;br /&gt;&lt;br /&gt;The 3D shown here does not require coloured filters in the glasses, but does still adhere to the age old principle that 3D is constructed in the brain from seeing two slightly different images with each eye. Rather than coloured filters these use polarising filters. This gives the best colour reproduction of all the 'cheap' glasses methods - but I will let the video tell you more:&lt;br /&gt;&lt;br /&gt;&lt;object width="400" height="400"&gt;&lt;param name="movie" value="http://news.bbc.co.uk/player/emp/external/player.swf"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;param name="FlashVars" value="config_settings_showUpdatedInFooter=true&amp;amp;config_settings_showPopoutButton=false&amp;amp;playlist=http%3A%2F%2Fnews%2Ebbc%2Eco%2Euk%2Fmedia%2Femp%2F8040000%2F8049700%2F8049721%2Exml&amp;amp;config=http%3A%2F%2Fnews%2Ebbc%2Eco%2Euk%2Fplayer%2Femp%2Fconfig%2Fdefault%2Exml%3F2%2E18%2E13034%5F14207%5F20091118114410&amp;amp;config_settings_language=default&amp;amp;config_settings_showFooter=true&amp;amp;config_plugin_fmtjLiveStats_pageType=eav6&amp;amp;config_settings_showPopoutButton=false&amp;amp;config_settings_showPopoutCta=false&amp;amp;config_settings_addReferrerToPlaylistRequest=true"&gt;&lt;embed src="http://news.bbc.co.uk/player/emp/external/player.swf" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="400" flashvars="config_settings_showUpdatedInFooter=true&amp;config_settings_showPopoutButton=false&amp;playlist=http%3A%2F%2Fnews%2Ebbc%2Eco%2Euk%2Fmedia%2Femp%2F8040000%2F8049700%2F8049721%2Exml&amp;config=http%3A%2F%2Fnews%2Ebbc%2Eco%2Euk%2Fplayer%2Femp%2Fconfig%2Fdefault%2Exml%3F2%2E18%2E13034%5F14207%5F20091118114410&amp;config_settings_language=default&amp;config_settings_showFooter=true&amp;config_plugin_fmtjLiveStats_pageType=eav6&amp;config_settings_showPopoutButton=false&amp;config_settings_showPopoutCta=false&amp;config_settings_addReferrerToPlaylistRequest=true"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Stereoscopy#Linearly_polarized_glasses"&gt;Further information may be found here &gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6659524501881838673?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6659524501881838673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/01/what-makes-imax-3d-cinema-image-3d.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6659524501881838673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6659524501881838673'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/01/what-makes-imax-3d-cinema-image-3d.html' title='What makes an &apos;Imax&apos; 3D cinema image 3D?'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-2447014057022284802</id><published>2010-01-01T00:04:00.002Z</published><updated>2010-01-01T00:07:25.855Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='NYE'/><category scheme='http://www.blogger.com/atom/ns#' term='2010'/><category scheme='http://www.blogger.com/atom/ns#' term='happy new year'/><title type='text'>Happy New Year</title><content type='html'>I wish you all a happy and prosperous 2010.&lt;br /&gt;&lt;br /&gt;For me 2010 will see me continuing to work hard and learn hard, and getting the right balance between work and family. I believe that way points to satistfaction, health and success.&lt;br /&gt;&lt;br /&gt;Happy new year.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-2447014057022284802?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/2447014057022284802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2010/01/happy-new-year.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/2447014057022284802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/2447014057022284802'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2010/01/happy-new-year.html' title='Happy New Year'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-1873554230725298954</id><published>2009-12-28T18:25:00.002Z</published><updated>2009-12-28T18:33:42.621Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='animation'/><category scheme='http://www.blogger.com/atom/ns#' term='e-book'/><category scheme='http://www.blogger.com/atom/ns#' term='Free'/><title type='text'>How to Become an Animator - Free e-Book</title><content type='html'>&lt;a href="http://www.animationmentor.com/landing/becomeanimator/images/ebook-content-bg.jpg"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 647px; DISPLAY: block; HEIGHT: 369px; CURSOR: hand" border="0" alt="" src="http://www.animationmentor.com/landing/becomeanimator/images/ebook-content-bg.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;I won't pretend it's not a marketing campaign from &lt;a href="http://www.animationmentor.com/"&gt;AnimationMentor.com&lt;/a&gt;, because that is exactly what it is. But if animation is what you like, and you think animation is where you want to end up, then you just may find this valuable.&lt;br /&gt;&lt;br /&gt;It's taking about 40 minutes to download so no review of content at present. But at a price of FREE, I'm not complaining.&lt;br /&gt;&lt;br /&gt;You can download it here: &lt;a href="http://www.animationmentor.com/landing/becomeanimator/ebook.html"&gt;http://www.animationmentor.com/landing/becomeanimator/ebook.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Meanwhile, I will add my review later when I have had a chance to read from it&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-1873554230725298954?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/1873554230725298954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/12/how-to-become-animator-free-e-book.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1873554230725298954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1873554230725298954'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/12/how-to-become-animator-free-e-book.html' title='How to Become an Animator - Free e-Book'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-7604633749699584055</id><published>2009-12-09T20:47:00.015Z</published><updated>2009-12-10T07:51:46.343Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Math'/><category scheme='http://www.blogger.com/atom/ns#' term='setInterval'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='snow'/><category scheme='http://www.blogger.com/atom/ns#' term='adobe exchange'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='snowflake'/><category scheme='http://www.blogger.com/atom/ns#' term='snow fall'/><category scheme='http://www.blogger.com/atom/ns#' term='component'/><title type='text'>Custom Snow Effect in Flash</title><content type='html'>Whether or not we get a white Christmas outside, I can make sure I get one in my Flash work any time I like.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Components&lt;/span&gt; add to the functionality of Flash, basically making more complex actionscripts available to those of us who lack the time or the knowledge to program them ourselves. The &lt;a href="http://www.adobe.com/cfusion/exchange/"&gt;Adobe Exchange&lt;/a&gt; is a great place to find components for Flash from MX right through to CS4, some free, some you have to buy.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Free Snow Effect Component&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The component I want to tell you about is the &lt;span style="font-style: italic;"&gt;free &lt;/span&gt;&lt;a href="http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&amp;amp;extid=1278523"&gt;Snow Flash Effect component from FlashWanted by Corso Ria&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Download it here (you will need to get a free Adobe Exchange account):&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&amp;amp;extid=1278523"&gt;http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&amp;amp;extid=1278523&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Once downloaded just double click the MXP file and it will automatically install into the Flash components panel.&lt;br /&gt;&lt;br /&gt;This particular component works with Flash versions MX 2004, MX 2004 Pro, 8 and CS3 (and maybe CS4 but I haven't tested it), so if you don't have access to the latest version of Flash, this should still work for you. In fact i'll be using MX 2004 to show you how it works since I don't have CS3 on this machine and I can't be bothered to pull the laptop out - it's really easy.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Basic Snow&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To kick off you need to open the Components panel, and then open the FlashWanted group. In there you will find a component called "sneg".&lt;br /&gt;&lt;br /&gt;Drag "sneg" to the stage and scale it to cover the area you want to be snowy.&lt;br /&gt;&lt;br /&gt;Then, with the instance of the "sneg" component you dragged onto the stage selected, you need to open the Component Inspector.&lt;br /&gt;&lt;br /&gt;Most of the fields in the Component Inspector are pretty self explanatory, and a bit of experimenting with the settings will give you the effect you want. You can even make the background transparent by changing the alpha setting, allowing you to overlay the snow over other layers.&lt;br /&gt;&lt;br /&gt;And that's it.&lt;br /&gt;&lt;br /&gt;CTRL+ENTER to test the movie and the snow begins to fall.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Customising the Snow&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;By default the snow is made up of very small white dots, but you can use your own flake design by using a symbol from your library.&lt;br /&gt;&lt;br /&gt;To do this you need to first make a MovieClip to use as a snowflake, and then set it to &lt;span style="font-style: italic;"&gt;export for actionscript&lt;/span&gt;. Do this by right clicking the symbol in the Library, and choosing the &lt;span style="font-style: italic;"&gt;Linkage&lt;/span&gt; option.&lt;br /&gt;&lt;br /&gt;Then set the identifier, what you type here is what you will also type in the &lt;span style="font-style: italic;"&gt;Library Symbol&lt;/span&gt; field in the Component Inspector. I used 'flake_mc' as the identifier in mine.&lt;br /&gt;&lt;br /&gt;Feel free to test away.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Further Customisation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you are like me you will always be curious about how far you can push the technology beyond its original or obvious intention. I have seen other snow effect components in use that had more than one type of snowflake and allowed the snowflakes to tumble, or turn, as they fell.&lt;br /&gt;&lt;br /&gt;It seemed pretty logical that, if I am specifying a MovieClip as a snowflake, any actionscript within that MovieClip that refers to the clip itself, ought to work. And, I was right.&lt;br /&gt;&lt;br /&gt;In the previous step we looked at how the component allowed us to specify a particular MovieClip to use as a snowflake, rather than its own default 'dot'. What this means is that we can actionscript our snowflake MovieClip to apply certain attributes to itself, and this actionscript will work independently for each flake the component places on our stage.&lt;br /&gt;&lt;br /&gt;In other words we can make 'intelligent' snowflakes to make up for where the component lacks. While the component takes care of the snow falling, each flake takes care of its own turn speed and appearance etc.&lt;br /&gt;&lt;br /&gt;Here's how.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;Random Flake Appearance&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I am going to cheat a little here, this script will not actually generate random flakes, but what it will do is randomly choose a snowflake design from a selection that you will make.&lt;br /&gt;&lt;br /&gt;What I did was make 5 different snowflakes and place each one on a different keyframe within a MovieClip called 'snowflake_mc'. Don't forget to put a stop(); action on each of these keyframes or your flakes will keep cycling through the 5 designs as they fall (which doesn't happen in real life). It's also a good idea to make sure each snowflake on each frame is positioned over the 'centre point' in the middle of the MovieClip symbol.&lt;br /&gt;&lt;br /&gt;So what I end up with is a MovieClip called 'snowflake_mc' containing 5 frames, each frame containing a different snowflake design and a stop(); action.&lt;br /&gt;&lt;br /&gt;The next stage is to open the symbol we specified in the Component earlier - flake_mc. Inside flake_mc you need to swap the snowflake design with the MovieClip you just made containing 5 flakes. Give this the instance name of 'snowflake_mc'. So what we end up with is a symbol called 'flake_mc' that is set to export for actionscript that contains another symbol called 'snowflake_mc' that contains our 5 flake designs.&lt;br /&gt;&lt;br /&gt;Now for the actionscript. This goes on the first frame of 'flake_mc':&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/*randomly select which flake design to use */&lt;br /&gt;var flakedes = Math.ceil(Math.random()*5);&lt;br /&gt;/*set flake design to the one selected */&lt;br /&gt;snowflake_mc.gotoAndStop(flakedes);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;First we create a variable called 'flakedes' that is a randomly generated number between 1 and 5. we do this because we have 5 flake designs. This then acts as a random flake selector. We generate the number using Math.random, but this only gives us a number between 0 and 1. To turn this into a number between 1 and 5 I multiply it by 5 and then round it up using Math.ceil. (If I rounded down I would get a number between 0 and 4, rounding up guarantees between 1 and 5).&lt;br /&gt;&lt;br /&gt;Then we tell the 'snowflake_mc' MovieClip (the one with 5 frames) to gotoAndStop at the frame number we just randomly generated. This then randomly displays on of our 5 flake designs.&lt;br /&gt;&lt;br /&gt;Voila! As the component places a new flake on the stage the appearance of the flake is now randomly one of the 5 designs you made.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;Flake Tumbling&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This requires trickier actionscript (but still easy), but no extra graphics. A pure code solution to flake tumbling. This goes on the first frame of 'flake_mc' &lt;span style="font-style: italic;"&gt;beliw&lt;/span&gt; the code we already have:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/*Generate a random small number of equal chang of being positive or negative. Positive equates to clockwise rotation, negative anti-clockwise */&lt;br /&gt;var rotfactor = ((Math.random()*4)-2);&lt;br /&gt;/* This function tells the snowflake_mc movieclip within the flake_mc clip to rotate by the rotfactor. */&lt;br /&gt;function snowflakeroll () {&lt;br /&gt;snowflake_mc._rotation += rotfactor;&lt;br /&gt;}&lt;br /&gt;/* this runs the above function every 40 milliseconds. */&lt;br /&gt;setInterval(snowflakeroll, 40);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;I wanted the flakes to tumble very slowly, all at different speeds of slowness, and in either direction. So the first part generates a small number, between -2 and 2. A negative number will equate to anti-clockwise tumbling, a positive number clockwise tumbling. We generate this number again using Math.random but this time we multiply the number by 4, to give us a random number between 0 and 4, but then we -2 from that number giving us a random number between -2 and 2.&lt;br /&gt;&lt;br /&gt;We use this number as the variable 'rotfactor'.&lt;br /&gt;&lt;br /&gt;What we then want to do is use the value of 'rotfactor' as the amount the snowflake will rotate each &lt;span style="font-style: italic;"&gt;frame&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;However within the MovieClip inside the component onEnterFrame doesn't work. So instead we approximate frames by using setInterval.&lt;br /&gt;&lt;br /&gt;setInterval works by calling a function repeatedly, with an interval between each call. If we set the interval small enough it will be as good as calling each frame.&lt;br /&gt;&lt;br /&gt;First then we have to write the function, then use setInterval to call the function.&lt;br /&gt;&lt;br /&gt;Our function is very simple:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function snowflakeroll () {&lt;br /&gt;snowflake_mc._rotation += rotfactor;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;First we define the function and give it a name 'snowflakeroll', then we give the function its instructions which in this case is to tell the 'snowflake_mc' MovieClip to change its rotation value by 'rotfactor'. By using += rather than just = we add rotfactor to itself each time the function is called so it gets larger each time thereby increasing its angle of rotation with each call of the function.&lt;br /&gt;&lt;br /&gt;Then we just need to call the function using setInterval:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;setInterval(snowflakeroll, 40);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;We call the function by name, and then we define the interval in milliseconds. In this case 40 milliseconds calls the function frequently enough to creat a smooth rotation animation.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;And that's it&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And that's it. You're done. You have now got a basic component that simply chucks snow out, to give you random flakes with random tumbling speeds both clockwise and anti-clockwise.&lt;br /&gt;&lt;br /&gt;Given all that we have done, I think it safe to assume they don't have to be snowflakes. What other MovieClips could it chuck out, and how could these be scripted? Over to you.&lt;br /&gt;&lt;br /&gt;Happy Christmas.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-7604633749699584055?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/7604633749699584055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/12/custom-snow-effect-in-flash.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/7604633749699584055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/7604633749699584055'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/12/custom-snow-effect-in-flash.html' title='Custom Snow Effect in Flash'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6690681751378290176</id><published>2009-11-18T16:25:00.002Z</published><updated>2009-11-18T16:30:34.797Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='anaglyph'/><category scheme='http://www.blogger.com/atom/ns#' term='3D glasses'/><category scheme='http://www.blogger.com/atom/ns#' term='projector'/><category scheme='http://www.blogger.com/atom/ns#' term='ColorCode'/><title type='text'>So... do ColorCode (Amber+Blue) 3D glasses work with LCD Projectors?</title><content type='html'>I said I would test it out, and the verdict is... yes.&lt;br /&gt;&lt;br /&gt;At least, it did with the Dell projector I tried it on. While I initially found that there was more ghosting on the projector image when viewed through ColorCode (Amber+Blue) glasses, than my LCD monitor, at least it was 3D.&lt;br /&gt;&lt;br /&gt;I have not yet had success with Cyan+Red at all on a projector.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Changing "Video Mode" improves image&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The Dell projector I used allowed me to change the "video mode", which is basically a bunch of different colour level presets. I found that in "game mode" the ghosting pretty much vanished even on the projector.&lt;br /&gt;&lt;br /&gt;So there you have it.&lt;br /&gt;&lt;br /&gt;ColorCode (Amber+Blue) can work with a projector.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6690681751378290176?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6690681751378290176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/11/so-do-colorcode-amberblue-3d-glasses.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6690681751378290176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6690681751378290176'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/11/so-do-colorcode-amberblue-3d-glasses.html' title='So... do ColorCode (Amber+Blue) 3D glasses work with LCD Projectors?'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-4651419546484158760</id><published>2009-11-10T22:00:00.006Z</published><updated>2009-11-10T22:50:15.673Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='anaglyph'/><category scheme='http://www.blogger.com/atom/ns#' term='3D glasses'/><category scheme='http://www.blogger.com/atom/ns#' term='3d'/><category scheme='http://www.blogger.com/atom/ns#' term='Channel 4'/><category scheme='http://www.blogger.com/atom/ns#' term='C4'/><category scheme='http://www.blogger.com/atom/ns#' term='3D week'/><category scheme='http://www.blogger.com/atom/ns#' term='ColorCode'/><title type='text'>Channel-4 3D Week</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www2.sainsburys.co.uk/NR/rdonlyres/F49D03D8-0241-4C1C-B599-9E4EA96A961D/0/Shipper.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 150px; height: 405px;" src="http://www2.sainsburys.co.uk/NR/rdonlyres/F49D03D8-0241-4C1C-B599-9E4EA96A961D/0/Shipper.jpg" alt="" border="0" /&gt;&lt;/a&gt;I was at &lt;a href="http://www.sainsburys.co.uk/sol/index.jsp"&gt;Sainsbury's&lt;/a&gt; today (unusual, but I happened to be near one) and came across a big point-of-sale bin thing with loads of &lt;a href="http://www2.sainsburys.co.uk/instoreoffers/free_3d_glasses.htm"&gt;FREE 3D glasses&lt;/a&gt; in it. Apparently &lt;a href="http://www.channel4.com/programmes/3d-week/"&gt;Channel-4 is hosting a 3D week&lt;/a&gt;, which according to my 3D glasses arm will feature  "never-seen-before archive footage and continue[s] through the week with loads of awesome 3D films and concerts to enjoy".&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Anaglyph TV&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, the image below (&lt;a href="http://www.channel4.com/programmes/3d-week/articles/jls-in-3d"&gt;from the C4 website&lt;/a&gt;) doesn't look like anything special to the naked eye, but when viewed through the special &lt;a href="http://www2.sainsburys.co.uk/instoreoffers/free_3d_glasses.htm"&gt;Sainsbury's glasses&lt;/a&gt; will take on a 3D appearance. It is an &lt;a href="http://en.wikipedia.org/wiki/Anaglyph_image"&gt;anaglyph&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.channel4.com/assets/programmes/images/3d-week/jls-in-3d/deb6d61e-50b7-496b-b3ab-00e5d63f004e_412x232.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 412px; height: 232px;" src="http://www.channel4.com/assets/programmes/images/3d-week/jls-in-3d/deb6d61e-50b7-496b-b3ab-00e5d63f004e_412x232.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;To view anaglyphs you need special "3D glasses" that have coloured filters. But there are several different colour combinations around, and you have to make sure you get the right one for what you are watching. You can get Red Blue, Red Cyan (the most popular), Red Green and, as I learned today, Blue Ochre (sometimes called Blue Amber, or Blue Brown).&lt;br /&gt;&lt;br /&gt;And guess which ones Channel-4 have opted for?&lt;br /&gt;&lt;br /&gt;Blue Ochre of course - which means you probably &lt;span style="font-style: italic;"&gt;don't&lt;/span&gt; have an old pair of 3D glasses hanging round the house which will work for 3D week. Your "Journey to the Centre of the Earth" glasses will not work, and neither will your "Shark Boy and Lava Girl" pair.&lt;br /&gt;&lt;br /&gt;Better get yourself down to Sainsbury's and get some Blue Ochre.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;But what's with all the different types? &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Why not just stick to one type and have done with it? Simply put, different colour combinations have different benefits. Red Cyan is probably the most popular because it allows the creation of both colour and B&amp;amp;W anaglyphs (as does Red Green). Red Blue only allows B&amp;amp;W and the images are very dark.&lt;br /&gt;&lt;br /&gt;But more information on the different types can be found here:&lt;br /&gt;&lt;a href="http://nzphoto.tripod.com/sterea/anaglyphs.htm"&gt;http://nzphoto.tripod.com/sterea/anaglyphs.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;However, and this was news to me until today, Blue Ochre when viewed in a dark room, has better colour transmission than the others. So this is probably why Channel-4 opted for it. After all, if you want people to think that 3D is more than just a gimmick, it needs to look good.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Blue Ochre not free but very clever&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;While all the other anaglyph colour methods are pretty much public domain, the Blue Ochre combination is apparently patented. Not the idea of the anaglyph - that has been around for too long, you &lt;span style="font-style: italic;"&gt;can't&lt;/span&gt; patent that - but according to this website it is the method for converting an image for Blue Ochre is patented:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;What makes it patentable (the "secret sauce") is the mathematical formula that modifies the luminance of the right eye record and the luminance and chrominance of the left eye record to best transmit the colour information. The darker brown is necessary for balance, because blue is low luminance.&lt;br /&gt;&lt;br /&gt;Whilst I haven't read the patent (&lt;a href="http://www.patentstorm.us/patents/6687003/fulltext.html"&gt;http://www.patentstorm.us/patents/6687003/fulltext.html&lt;/a&gt;) thoroughly, their process doesn't seem to attempt to determine which point in each image represents each point in the three dimensional scene, so it seems to me that they are effectively presenting a luminance-based stereoscopic pair combined with a flat chrominance image based on the average of the two views.&lt;br /&gt;&lt;br /&gt;(&lt;a href="http://www.dvinfo.net/forum/archive/index.php/t-128661.html"&gt;http://www.dvinfo.net/forum/archive/index.php/t-128661.html&lt;/a&gt;)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Apparently this method was invented at the Technical University of Denmark, and has been branded as &lt;span style="font-style: italic;"&gt;ColorCode&lt;/span&gt;. More information can be found here: &lt;a href="http://www.colorcode3d.com/"&gt;http://www.colorcode3d.com/.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;What makes it so clever, and therefore worth paying for perhaps, is explained on their website:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;The ColorCode 3-D system is the only in the world to reproduce high quality 3-D Stereo images and movies with full color- and depth information on all display types.&lt;br /&gt;&lt;br /&gt;(&lt;a href="http://www.colorcode3d.dk/group.asp?group=39"&gt;http://www.colorcode3d.dk/group.asp?group=39&lt;/a&gt;)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;And I can't argue with this claim. I know from experience that Red Cyan may work on a CRT or TFT monitor, but utterly fail on a projector. You can also get a fair amount of ghosting. If ColorCode (Blue Ochre) can crack this, it will be worth the license fees for TV companies who want good quality 3D without a trace of gimmick.&lt;br /&gt;&lt;br /&gt;I will test my new Sainsbury's ColorCode glasses on the LCD projector at work, and if the result is good I will be very impressed and let you know.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-4651419546484158760?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/4651419546484158760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/11/channel-4-3d-week.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4651419546484158760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4651419546484158760'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/11/channel-4-3d-week.html' title='Channel-4 3D Week'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-2568994972769452194</id><published>2009-11-09T21:09:00.006Z</published><updated>2009-11-09T23:36:09.074Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='MP3'/><category scheme='http://www.blogger.com/atom/ns#' term='player'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Flash Projects #7 - Making a Flash MP3 Player</title><content type='html'>Finally here is the solution. It turns out you &lt;span style="font-style: italic;"&gt;can&lt;/span&gt; use NetConnect and NetStream to make an MP3 player in Flash, but only if you encapsulate all your MP3s as FLV files. Not really very helpful since it means converting your MP3 files - it just makes more work.&lt;br /&gt;&lt;br /&gt;And busy designers really don't want the job to take longer.&lt;br /&gt;&lt;br /&gt;However there is another way to make an MP3 player in Flash, that still gives us all the control we need, but the pausing and playing is just a tad more complicated. But nothing you can't handle I am sure.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;First, here's the code, then I will explain it:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//set default starting position for playback in seconds&lt;br /&gt;var playpoint = 0;&lt;br /&gt;//create sound object&lt;br /&gt;var audio_sound:Sound = new Sound();&lt;br /&gt;//play button&lt;br /&gt;this.play_btn.onPress = function() {&lt;br /&gt;//play the mp3 from the point defined in the variable playpoint&lt;br /&gt;audio_sound.start(playpoint);&lt;br /&gt;};&lt;br /&gt;//pause button&lt;br /&gt;this.stop_btn.onPress = function() {&lt;br /&gt;//define the variable playpoint as the same as the current position, this is given in milliseconds so we divide it by 1000 to convert it into seconds&lt;br /&gt;playpoint = (audio_sound.position/1000);&lt;br /&gt;//stop the playback&lt;br /&gt;audio_sound.stop();&lt;br /&gt;};&lt;br /&gt;this.m1_btn.onPress = function() {&lt;br /&gt;audio_sound.loadSound("track1.mp3", false);&lt;br /&gt;//true = streaming and therefore autoplay, false = not streaming and therefore just sets the file for when you hit the play button.&lt;br /&gt;};&lt;br /&gt;this.m2_btn.onPress = function() {&lt;br /&gt;audio_sound.loadSound("track2.mp3", false);&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Explanation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here goes. First, instead of using NetConnect and NetStream as we did for the video player, we are going to use &lt;span style="font-style: italic;"&gt;loadSound&lt;/span&gt;. This still gives us a fair amount of control, in some ways more than the NetStream would give us, but it doesn't automatically pause when you play something that is already playing, as NetStream does. So while the rest is no more difficult, just different, pausing and then playing again is slightly more complicated using &lt;span style="font-style: italic;"&gt;loadSound. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As with any program, we can only work with the information available, or that we can find out. With the &lt;span style="font-style: italic;"&gt;loadSound&lt;/span&gt; approach we can find out one very important thing that will help us make a pause/play mechanism - we can find out our current position in the MP3 as it plays. In the code above we do this as follows:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;audio_sound.position&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Not hard, but on its own it is not a pause/play mechanism. We make it into a pause/play by storing the current position as a variable called &lt;span style="font-style: italic;"&gt;playpoint&lt;/span&gt; at the time of pause. In effect we remember where we got up to. Then, when we play, we tell it to play from where we left off by asking the variable &lt;span style="font-style: italic;"&gt;playpoint&lt;/span&gt; to tell us where we got to. As follows:&lt;br /&gt;&lt;br /&gt;When pausing:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;this.stop_btn.onPress = function() {&lt;br /&gt;playpoint = (audio_sound.position/1000);&lt;br /&gt;audio_sound.stop();&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;First we set the variable &lt;span style="font-style: italic;"&gt;playpoint  &lt;/span&gt;to store our current position. This is actually given in milliseconds so we divide it by 1000 to convert it to seconds - and that's what you see being done here. Then we tell it to stop.&lt;br /&gt;&lt;br /&gt;When resuming playing:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;this.play_btn.onPress = function() {&lt;br /&gt;//play the mp3 from the point defined in the variable playpoint&lt;br /&gt;audio_sound.start(playpoint);&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;We simply tell it to start, but include the start position as &lt;span style="font-style: italic;"&gt;playpoint&lt;/span&gt; so it resumes from where we left off.&lt;br /&gt;&lt;br /&gt;Isn't that what pausing/playing really is? Stopping, and then starting from where you left off?&lt;br /&gt;&lt;br /&gt;The other code is effectively a menu, allowing you to choose which track to listen to. The term &lt;span style="font-style: italic;"&gt;false&lt;/span&gt; on the end means the track won't play straight away, but will wait for you to press play as well. Change the &lt;span style="font-style: italic;"&gt;false&lt;/span&gt; into a &lt;span style="font-style: italic;"&gt;true&lt;/span&gt; and just clicking on the menu will make the track start as well.&lt;br /&gt;&lt;br /&gt;Have fun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-2568994972769452194?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/2568994972769452194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/11/flash-projects-6-making-flash-mp3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/2568994972769452194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/2568994972769452194'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/11/flash-projects-6-making-flash-mp3.html' title='Flash Projects #7 - Making a Flash MP3 Player'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-8137532535924759518</id><published>2009-09-28T21:45:00.003+01:00</published><updated>2009-09-28T21:59:38.181+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='sort'/><category scheme='http://www.blogger.com/atom/ns#' term='elearning'/><category scheme='http://www.blogger.com/atom/ns#' term='arrays'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>eLearning Business Game (Arrays in action)</title><content type='html'>My last post was all about my array sorting problem. But I thought you might want to see the final product.&lt;br /&gt;&lt;br /&gt;It was actually a game I put together to help my new students relax and get to know each other, but then I tweaked it and made it available for anyone to download.&lt;br /&gt;&lt;br /&gt;Available here: &lt;a href="http://digitalarena.co.uk/teach/markettraders/"&gt;http://digitalarena.co.uk/teach/markettraders/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The array was used in the part of the game that displays the team's performance as a graph. I needed to find a way to make the graph always fit in the available space. That meant finding the highest score and then working out a scale ratio that I could apply as the graph drew, so it always fit in the graph space.&lt;br /&gt;&lt;br /&gt;So what has this to do with arrays? Well... finding out the absolute highest score of each team's highest score meant storing them all in an array and then sorting them (lowest to highest). Then I just had to retrieve the last item in the array to get the highest.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-8137532535924759518?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/8137532535924759518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/09/elearning-business-game-arrays-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/8137532535924759518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/8137532535924759518'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/09/elearning-business-game-arrays-in.html' title='eLearning Business Game (Arrays in action)'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-3812434602573654242</id><published>2009-09-25T19:57:00.014+01:00</published><updated>2011-10-18T11:43:05.331+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='sort'/><category scheme='http://www.blogger.com/atom/ns#' term='arrays'/><title type='text'>Sorting Numeric Arrays with Actionscript</title><content type='html'>Just lately I have been having fun with arrays. Of course, I say "having fun", what I mean is having problems. Especially with sorting numerically.&lt;br /&gt;&lt;br /&gt;Arrays are really useful, they allow you to store data, select data, order it, etc. You can create them from strings and other variables, and turn them into strings and other variables. All in all, they can be very handy.&lt;br /&gt;&lt;br /&gt;I found them handy as part of a game I was writing a couple of days ago. As part of my code I needed to find the number with the highest value out of a choice of 3 numbers. The logical solution was to put all 3 numbers into an array, then sort them numerically, then retrieve the last item in the array (this should, after sorting, be the one with the highest value).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Numeric sorting is not numeric&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Let's say we start with the following array:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;var my_array:Array = [650,12,86];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then we sort them numerically:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;my_array.sort(Array.NUMERIC); //doesn't work correctly&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After this command you might &lt;i&gt;expect&lt;/i&gt; flash to order the array as:&lt;br /&gt;&lt;br /&gt;12, 86, 650&lt;br /&gt;&lt;br /&gt;But what you &lt;i&gt;actually &lt;/i&gt;get is:&lt;br /&gt;&lt;br /&gt;12, 650, 86&lt;br /&gt;&lt;br /&gt;This is because, as the Flash documentation explains, 'Numeric fields are sorted as if they were strings, so 100 precedes 99, because “1” is a lower string value than “9”. '&lt;br /&gt;&lt;br /&gt;In other words, the Numeric sort &lt;i&gt;does not sort numerically&lt;/i&gt; at all. It sorts &lt;i&gt;alphabetically&lt;/i&gt;. Odd sort of numeric, but it can't be helped, we have to find a solution.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Prepending 0s so all values have the same number of digits&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Of course this only happens because not all the values had the same number of digits. If the lower values began with a 0 then a numeric (alphabetical) sort would work correctly. So my initial plan was to use an if statement in a for loop to check for 1 digit, 2 digit and 3 digit numbers and prepend (put in front) 0s to make them all the same number of digits as follows:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;for (var i = 0; i&amp;lt;finalscores_array.length; i++) {&lt;br /&gt;&lt;br /&gt;if (finalscores_array[i]&amp;lt;=9) {&lt;br /&gt;&lt;br /&gt;finalscores_array[i] = "000"+finalscores_array[i];&lt;br /&gt;&lt;br /&gt;} else if (finalscores_array[i]&amp;lt;=99) {&lt;br /&gt;&lt;br /&gt;finalscores_array[i] = "00"+finalscores_array[i];&lt;br /&gt;&lt;br /&gt;} else if (finalscores_array[i]&amp;lt;=999) {&lt;br /&gt;&lt;br /&gt;finalscores_array[i] = "0"+finalscores_array[i];&lt;br /&gt;&lt;br /&gt;} else {&lt;br /&gt;&lt;br /&gt;finalscores_array[i] = finalscores_array[i];&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;With &lt;i&gt;for &lt;/i&gt;loops we can repeat a peice of code until a condition is met. This loop repeats for the &lt;i&gt;length&lt;/i&gt; of the array (that's the number of items in the array). It starts by checking how many digits the first array item has. Then depending on how many digits the code prepends 3, 2, 1 or no 0s. On the next repetition it checks the next array item, and so on until all array items have been checked and had the required number of 0s prepended so that they all have the same number of digits, and then the loop ends.&lt;br /&gt;&lt;br /&gt;The result is that the original values:&lt;br /&gt;&lt;br /&gt;650, 12, 86&lt;br /&gt;&lt;br /&gt;become&lt;br /&gt;&lt;br /&gt;0650, 0012, 0086.&lt;br /&gt;&lt;br /&gt;Now when we sort them numerically, it does put them in the right order:&lt;br /&gt;&lt;br /&gt;0012, 0086, 0650.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Leading 0s alter the value (it's a decimal v. octal thing)&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Wouldn't it be great if that was the end of your troubles?&lt;br /&gt;&lt;br /&gt;The problem is that if we then want to do anything with the values afterwards, like doing anything other than displaying them, we need to remove the 0s we just added. And it is not nearly as easy taking off, as putting on.&lt;br /&gt;&lt;br /&gt;The reason we have to remove the leading 0s is because Flash, like lots of other programs, does not treat numbers beginning with 0 as decimal numbers. It treats them as &lt;i&gt;&lt;a href="http://en.wikipedia.org/wiki/Octal"&gt;octal&lt;/a&gt;&lt;/i&gt;. This means that 0650 does not have the same value as plain old 650 (without the leading 0).&lt;br /&gt;&lt;br /&gt;0650, as octal, actually has the decimal value of 424.&lt;br /&gt;&lt;br /&gt;0650 is in fact a totally different number to 650.&lt;br /&gt;&lt;br /&gt;So while prepending leading 0s solves our array sorting problem, it actually changes our values. just because a leading 0 in Flash means it is an octal value, not a decimal value.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Leading 0.0 do not alter the value (it's a less than 1 thing)&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;But then I realised. Hang on a minute says I (yes, programming problems really can have you doing a good &lt;a href="http://en.wikipedia.org/wiki/Ben_Gunn_%28Treasure_Island%29"&gt;Ben Gunn&lt;/a&gt; impression). Hang on a minute says I, Flash handles numbers begining with a 0 all the time. What about 0.1, 0.2 etc. It has no problems with decimal values of less than 1.&lt;br /&gt;&lt;br /&gt;And here is my solution. Instead of using my &lt;i&gt;for&lt;/i&gt; loop to prepend just 0s, I will use it to prepend 0.0s, as follows:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;for (var i = 0; i&amp;lt;finalscores_array.length; i++) {&lt;br /&gt;&lt;br /&gt;if (finalscores_array[i]&amp;lt;=9) {&lt;br /&gt;&lt;br /&gt;finalscores_array[i] = "0.000"+finalscores_array[i];&lt;br /&gt;&lt;br /&gt;} else if (finalscores_array[i]&amp;lt;=99) {&lt;br /&gt;&lt;br /&gt;finalscores_array[i] = "0.00"+finalscores_array[i];&lt;br /&gt;&lt;br /&gt;} else if (finalscores_array[i]&amp;lt;=999) {&lt;br /&gt;&lt;br /&gt;finalscores_array[i] = "0.0"+finalscores_array[i];&lt;br /&gt;&lt;br /&gt;} else {&lt;br /&gt;&lt;br /&gt;finalscores_array[i] = "0."+finalscores_array[i];&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The result is that the original values:&lt;br /&gt;&lt;br /&gt;650, 12, 86&lt;br /&gt;&lt;br /&gt;become&lt;br /&gt;&lt;br /&gt;0.0650, 0.0012, 0.0086.&lt;br /&gt;&lt;br /&gt;Now when we sort them numerically:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;my_array.sort(Array.NUMERIC);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It does put them in the right order:&lt;br /&gt;&lt;br /&gt;0.0012, 0.0086, 0.0650.&lt;br /&gt;&lt;br /&gt;OK, I know that doing this has changed the values too, but at least they are still decimals (not a totally different numbering base). Because they are still decimals it is easily rectified, it's just a case of shifting the decimal point a few places. And we can do this by very simple multiplication...&lt;br /&gt;&lt;br /&gt;...just multiply them by 10,000.&lt;br /&gt;&lt;br /&gt;0.0012 x 10000 = 12&lt;br /&gt;0.0086 x 10000 = 86&lt;br /&gt;0.0650 x 10000 = 650&lt;br /&gt;&lt;br /&gt;So, to finish off, now we have prepended 0.0s to our original values, then sorted them, all I need to do to get the highest value is retrieve the last item from the array, and multiply it by 10000.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;var highestscore:Number = (my_array[my_array.length-1])*10000; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Faster Way&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Having made this wonderful discovery, it is good to know that all the code required to debug and investigate the problem is not necessarily needed to apply the solution. Pre-pending using the IF and ELSE&lt;b&gt;&lt;/b&gt; IF is only necessary if you want to pre-pend digits to a String (as in converting 650 to 0650). Now that we have discovered that only decimals (as in 0.650) will sort correctly there is a much simpler way to achieve this.&lt;br /&gt;&lt;br /&gt;Simply - divide the original number by 10000 (after all, we convert them back by multiplying them by 10000).&lt;br /&gt;&lt;code&gt;&lt;br /&gt;for (var i = 0; i&amp;lt;finalscores_array.length; i++) {&lt;/code&gt;&lt;br /&gt;&lt;code&gt;finalscores_array[i] = finalscores_array[i] / 10000;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;}&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I count that as 7 lines fewer code, than the pre-pending method.&lt;br /&gt;&lt;br /&gt;That's the difference between what we do to &lt;i&gt;understand&lt;/i&gt; a problem and what we do to &lt;i&gt;apply a solution&lt;/i&gt;. &lt;br /&gt;&lt;br /&gt;And there we have it. Hopefully some of you will find this helpful. Frankly I don't know why numeric sorting doesn't just work. But since it doesn't, here is a cheap and cheerful workaround - in summary:&lt;br /&gt;&lt;br /&gt;1. Divide them all by 10000 (so that every number begins "0.")&lt;br /&gt;2. Sort them&lt;br /&gt;3. Multiply them all by 10000 (so you get the original values back)&lt;br /&gt;&lt;br /&gt;Happy sorting.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-3812434602573654242?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/3812434602573654242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/09/sorting-numeric-arrays-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/3812434602573654242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/3812434602573654242'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/09/sorting-numeric-arrays-with.html' title='Sorting Numeric Arrays with Actionscript'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-7490430292826811631</id><published>2009-09-16T21:43:00.003+01:00</published><updated>2009-09-16T21:54:02.419+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='education'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>Design industry calls for "More Rounded" design graduates</title><content type='html'>This is always one issue that concerns me about my students. You get the creative ones who hate computers, then you get the computer geeks who think knowing the software will somehow make up for their lack of creativity.&lt;br /&gt;&lt;br /&gt;They are both wrong. Where interactive media is concerned anyway.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.designweek.co.uk/more-rounded-graduates-may-better-meet-industry-needs/3004277.article"&gt;Design Week&lt;/a&gt; reports that the &lt;a href="http://www.dandad.org/"&gt;D&amp;amp;AD&lt;/a&gt; Xchange conference for tutors once again highlighted the "mismatch between the kind of graduates design colleges are providing and what consultancy creative heads require".&lt;br /&gt;&lt;br /&gt;And what do design consultancies require in new graduates? In their own words "More rounded" graduates. By this they mean more creatively rounded - more understanding of creativity, more understanding of design. Rather than a 2 or 3 year higher education in design some have even suggested a 3 year foundation course in design (allowing design students to experience a wide variety of creative disciplines while developing their creativity) followed by only one year of specialisation.&lt;br /&gt;&lt;br /&gt;For some of my students that would mean not getting into the web design and interactive media technology for another 3 years - and meanwhile, they learn to be creative designers in many different media.&lt;br /&gt;&lt;br /&gt;Oddly perhaps for art &amp;amp; design (though not so odd perhaps for a wanabee web designer) many of my students seem to resist the creative development required to be an effective designer. Many are focused so much on learning the technology, they are in danger of being technically good, but creatively stunted - able to use technology, but not to solve design problems.&lt;br /&gt;&lt;br /&gt;As Neville Brody puts it: "We imagine to be able to do anything, and our software helps us believe we can... But we must move beyond the 'how' to reconsider the 'what' and the 'why'."&lt;br /&gt;&lt;br /&gt;This is my greatest fear for some of my design students. They are most interested in learning &lt;span style="font-style: italic;"&gt;how&lt;/span&gt; to do something, but ignore the important business of learning how to decide &lt;span style="font-style: italic;"&gt;what&lt;/span&gt; they should produce and &lt;span style="font-style: italic;"&gt;why&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Those who persist in making this mistake may well regret it. Leaders from the industry have spoken, they want creative people, not just technitians.&lt;br /&gt;&lt;br /&gt;If they resist the creative development aspect of their education, they may get what they want in the short term, but in the process fail to become what their employer wants.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-7490430292826811631?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/7490430292826811631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/09/design-industry-calls-for-more-rounded.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/7490430292826811631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/7490430292826811631'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/09/design-industry-calls-for-more-rounded.html' title='Design industry calls for &quot;More Rounded&quot; design graduates'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-1452693137559851800</id><published>2009-09-05T11:27:00.003+01:00</published><updated>2009-09-05T11:37:17.429+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Free'/><category scheme='http://www.blogger.com/atom/ns#' term='twitter'/><category scheme='http://www.blogger.com/atom/ns#' term='freelance'/><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>FREE eBook - The Principles of Successful Freelancing</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://twitaway.sitepoint.com/resources/images/cover-3d.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 175px; height: 254px;" src="http://twitaway.sitepoint.com/resources/images/cover-3d.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;Whether you are a Freelance, Student or work within a studio, you will probably find &lt;a href="http://www.sitepoint.com"&gt;Sitepoint's&lt;/a&gt; latest offer an interesting if not valuable read. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It's a 200 page eBook on The Principles of Successful Freelancing.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It normally costs about $30 but Sitepoint are giving it away FREE for the next 8 days.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To get the book you must either follow them on &lt;a href="http://twitaway.sitepoint.com/"&gt;Twitter &lt;/a&gt;&lt;i&gt;&lt;a href="http://twitaway.sitepoint.com/"&gt;or&lt;/a&gt;&lt;/i&gt;&lt;a href="http://twitaway.sitepoint.com/"&gt; submit your email address to their mailing list&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Sitepoint often give away selected chapters from their books as tasters, but this is the first time I have seen them give away an entire book. Clearly a good strategy for increasing their Twitter following (currently 49,662) and mailing list sign-up - we could all learn a trick there.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;GO GET IT: &lt;a href="http://twitaway.sitepoint.com/"&gt;http://twitaway.sitepoint.com/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-1452693137559851800?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/1452693137559851800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/09/free-ebook-principles-of-successful.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1452693137559851800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1452693137559851800'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/09/free-ebook-principles-of-successful.html' title='FREE eBook - The Principles of Successful Freelancing'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-4782338151236899962</id><published>2009-08-31T10:58:00.004+01:00</published><updated>2009-08-31T11:30:20.923+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='help'/><category scheme='http://www.blogger.com/atom/ns#' term='testing'/><category scheme='http://www.blogger.com/atom/ns#' term='blueonyx'/><title type='text'>Help for BlueOnyx Server Maintenance</title><content type='html'>My&lt;a href="http://dansinteractive.blogspot.com/2009/08/setting-up-your-own-testing-server.html"&gt; last post&lt;/a&gt; looked at setting up a testing server for web designers. One of the options included building your own server running &lt;a href="http://www.blueonyx.it/index.php?page=home"&gt;BlueOnyx&lt;/a&gt; for easy set-up and easy server management.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The thing that makes server management so easy is the web based interface. Originally the interface was only available for Sun Cobalt hardware, but once Cobalt was discontinued Sun Microsystems released the source code as open source. Since then others have developed it to work with any hardware (great news for us) and is most currently available as BlueOnyx.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;PDF Manual&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Because the BlueOnyx server management interface is based heavily on the sourceode for the &lt;a href="http://en.wikipedia.org/wiki/Cobalt_RaQ"&gt;Cobalt RaQ 550&lt;/a&gt;  the old RaQ 550 manual still contains some useful instruction on managing the system, and you can download it in PDF format here:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.sun.com/hardware/serverappliances/pdfs/manuals/manual.raq550.en.pdf"&gt;http://www.sun.com/hardware/serverappliances/pdfs/manuals/manual.raq550.en.pdf&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Comparisons&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The great thing about the BlueOnyx (and Cobalt RaQ) is how easy the server management interface made server management for non-techies. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Server managment after all was traditionally done through a shell interface (not unlike the windows command prompt). Setting up a web site involved manually creating users and folders, manually setting permissions and quotas, and manually editing several &lt;i&gt;config&lt;/i&gt; files without making mistakes.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What the BlueOnyx interface does (and what the Cobalt RaQ interface did) is turn this process into an interface. You simply fill in the blanks and press "go" and scripts automatically create the folders and permissions and update the config files. Happiness.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are other web based server management systems such as &lt;a href="http://www.parallels.com/products/plesk/"&gt;Plesk&lt;/a&gt; or &lt;a href="http://www.webmin.com/"&gt;Webmin&lt;/a&gt;. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Plesk is perhaps the easiest (it really is aimed at hosting companies, providing an interface for customers), but it costs money. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Webmin, is secure and powerful and popular with techies, but IMHO much more difficult to use than BlueOnyx because you still have to do many things manually. You still need to create the folders, set the permissions etc... albeit through a browser rather than a command prompt. And that requires a fair amount of technical knowledge.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;BlueOnyx arranges things differently. It assumes you have limited technical know-how, but that you do know what you want at the end, and arranges the interface into tasks rather than tools. So much easier.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-4782338151236899962?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/4782338151236899962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/help-for-blueonyx-server-maintenance.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4782338151236899962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4782338151236899962'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/help-for-blueonyx-server-maintenance.html' title='Help for BlueOnyx Server Maintenance'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-2023988711426401477</id><published>2009-08-31T08:10:00.020+01:00</published><updated>2009-08-31T10:58:11.026+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='sandbox'/><category scheme='http://www.blogger.com/atom/ns#' term='web design'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='designer'/><category scheme='http://www.blogger.com/atom/ns#' term='testing'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Setting Up Your Own Testing Server</title><content type='html'>Call it what you like, a "testbed", a "testing server", a "sandbox server", it all amounts to the same thing - a server for testing your sites, scripts, databases before you "go live".&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When it comes to web design I prefer to use Dreamweaver (in conjunction with Flash, Fireworks and occasionally Photoshop). And when it comes to static websites that's all fine, you can test them in Dreamweaver by hitting F12 and getting a preview in your browser. But for more advanced sites this will not do...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;3 good reasons why you need a testing server&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Going beyond static sites, to sites that include server-side scripts (such as PHP or Perl (CGI)) or database connections such as discussion forums, content management systems or shopping carts, it is really useful having a place to test before you "go live". Having your own server allows you to regularly test as you develop without long upload times, and without your client getting glimpses of half finished work.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It's also great for designers wanting to learn or improve their dynamic web skills. So you want to learn some PHP? So you want to learn how to get Flash to talk to a database? So you want to practice setting up and customising a content management system or shopping cart? You're going to need a server - it's a handy place to practice without needing to buy webspace.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Finally, if you want to use Dreamweaver's testing server facility when you set up your site in the "manage sites" window... you need a testing server.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Admittedly, if you have a website of your own you could use your own website host for testing and practice by shoving it in a folder separate from the rest of your site. But this is far from ideal, since your testing site will be running from a folder below the web root, when you intend to run it from the web root when you "go live". Much better is to test it as it will run when live.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Relax&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I confess that if I had not learned what I now know, the whole idea of setting up a server would be enough to send me back to bed for another couple of hours. It sounds complex, but some very clever and generous people have made it much easier than it used to be - read on.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Before we go any further - LAMP or WAMP?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Before we go further let me introduce the server platforms I will be discussing today - LAMP and WAMP.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;L&lt;/b&gt; - Linux&lt;/div&gt;&lt;div&gt;&lt;b&gt;A&lt;/b&gt; - Apache&lt;/div&gt;&lt;div&gt;&lt;b&gt;M&lt;/b&gt; - MySQL&lt;/div&gt;&lt;div&gt;&lt;b&gt;P&lt;/b&gt; - PHP&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;or&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;W&lt;/b&gt; - Windows&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;A&lt;/b&gt; - Apache&lt;/div&gt;&lt;div&gt;&lt;b&gt;M&lt;/b&gt; - MySQL&lt;/div&gt;&lt;div&gt;&lt;b&gt;P&lt;/b&gt; - PHP&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You will already be aware that Linux and Windows are operating systems, and really that is the only major distinction between the platforms above.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Apache is FREE open source web server software.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;MySQL is FREE open source database server software.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;PHP is a FREE open source server-side scripting language/engine.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Loads of websites run on LAMP or WAMP. Loads of web hosting companies use LAMP or WAMP to host websites commercially. In fact, last time I checked, Apache was the most installed web server in the world.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Loads of free web software runs on LAMP or WAMP too:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;PhpBB&lt;br /&gt;Zen Cart&lt;br /&gt;Joomla&lt;br /&gt;Drupal&lt;br /&gt;Moodle&lt;/div&gt;&lt;div&gt;To name but a few...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;All free and all running on free server software. At some point I guarantee you will want to install at least one of these for a client or for your own use, you need some practice, you will need to test it as you "skin" or "theme" it, you need a testing server running Apache, MySQL and PHP.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(Although I am not going to explain commercial alternatives in this post, you should be aware that you don't have to use FREE open source server software, a popular proprietary alternative would be Microsoft's Internet Information Server (IIS), MSSQL a database server and ASP or ASP.NET for server-side scripting. The drawback is that this all requires a commercial license. the other drawback it that I won't be explaining these today.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold; "&gt;A couple of approaches&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;There are probably many approaches you can take, but I am going to discuss what are to me 2 of the easiest options:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1. Install a server on your development computer&lt;/div&gt;&lt;div&gt;2. Set-up a server using an old computer&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's start with the first...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Install a server on your development computer - WAMP&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;This is my least favourite of the two options, but if you want something quick, and you don't have an old computer kicking around it's a good alternative. I use a Windows XP machine for web design and development, so this solution is effectively a WAMP solution.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The easiest way is to get a pre-configured bundle of Apache, MySQL and PHP and install it as an application onto your Windows machine. There are several free options, but I recommend: &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;XAMP: &lt;a href="http://www.apachefriends.org/en/xampp-windows.html"&gt;http://www.apachefriends.org/en/xampp-windows.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;or&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Apache2Triad: &lt;a href="http://apache2triad.net/"&gt;http://apache2triad.net/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;Setting-up&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Download the installer, run it, and voila, you are done.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The installer sets up all the server software you need, and creates a web root folder. To test your site all you need to do is copy the files into the web root folder and start browsing. Your new installation of Apache, MySQL and PHP will process files in or below the web root folder as though they were on a web server (in fact they are on a web server at this point).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Couldn't be simpler.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Although I have used this type of approach many moons ago with &lt;a href="http://apache2triad.net/"&gt;Apache Triad&lt;/a&gt;, and while it is quick and easy, I recently built a server on a totally separate computer, rather than installing it on my development machine, and I prefer it - I guess I just don't like to clutter my graphics workstation up with too much other software (it's sucking my resources dry man, I can feel it) - just a little harmless paranoia. Which brings me to...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Set-up a server using an old computer - LAMP - the "real deal"&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;I did this just last week as the culmination of sporadic research over several months. You might think that setting up your own server hardware and software is the stuff of IT technitians and not the realm of designers, and depending on the type of designer you are, or your background you may still want to leave it to your techie friend. But I managed it so I urge you to read on.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And of course the great thing about this approach is that you are not making a simulation of a web server, you will end up with an actual web server in every sense. Stick it in a datacentre and you really could use it to host yours and your clients websites and email (if you wanted), this is the "real deal".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And being the "real deal" it has several advantages:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1. More than one person can use it as a testing server simultaneously - which makes it ideal for web design studios with several designers, and ideal for schools/colleges/universities/education allowing more than one student to upload and test their projects.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2. Each user can have their own login and testing server space. In fact each project can have it's own server space and login.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3. FTP, HTTP, HTTPS, PHP and MySQL all work the way they should.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As a testing server it is ideal because it is a real server.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are loads of LAMP options out there, but being designers, not technitians we want one that is:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1. Easy to set-up&lt;/div&gt;&lt;div&gt;2. Easy to operate once set-up&lt;/div&gt;&lt;div&gt;3. Free - we're on a budget&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Which, after my research and experience, leaves me with one option that ticks all boxes:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;BlueOnyx: &lt;a href="http://www.blueonyx.it/"&gt;http://www.blueonyx.it/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It is described as a turnkey solution (meaning it is as easy as turning a key to get up and running) and it really is straightforward.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;Setting-up&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;1. Is your network suitable?&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Before we go any further you need to check that you are the right kind of network to have a server. Answer the following questions with a "YES" and you can go ahead:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Do you have a network hub or router with a spare LAN socket?&lt;/div&gt;&lt;div&gt;Do your other computers connect to the hub or router using ethernet cable or wireless?&lt;/div&gt;&lt;div&gt;Does the router connect to your broadband connection?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you answered "YES" to all 3 questions, then you can go ahead. Hoorah.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;2. Get your machine&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;First you need an old computer that works, but which you no longer need. the computer should have at least the following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;Processor (CPU): Reasonable speed&lt;/div&gt;&lt;div&gt;RAM: At least 256Mb&lt;/div&gt;&lt;div&gt;HDD (at least 40Gb)&lt;/div&gt;&lt;div&gt;Graphics Card: (spec irrelevant)&lt;/div&gt;&lt;div&gt;Network Card: 10/100 Mbps&lt;/div&gt;&lt;div&gt;Other Drives: Floppy, CD ROM&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The higher the spec the better, but don't worry too much, I am running a working testing server with BlueOnyx on the following very low spec machine:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Processor: PII 266MHz&lt;/div&gt;&lt;div&gt;RAM: 256Mb&lt;/div&gt;&lt;div&gt;HDD: 80Gb&lt;/div&gt;&lt;div&gt;Graphics: 8Mb&lt;/div&gt;&lt;div&gt;Network Card: 10/100 Mbps&lt;/div&gt;&lt;div&gt;Other Drives: Floppy, CD ROM&lt;/div&gt;&lt;div&gt;Sound: None&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And it all works like a dream. The fact is that my testing server doesn't have to put up with much load. It won't be experiencing thousands of visitors, only me, and in most situations a testing server probably won't have more simulaneous users than the number of designers using it. Obviously, the more users the the better your computer needs to be but the main areas of concern are:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;HDD - Improve this to hold more files&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;RAM and Processor - Improve these to handle more simultaneous visitors&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Web servers DO NOT need a good graphics card, they spend most of their time without a monitor plugged in because they are managed over the web via a web browser or &lt;a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/"&gt;shell client&lt;/a&gt;. Nor do they need a sound card.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;3. Check you don't need it&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Make sure you really don't need the machine for anything else. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Make sure you don't need any of the information on the Hard Drive. What we do next will wipe it completely. You will lose all data, software, downloads, accounts information, everything. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you are using an old windows machine with an OEM Windows XP sticker on it, you need to know that we will be wiping Windows off the machine, and you won't be able to transfer the Windows licence to another machine. OEM licenses stay with the machine.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Are you sure you can spare this machine?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;OK, let's move on.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;4. Set up the machine for install&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;For installation you need to temporarily hook up a monitor and keyboard to the computer you plan to use. Make sure it has power but don't turn it on yet. Make sure it is connected to your network hub via the ethernet port in the network card.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;5. Download and burn the BlueOnyx server set-up disk&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;The BlueOnyx set-up disc needs downloading as an ISO file and then burning to a blank CD.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Download the ISO file here:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.blueonyx.it/index.php?page=downloads"&gt;http://www.blueonyx.it/index.php?page=downloads&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once downloaded you need to burn the ISO to a blank CD.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you don't have software to burn the ISO to a blank CD, I recommend:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://download.cnet.com/CDBurnerXP/3000-2646_4-10409086.html?tag=mncol"&gt;http://download.cnet.com/CDBurnerXP/3000-2646_4-10409086.html?tag=mncol&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Burn baby burn.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;6. Install the server software&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;This is the really exciting bit. Your old computer becomes useful again as a testing server.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Open the CD ROM drawer and insert the set-up disc.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Reboot the machine.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;Booting from CD :-)&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In most cases your computer will check the CD drive first, to see if it can boot from CD. If this is the case &lt;i&gt;follow the on-screen prompts&lt;/i&gt; until installation is complete.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;MAKE SURE  you write down or remember &lt;b&gt;usernames&lt;/b&gt;, &lt;b&gt;passwords&lt;/b&gt; and &lt;b&gt;IP addresses&lt;/b&gt; you put in during installation. You will need them later.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;Not booting from CD :-(&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You will know if the computer does not boot from CD if you see Windows starting up, or nothing happens and it complains it cannot boot. If this is the case you need to make sure the computer boots from the CD ROM drive before it boots from HDD by changing the "boot order" or "boot priority" in the BIOS. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Do this by pressing reset or restarting the machine, then hitting the F8 or F10 keys as soon as it starts booting up (a note on the screen should tell you which key). &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then the BIOS menu will appear and you need to hunt around for the "boot order" or "boot priority" and set CD or Optical Drive to be FIRST.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I would show you in detail but all BIOS menus are different (get your techie friend to help if you are not sure).&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;7. After installation&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;Once the server has finished installing (you will know because it will reboot and tell you to remove the CD) it is ready to begin acting like a server.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;At this point you can unhook the monitor and then find a place where it won't get in anybody's way and plug it into the network there and switch it back on.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After a few minutes it will have booted up and you will be able to access the server via the web browser of any computer on the network and finish the set-up.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To do this simply input the IP address you gave to the server into your web browser.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You will then get lovely web interface to the server and be able to finish setting up.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;And that's a wrap&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;At this point you have a web server. Look out for a future post on how to set-up "sites" on the server so you can test your work.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you want to have a go on your own. Check my next post.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-2023988711426401477?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/2023988711426401477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/setting-up-your-own-testing-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/2023988711426401477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/2023988711426401477'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/setting-up-your-own-testing-server.html' title='Setting Up Your Own Testing Server'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-241003585304303856</id><published>2009-08-24T07:10:00.007+01:00</published><updated>2009-08-24T08:00:26.730+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cartesian'/><category scheme='http://www.blogger.com/atom/ns#' term='descartes'/><category scheme='http://www.blogger.com/atom/ns#' term='coordinates'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='geometry'/><title type='text'>Descartes Day</title><content type='html'>&lt;a href="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Cartesian-coordinate-system.svg/354px-Cartesian-coordinate-system.svg.png"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 354px; DISPLAY: block; HEIGHT: 354px; CURSOR: hand" border="0" alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Cartesian-coordinate-system.svg/354px-Cartesian-coordinate-system.svg.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;In these modern times with such a rapid pace of progress we often mistake &lt;em&gt;old&lt;/em&gt; or &lt;em&gt;antiquated &lt;/em&gt;as meaning &lt;em&gt;irrelevant.&lt;/em&gt; But we couldn't be more wrong.&lt;br /&gt;&lt;br /&gt;I learned yesterday, from a child's book, that major principles on which much of my Actionscript is based were invented (or discovered) 372 years ago in the year 1637. The man we have to thank for bothering to write his discovery (or invention) down is the mathematician and philosopher &lt;a href="http://en.wikipedia.org/wiki/Ren%C3%A9_Descartes"&gt;Rene Descartes &lt;/a&gt;(pronounced &lt;em&gt;day-cart&lt;/em&gt;).&lt;br /&gt;&lt;br /&gt;And what was this great principle? What we now take for granted, the &lt;a href="http://en.wikipedia.org/wiki/Cartesian_coordinate_system"&gt;Cartesian Coordinate System (what we refer to as X and Y coordinates).&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Allow me to quote that kid's book:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;"Graphs turn pairs of numbers represented by &lt;em&gt;x &lt;/em&gt;and &lt;em&gt;y&lt;/em&gt; into meaningful shapes. This idea was invented by the French philosopher Rene Descartes, who is perhaps more famous for saying "I think, therefore I am." It allowed people to solve geometric problems with algebra and algebraic problems with geometry."&lt;br /&gt;(Bridgman, R, &lt;a href="http://www.amazon.co.uk/1000-Inventions-Discoveries-Dk-Reference/dp/1405314192/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1251096131&amp;amp;sr=8-1"&gt;1000 Inventions and Discoveries&lt;/a&gt;, Dorling Kindersley Limited,&lt;br /&gt;2002, pp 90)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;If Descartes hadn't &lt;em&gt;invented&lt;/em&gt; the system no doubt someone else would at some point - such is human ingenuity - so I don't for one minute suggest that &lt;em&gt;_xmouse&lt;/em&gt; or &lt;em&gt;_root.movieclip._y&lt;/em&gt; would not be possible without him. But the fact that Descartes was at least one of the independent inventors, and could be bothered to record and share his invention way back in 1637, deserves him some credit. So, today I briefly doff my cap to Descartes for his coordinate system (in much the same way I might tip my hat to &lt;a href="http://en.wikipedia.org/wiki/Tim_Berners-Lee"&gt;Sir Tim Berners-Lee &lt;/a&gt;(inventor of the WWW) or Thomas Knoll (&lt;a href="http://en.wikipedia.org/wiki/Thomas_Knoll"&gt;a founder developer of Photoshop&lt;/a&gt;) were I to pass them on the street).&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://en.wikipedia.org/wiki/Cartesian_coordinate_system"&gt;Wikipedia article on Cartesian Coordinates &lt;/a&gt;is an excellent introduction, and even gives formulas for transformation, reflection and rotation of geometry (all of which could form the basis of some useful Actionscript).&lt;br /&gt;&lt;br /&gt;Just remember that with Flash the (0,0) point of the cartesian coordinate system is the top left hand corner (not the bottom left hand corner as it is with graphs).&lt;br /&gt;&lt;br /&gt;Moving on...&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-241003585304303856?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/241003585304303856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/descartes-day.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/241003585304303856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/241003585304303856'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/descartes-day.html' title='Descartes Day'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-813022858688374803</id><published>2009-08-12T17:32:00.013+01:00</published><updated>2009-09-26T11:21:14.164+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rotation'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='mouse'/><category scheme='http://www.blogger.com/atom/ns#' term='rotate'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='trigonometry'/><category scheme='http://www.blogger.com/atom/ns#' term='movieclip'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>Mouse Control for Flash Games - Part 2 - (Top Down Driving Game with Steering)</title><content type='html'>A couple of months ago &lt;a href="http://dansinteractive.blogspot.com/2009/06/mouse-control-for-flash-games.html"&gt;I posted a solution for getting a MovieClip to follow the mouse, with easing&lt;/a&gt;. It was a quick solution for controlling the 'player' in a top-down car game.&lt;br /&gt;&lt;br /&gt;Since then I have revised the code to also make the 'player' rotate in the direction of travel, to simulate the effect of the car steering.&lt;br /&gt;&lt;br /&gt;Take a look:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Original Movie (without steering) - Demo SWF&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="400" height="290"&gt;&lt;param name="_cx" value="10583"&gt;&lt;param name="_cy" value="7672"&gt;&lt;param name="FlashVars" value=""&gt;&lt;param name="Movie" value="http://www.digitalarena.co.uk/diblog/hittingandeasing.swf"&gt;&lt;param name="Src" value="http://www.digitalarena.co.uk/diblog/hittingandeasing.swf"&gt;&lt;param name="WMode" value="Window"&gt;&lt;param name="Play" value="-1"&gt;&lt;param name="Loop" value="-1"&gt;&lt;param name="Quality" value="High"&gt;&lt;param name="SAlign" value=""&gt;&lt;param name="Menu" value="-1"&gt;&lt;param name="Base" value=""&gt;&lt;param name="AllowScriptAccess" value=""&gt;&lt;param name="Scale" value="ShowAll"&gt;&lt;param name="DeviceFont" value="0"&gt;&lt;param name="EmbedMovie" value="0"&gt;&lt;param name="BGColor" value=""&gt;&lt;param name="SWRemote" value=""&gt;&lt;param name="MovieData" value=""&gt;&lt;param name="SeamlessTabbing" value="1"&gt;&lt;param name="Profile" value="0"&gt;&lt;param name="ProfileAddress" value=""&gt;&lt;param name="ProfilePort" value="0"&gt;&lt;param name="AllowNetworking" value="all"&gt;&lt;param name="AllowFullScreen" value="false"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;embed src="http://www.digitalarena.co.uk/diblog/hittingandeasing.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="400" height="290"&gt;&lt;/embed&gt;&lt;br /&gt;  &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Modified Code (with steering) - Demo SWF&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="400" height="290"&gt;&lt;param name="_cx" value="10583"&gt;&lt;param name="_cy" value="7672"&gt;&lt;param name="FlashVars" value=""&gt;&lt;param name="Movie" value="http://www.digitalarena.co.uk/diblog/topdownrotate.swf"&gt;&lt;param name="Src" value="http://www.digitalarena.co.uk/diblog/topdownrotate.swf"&gt;&lt;param name="WMode" value="Window"&gt;&lt;param name="Play" value="-1"&gt;&lt;param name="Loop" value="-1"&gt;&lt;param name="Quality" value="High"&gt;&lt;param name="SAlign" value=""&gt;&lt;param name="Menu" value="-1"&gt;&lt;param name="Base" value=""&gt;&lt;param name="AllowScriptAccess" value=""&gt;&lt;param name="Scale" value="ShowAll"&gt;&lt;param name="DeviceFont" value="0"&gt;&lt;param name="EmbedMovie" value="0"&gt;&lt;param name="BGColor" value=""&gt;&lt;param name="SWRemote" value=""&gt;&lt;param name="MovieData" value=""&gt;&lt;param name="SeamlessTabbing" value="1"&gt;&lt;param name="Profile" value="0"&gt;&lt;param name="ProfileAddress" value=""&gt;&lt;param name="ProfilePort" value="0"&gt;&lt;param name="AllowNetworking" value="all"&gt;&lt;param name="AllowFullScreen" value="false"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;embed src="http://www.digitalarena.co.uk/diblog/topdownrotate.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="400" height="290"&gt;&lt;/embed&gt;&lt;br /&gt;  &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;As you can see the rotation produced by the modified code offers more realistic looking game play, allowing the 'player' car to appear to swerve as the player moves the mouse, and making the 'player' car straighten up as it comes to the end of its movement.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Code&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The code is actually remarkably simple, much simpler than I expected. As I look back through my development versions it gets progressively simpler as I cut out all the redundant code and am left with only what matters.&lt;br /&gt;&lt;br /&gt;I will give you the code below, the comments explain how it works. Just paste it into your Flash Actionscript panel, and click the format button to make it nice and easy to read:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* Includes code from http://dansinteractive.blogspot.com http://www.digitalarena.co.uk */&lt;br /&gt;/* This code works best if your movie is set to run at 30fps. */&lt;br /&gt;&lt;br /&gt;/* The higher the frame rate the lower this number must be. */&lt;br /&gt;&lt;br /&gt;var easing = 10;&lt;br /&gt;&lt;br /&gt;/* Influences how far the player_mc rotates in response to the mouse distance from the player_mc. The lower the number the greater the rotation. */&lt;br /&gt;&lt;br /&gt;var rotatefactor = 4.5;&lt;br /&gt;&lt;br /&gt;/* This function animates the player_mc in response to mouse moving. */&lt;br /&gt;&lt;br /&gt;onEnterFrame = function () {&lt;br /&gt;&lt;br /&gt;/* Works out the current distance between the X coordinate of the mouse and the X coordinate of the player_mc */&lt;br /&gt;&lt;br /&gt;mousediff = _root._xmouse-_root.player_mc._x;&lt;br /&gt;&lt;br /&gt;/* Moves the player_mc along the X axis towards the location of the mouse with easing to provide some delay and smooth movement. */&lt;br /&gt;&lt;br /&gt;_root.player_mc._x += mousediff/easing;&lt;br /&gt;&lt;br /&gt;/* Rotates the player_mc towards the mouse. The amount of rotation is determined by the difference between the player_mc location and the mouse location along the X axis, and the rotation factor defined in the variable at the top. The closer they are together the smaller the amount of rotation, the further apart the larger the rotation.&lt;br /&gt;With the _rotation method a negative number means anti-clockwise (counter-clockwise) and a positive number means clockwise. Even so, we do NOT need to test which side of the player_mc the mouse is on to determine whether the angle of rotation should be positive or negative. This is because we base the rotation on the distance between the mouse and the player_mc, and if the mouse is to the left of the player_mc this code will return a negative number which in turn will give us a negative rotation factor. Cool.*/&lt;br /&gt;&lt;br /&gt;_root.player_mc._rotation = mousediff/rotatefactor;&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;As you can see, the whole affect is achieved without trigonometry. As such it simulates the visual appearance of the 'player' car steering, but is not a mathematically accurate model of steering. But it is only intended to provide user mouse control of a car for a simple top-down driving game - accurate physics are not necessary.&lt;br /&gt;&lt;br /&gt;The thing I am most pleased about (apart from the cool effect) is how little code it takes. Without comments, it is a mere 7 lines long. And yet it provides so much more engaging game play (I think so anyway). If you find it helpful, leave a comment.&lt;br /&gt;&lt;br /&gt;Later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-813022858688374803?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/813022858688374803/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/mouse-control-for-flash-games-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/813022858688374803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/813022858688374803'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/mouse-control-for-flash-games-part-2.html' title='Mouse Control for Flash Games - Part 2 - (Top Down Driving Game with Steering)'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-1232367917847167715</id><published>2009-08-10T12:28:00.003+01:00</published><updated>2009-08-10T12:32:32.488+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swf'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Now Includes Demo SWF Files</title><content type='html'>I have a fair number of posts on here that describe funky uses of actionscript, but without showing examples of what I am talking about.&lt;br /&gt;&lt;br /&gt;The good news is that I have now started adding demo SWFs to previous blog posts, and all future posts will include working examples by default.&lt;br /&gt;&lt;br /&gt;Hopefully this will make it that little bit easier to see if my code is doing the thing you are needing help with.&lt;br /&gt;&lt;br /&gt;What fun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-1232367917847167715?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/1232367917847167715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/now-includes-demo-swf-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1232367917847167715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1232367917847167715'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/now-includes-demo-swf-files.html' title='Now Includes Demo SWF Files'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-9025211154985668816</id><published>2009-08-07T13:23:00.010+01:00</published><updated>2009-08-10T12:23:56.931+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='interactive media'/><category scheme='http://www.blogger.com/atom/ns#' term='user'/><category scheme='http://www.blogger.com/atom/ns#' term='mouse'/><category scheme='http://www.blogger.com/atom/ns#' term='colour'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='movieclip'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Manipulating Colour in Flash - #4 - Building an Interactive Colour Mixer</title><content type='html'>Now we are beginning to see the end result of all my experiments with manipulating colour using Actionscript. Using the techniques from my previous posts, and a few others to get a working interface, this post explains how to make a simple RGB colour mixer that gives a preview of the colour and the hexadecimal value in a form that can be copy and pasted.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Demo SWF&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="400" height="290"&gt;&lt;br /&gt;    &lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/Colour%20Mixer%20Slider%201a.swf"&gt;&lt;br /&gt;    &lt;param name=quality value=high&gt;&lt;br /&gt;    &lt;embed src="http://www.digitalarena.co.uk/diblog/Colour%20Mixer%20Slider%201a.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="400" height="290"&gt;&lt;/embed&gt;&lt;br /&gt;  &lt;/object&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Interface&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;While it is very tempting for those with a graphics background to want to start by designing a groovy interface (including me), it is sometimes a good idea to get just a basic prototype working so you can get the bugs out of the code - and that's what you see here.&lt;br /&gt;&lt;br /&gt;The demo above shows my basic interface. Before we can go much further you will need to lay out something similar on your stage. The items in the demo above are labelled, check the key below:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;KEY:&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;A = MovieClip, instance name 'colourspot_mc'&lt;/em&gt;&lt;br /&gt;&lt;em&gt;B = Input Text, instance name 'red_txt', variable 'red'&lt;/em&gt;&lt;br /&gt;&lt;em&gt;C = Input Text, instance name 'green_txt', variable 'green'&lt;/em&gt;&lt;br /&gt;&lt;em&gt;D = Input Text, instance name 'blue_txt', variable 'blue'&lt;/em&gt;&lt;br /&gt;&lt;em&gt;E = Dynamic Text, variable 'displayhex'&lt;/em&gt;&lt;br /&gt;&lt;em&gt;F = MoveiClip, instance name 'redpointer_mc'&lt;/em&gt;&lt;br /&gt;&lt;em&gt;G = MovieClip, instance name 'redclicker_mc'&lt;/em&gt;&lt;br /&gt;&lt;em&gt;H = MoveiClip, instance name 'greenpointer_mc'&lt;br /&gt;I = MovieClip, instance name 'greenclicker_mc'&lt;/em&gt;&lt;br /&gt;&lt;em&gt;J = MoveiClip, instance name 'bluepointer_mc'&lt;br /&gt;K = MovieClip, instance name 'blueclicker_mc'&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;Once you have set up your objects on the stage as above, you are ready to start coding.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Code&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I won't go into long and drawn out explanations of everything this time. The colour manipulation is explained in previous posts on this blog, and other things are explained within the code as comments.&lt;br /&gt;&lt;br /&gt;NOTE: For some reason blogger is not treating this code very well. When you dump it into Flash make sure you hit the 'Format' button so it looks as it should.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;/* set default values for R, G and B */&lt;br /&gt;var red = 0;&lt;br /&gt;var green = 0;&lt;br /&gt;var blue = 0;&lt;br /&gt;/* Create colour object to control colourspot_mc */&lt;br /&gt;var my_color:Color = new Color(colourspot_mc);&lt;br /&gt;/* Button triggers conversion of RGB into hex, then applies it to the colour object */&lt;br /&gt;onEnterFrame = function() { /*This enables colour to be constantly updated */&lt;br /&gt; /* ensures that only values between 0 and 255 can be used for red */&lt;br /&gt; if (red&gt;255) {&lt;br /&gt;  red = 255;&lt;br /&gt; }&lt;br /&gt; if (red&lt;0) {&lt;br /&gt;  red = 0;&lt;br /&gt; }&lt;br /&gt; /* convert red decimal into hex */&lt;br /&gt; var decred = new Number(red);&lt;br /&gt; hexred = decred.toString(16);&lt;br /&gt; if (decred&lt;=15) {&lt;br /&gt;  hexredfinal = "0"+hexred;&lt;br /&gt; } else {&lt;br /&gt;  hexredfinal = hexred;&lt;br /&gt; }&lt;br /&gt; /* ensures that only values between 0 and 255 can be used for green */&lt;br /&gt; if (green&gt;255) {&lt;br /&gt;  green = 255;&lt;br /&gt; }&lt;br /&gt; if (green&lt;0) {&lt;br /&gt;  green = 0;&lt;br /&gt; }&lt;br /&gt; /* convert green decimal into hex */&lt;br /&gt; var decgreen = new Number(green);&lt;br /&gt; hexgreen = decgreen.toString(16);&lt;br /&gt; if (decgreen&lt;=15) {&lt;br /&gt;  hexgreenfinal = "0"+hexgreen;&lt;br /&gt; } else {&lt;br /&gt;  hexgreenfinal = hexgreen;&lt;br /&gt; }&lt;br /&gt; /* ensures that only values between 0 and 255 can be used for blue */&lt;br /&gt; if (blue&gt;255) {&lt;br /&gt;  blue = 255;&lt;br /&gt; }&lt;br /&gt; if (blue&lt;0) {&lt;br /&gt;  blue = 0;&lt;br /&gt; }&lt;br /&gt; /* convert blue decimal into hex */&lt;br /&gt; var decblue = new Number(blue);&lt;br /&gt; hexblue = decblue.toString(16);&lt;br /&gt; if (decblue&lt;=15) {&lt;br /&gt;  hexbluefinal = "0"+hexblue;&lt;br /&gt; } else {&lt;br /&gt;  hexbluefinal = hexblue;&lt;br /&gt; }&lt;br /&gt; /* build the final 6 digit hex figure and prepend with 0x as needed by Flash */&lt;br /&gt; hex = "0x"+hexredfinal+hexgreenfinal+hexbluefinal;&lt;br /&gt; /* build the final 6 digit hex figure and prepend with # as needed by HTML */&lt;br /&gt; displayhex = "#"+hexredfinal+hexgreenfinal+hexbluefinal;&lt;br /&gt; /* set the colour property of the colour object controlling the MovieClip */&lt;br /&gt; my_color.setRGB(hex);&lt;br /&gt; /* Update the location of the pointers */&lt;br /&gt; _root.redpointer_mc._x = ((_root.redclicker_mc._width/256)*red)+_root.redclicker_mc._x;&lt;br /&gt; _root.greenpointer_mc._x = ((_root.greenclicker_mc._width/256)*green)+_root.greenclicker_mc._x;&lt;br /&gt; _root.bluepointer_mc._x = ((_root.blueclicker_mc._width/256)*blue)+_root.blueclicker_mc._x;&lt;br /&gt;};&lt;br /&gt;/* Set the red decimal value with a clicker */&lt;br /&gt;_root.redclicker_mc.onPress = function () {&lt;br /&gt; redleft = _root.redclicker_mc._x;&lt;br /&gt; clickpos = _xmouse;&lt;br /&gt; clickval = clickpos-redleft;&lt;br /&gt; clickprop = (clickval/_root.redclicker_mc._width)*256;&lt;br /&gt; red = Math.floor(clickprop);&lt;br /&gt; /*moving the pointer&lt;br /&gt; _root.redpointer_mc._x = clickpos;&lt;br /&gt;}&lt;br /&gt;/* Set the green decimal value with a clicker */&lt;br /&gt;_root.greenclicker_mc.onPress = function () {&lt;br /&gt; redleft = _root.greenclicker_mc._x;&lt;br /&gt; clickpos = _xmouse;&lt;br /&gt; clickval = clickpos-redleft;&lt;br /&gt; clickprop = (clickval/_root.greenclicker_mc._width)*256;&lt;br /&gt; green = Math.floor(clickprop);&lt;br /&gt; /*moving the pointer */&lt;br /&gt; _root.greenpointer_mc._x = clickpos;&lt;br /&gt;} &lt;br /&gt;/* Set the blue decimal value with a clicker */&lt;br /&gt;_root.blueclicker_mc.onPress = function () {&lt;br /&gt; /*Getting the zero point on the clicker bar */&lt;br /&gt; redleft = _root.blueclicker_mc._x;&lt;br /&gt; /*Capturing the location of the click on the clicker bar */&lt;br /&gt; clickpos = _xmouse;&lt;br /&gt; /*Calculating how far along the clicker bar the click was made */&lt;br /&gt; clickval = clickpos-redleft;&lt;br /&gt; /*Calculating the proportional distance along the bar at which the click was made as a figure between 0 and 1, then converting that into a value between 0 and 256. */&lt;br /&gt; clickprop = (clickval/_root.blueclicker_mc._width)*256;&lt;br /&gt; /*Converting the figure to an integer by rounding DOWN to the nearest whole number. Rounding DOWN ensures we can get 0 at the bottom and 255 rather than 256 at the top. */&lt;br /&gt; blue = Math.floor(clickprop);&lt;br /&gt; /*moving the pointer object to the position clicked on the clicker bar */&lt;br /&gt; _root.bluepointer_mc._x = clickpos;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And there we have it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solving Issues as You Go&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;It is always interesting to solve some issues as you go. For instance, I hadn't quite decided whether I wanted users to be able to type RGB values, or just limit them to using the colour bars.&lt;br /&gt;&lt;br /&gt;When I decided that some users might want to be able to type them (as it might be easier and faster in some situations) I realised that some users might enter a value greater than 255 - which would then give inaccurate results. So, at the last minute I included the code that converts any number higher than 255 into 255 and any number lower than 0 into 0. Like I say, always interesting.&lt;br /&gt;&lt;br /&gt;Another implication was with the pointers on the colour bars (items F, H and J in my diagram). Making the RGB numbers updatem depending on where the user clicked, and moving the pointers to the place the user clicked was one thing. But now we had to also work it the other way, and get the pointers to move to the place on the colour bar representing the value the user typed. It wasn't difficult, just a case of working the equation the other way, but it needed doing.&lt;br /&gt;&lt;br /&gt;Sometimes seemingly small decisions about user experience can have a significant impact on our code. That doesn't mean we shouldn't put the user first, but it does mean we should be prepared to modify our code when needed. After all, our interactive applications need to actually do what the user wants, if we want any users to use them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-9025211154985668816?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/9025211154985668816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/manipulating-colour-in-flash-4-building.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/9025211154985668816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/9025211154985668816'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/manipulating-colour-in-flash-4-building.html' title='Manipulating Colour in Flash - #4 - Building an Interactive Colour Mixer'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-5234322196217127754</id><published>2009-08-06T21:49:00.004+01:00</published><updated>2009-08-06T22:26:20.599+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogger'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Google Advantages with Blogger</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_slqBonXlsN0/SntKX37gKQI/AAAAAAAAACc/amhrYpx0DP4/s1600-h/blogspot+result+2.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 199px;" src="http://1.bp.blogspot.com/_slqBonXlsN0/SntKX37gKQI/AAAAAAAAACc/amhrYpx0DP4/s320/blogspot+result+2.gif" alt="" id="BLOGGER_PHOTO_ID_5366965154953046274" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I have been using Blogger since August 2007 very happily. And though everyone has their favourite blog system, and although I have even been recommended that Wordpress is better, there is something that some bloggers may not be aware of - really fast Google indexing for Blogger posts.&lt;br /&gt;&lt;br /&gt;I don't know how long it takes for someone using Wordpress to have their blog posts begin appearing in Google. No doubt it will vary depending on the rating the blog has under the highly secret Google algorithms. But as a Blogger user I can honestly say that I have had a blog post appear in the Google search results within 2 hours of posting - this very day - and not buried pages deep either.&lt;br /&gt;&lt;br /&gt;Less than 2 hours after publishing this post:&lt;br /&gt;&lt;a href="http://dansinteractive.blogspot.com/2009/08/converting-decimal-rgb-values-into-6.html"&gt;&lt;br /&gt;http://dansinteractive.blogspot.com/2009/08/converting-decimal-rgb-values-into-6.html &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I found it on the number 1 spot on Google (out of about 13,300 results) under this search term:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;convert 2 digit hex actionscript&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Of course this is obviously related to the fact that Google owns Blogger, but the reasons are less important than the results. I almost don't care what other features other blog systems may have. Until they can beat me into the Google index I will stick with Blogger.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-5234322196217127754?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/5234322196217127754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/google-advantages-with-blogger.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5234322196217127754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5234322196217127754'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/google-advantages-with-blogger.html' title='Google Advantages with Blogger'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_slqBonXlsN0/SntKX37gKQI/AAAAAAAAACc/amhrYpx0DP4/s72-c/blogspot+result+2.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6762823695052953545</id><published>2009-08-06T20:02:00.016+01:00</published><updated>2009-08-06T21:12:23.554+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='colour'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='hexadecimal'/><title type='text'>Converting Decimal RGB Values Into a 6 Digit Hexadecimal</title><content type='html'>Recent posts have looked at the Actionscript required to convert &lt;em&gt;decimal&lt;/em&gt; numbers into &lt;em&gt;hexadecimal &lt;/em&gt;strings. And if we don't look any deeper everything looks hunkydory for mixing any colour we like using RGB values, and then convert to a hexadecimal number you might use to define a colour in HTML.&lt;br /&gt;&lt;br /&gt;But we still have a problem to solve.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Low Numbers v. High Numbers&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;HTML and Flash can both use hexadecimal values to define colours, but the hexadecimal values must be defined as a 6 digit number - 3 pairs representing the 3 colour channels Red, Green and Blue. For example:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;White: Decimal Red 255 + Green 255 + Blue 255 = Hexadecimal FFFFFF&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;In most cases this won't present a problem, after all decimal 255 equates to hexadecimal FF. The problem comes when the decimal value drops below 16. Lets take a look:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Decimal 255 = hex FF&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Decimal 16 = hex 10&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Decimal 15 = hex F&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Decimal 1 = hex 1&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Decimal 0 = hex 0&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Notice that as soon as the decimal value drops below 16 the hexadecimal value drops into single digits. Lets see what this means in practice:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Black: Decimal Red 0 + Green 0 + Blue 0 = Hexadecimal 000&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;This is a problem because to convey colour values to HTML or Flash consistently we need a &lt;em&gt;6 digit&lt;/em&gt; hexadecimal number, but what we have here is only a 3 digit number.&lt;br /&gt;&lt;br /&gt;To solve the problem we need to remember how hex counts. As an example let's count to thirty in hex:&lt;br /&gt;&lt;br /&gt;0 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E&lt;br /&gt;&lt;br /&gt;In this example values 16 and above all have 2 digits in hex. We need to find a way of making the lower numbers all have 2 digits too. This is actually very easy, in fact we do this all the time, most commonly when we write the date. Take for example 1st January 2009 written numerically - 01/01/09. We can turn a single digit number into a 2 digit number, without changing its value, very easily by placing a '0' (zero) in front (this is called prepending), like so:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;1 becomes 01&lt;/em&gt;&lt;br /&gt;&lt;em&gt;2 becomes 02&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;All we have to do then is prepend single digit hex values with a '0' (zero), like so:&lt;br /&gt;&lt;br /&gt;00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F&lt;br /&gt;&lt;br /&gt;If we do this we can display black as a 6 digit hex number after all:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Black: Decimal Red 0 + Green 0 + Blue 0 = Hexadecimal 000000&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;But how do we do this in Flash with Actionscript?&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Prepending Single Digit Hexadecimal Numbers With '0' Using Actionscript&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I am sure there are many and varied ways to do this, but I prefer the following method. First I will give you the code, then I will explain how it works.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;/* &lt;span style="color:#009900;"&gt;R&lt;/span&gt; is defined as a value between 0-255 in a text input field by the user */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;_root.calc_but.onPress = function() {&lt;br /&gt;var &lt;span style="color:#3366ff;"&gt;decimalred&lt;/span&gt; = new Number(&lt;span style="color:#009900;"&gt;R&lt;/span&gt;);&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;hexred&lt;/span&gt; = &lt;span style="color:#3366ff;"&gt;decimalred&lt;/span&gt;.toString(16);&lt;br /&gt;if (&lt;span style="color:#3366ff;"&gt;decimalred&lt;/span&gt;&lt;=15) {&lt;br /&gt;&lt;span style="color:#663333;"&gt;hexredfinal&lt;/span&gt; = "0"+&lt;span style="color:#cc33cc;"&gt;hexred&lt;/span&gt;;&lt;br /&gt;} else {&lt;br /&gt;&lt;span style="color:#663300;"&gt;hexredfinal&lt;/span&gt; = &lt;span style="color:#cc33cc;"&gt;hexred&lt;/span&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here's how it works:&lt;br /&gt;&lt;br /&gt;1. First we take the user inputted value (a number between 0 and 255) and pass it to 'decimalred' specifically defining it as a &lt;em&gt;number. &lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;2. &lt;/em&gt;Then we convert the 'decimalred' &lt;em&gt;number &lt;/em&gt;into a hexadecimal &lt;em&gt;string&lt;/em&gt; and pass the result to 'hexred'.&lt;br /&gt;&lt;br /&gt;3. Then we test to see if the original value inputted by the user was 15 or less. We do this because we already know that any decimal between 0 and 15 will convert to a &lt;em&gt;single digit&lt;/em&gt; hex number.&lt;br /&gt;&lt;br /&gt;4. If the original value inputted by the user was 15 or less, then we use Actionscript to prepend a '0' to the converted 'hexred' value like so:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;hexredfinal = "0"+hexred;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then we pass the result to 'hexredfinal'.&lt;br /&gt;&lt;br /&gt;5. If the original value inputted by the user was &lt;strong&gt;not &lt;/strong&gt;15 or less, then we don't prepend anything, we just pass the 'hexred' value straight to 'hexredfinal' untouched.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In this way we can make sure that in the conversion from decimal to hexadecimal, all values between 0 and 255 are shown as 2 digit hex numbers. This allows us to produce the 6 digit numbers required in HTML and by Flash.&lt;br /&gt;&lt;br /&gt;What fun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6762823695052953545?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6762823695052953545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/converting-decimal-rgb-values-into-6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6762823695052953545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6762823695052953545'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/converting-decimal-rgb-values-into-6.html' title='Converting Decimal RGB Values Into a 6 Digit Hexadecimal'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-1990655098869475078</id><published>2009-08-06T16:08:00.022+01:00</published><updated>2009-08-06T19:20:30.195+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='datatype conversion'/><category scheme='http://www.blogger.com/atom/ns#' term='colour'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='toString'/><category scheme='http://www.blogger.com/atom/ns#' term='hexadecimal'/><title type='text'>Manipulating Colour in Flash - #3 - Successfully Converting Decimal to Hexadecimal Using the toString Method (even with user defined variables)</title><content type='html'>My last two posts looked at how you can use Actionscript to change the colour of a MovieClip, and to convert decimal colour values into hexadecimal.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Teething Trouble&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;But as I work towards harnessing these techniques to make a simple colour mixer in Flash I suddenly ran into difficulty converting decimal to hexadecimal when the &lt;em&gt;user&lt;/em&gt; defines the decimal values in text input fields.&lt;br /&gt;&lt;br /&gt;I must confess that to begin with I spent a while being stumped by this. As I Googled around for a solution there were similar questions, but no answers. Anyway, I am happy to say, &lt;em&gt;there is a solution. &lt;/em&gt;&lt;br /&gt;&lt;br /&gt;No doubt some of you will have a similar problem, so let me talk you through the problem I experienced and then the solution (I hope it helps).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Problem&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In my tests the toString method easily converted a decimal defined as a variable in a keyframe to a hexadecimal as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;/* This works */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;var &lt;span style="color:#009900;"&gt;R&lt;/span&gt; = &lt;span style="color:#009900;"&gt;255&lt;/span&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;mybutton_but.onPress = function () {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;hex = &lt;span style="color:#009900;"&gt;R&lt;/span&gt;.toString(16);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;font-size:85%;"&gt;trace(hex); &lt;span style="color:#009900;"&gt;//Returns FF&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;However, when the value of &lt;span style="font-family:courier new;"&gt;R&lt;/span&gt; was defined by the user through a text input box it suddenly stopped working, as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;/* This DOESN'T work */&lt;br /&gt;/* value of &lt;span style="color:#009900;"&gt;R&lt;/span&gt; is defined as &lt;span style="color:#009900;"&gt;255&lt;/span&gt; in a text input field by the user */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;mybutton_but.onPress = function () {&lt;br /&gt;hex = &lt;span style="color:#009900;"&gt;R&lt;/span&gt;.toString(16);&lt;br /&gt;trace(hex); &lt;span style="color:#ff0000;"&gt;//Returns 255&lt;br /&gt;&lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For some reason, when the value of R was defined in the keyframe the toString method successfully converted the decimal value &lt;em&gt;255 &lt;/em&gt;and returned &lt;em&gt;FF&lt;/em&gt;, but when the value of R was defined in a text input field the toString method &lt;em&gt;failed to perform any conversion&lt;/em&gt; on the decimal value &lt;em&gt;255&lt;/em&gt; and returned &lt;em&gt;255&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Preparing to Find a Solution&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;When I struggle with solving these niggly little problems I often find that taking some time out and doing something else gives the mind time to unwind (and also mull over the problem without having to try out every idea instantly). The brain is a fantastic problem solver, &lt;em&gt;if&lt;/em&gt; it is given the right conditions. As a college lecturer I know that the ideal conditions come when an individual is relaxed but alert. So, if needed, take a break, unwind, get some sleep or remove distractions. I spent the morning cutting the grass and sorting out the chickens, then in the afternoon found the solution.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Solution&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;As I said before, none of my Googling revealed an answer to my problem, but as I hunted around for anything I could find that might give me a hint, or prompt an idea &lt;a href="http://en.wikibooks.org/wiki/ActionScript_Programming/PartI/Chapter_3/Number,Boolean,Date#toString"&gt;I came across this snippet on WikiBooks.org&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var i = new Number(555);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;trace(i.toString());&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I must have seen several similar examples yesterday evening and got nothing from them (too tired no doubt). But having taken a break from the problem since then, and relaxed, my brain was ready to spot the significant detail that was the solution:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var i = &lt;span style="color:#009900;"&gt;new Number&lt;/span&gt;(555);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And there it was, staring out at me. Something I had not yet tried. So I modified my code as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;/* This DOES work */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;/* value of &lt;span style="color:#009900;"&gt;R&lt;/span&gt; is defined as &lt;span style="color:#009900;"&gt;255&lt;/span&gt; in a text input field by the user */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;mybutton_but.onPress = function () {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;var decimalred = new Number(&lt;span style="color:#009900;"&gt;R&lt;/span&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;hexred = decimalred.toString(16);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;trace(hexred); &lt;span style="color:#009900;"&gt;//Returns FF&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Why it Works&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;So why didn't it work before, and what's the big difference that makes it work this time?&lt;br /&gt;&lt;br /&gt;I suspect that the reason it did not work before was because the user defined variable 'R' was already being treated by Flash as a &lt;em&gt;string&lt;/em&gt; and so using the &lt;em&gt;toString&lt;/em&gt; method to convert to a &lt;em&gt;string&lt;/em&gt; did nothing, because it was already a string to start with.&lt;br /&gt;&lt;br /&gt;Result: 255 (string) in, 255 (string) out.&lt;br /&gt;&lt;br /&gt;The solution is really hidden within the problem (as are so many design solutions). We are converting a &lt;em&gt;decimal&lt;/em&gt; value (representing a colour channel intensity) into its &lt;em&gt;hexadecimal&lt;/em&gt; equivalent. We want to do this using the &lt;em&gt;toString&lt;/em&gt; method. However, the &lt;em&gt;toString&lt;/em&gt; method is for &lt;em&gt;datatype conversion&lt;/em&gt;. This means converting one datatype to another datatype, in this case a non-string into a string. For this to work we need to force Flash to treat the user input 'R' as a &lt;em&gt;number&lt;/em&gt; so that we can use &lt;em&gt;toString &lt;/em&gt;to convert it into a &lt;em&gt;string &lt;/em&gt;in hex format.&lt;br /&gt;&lt;br /&gt;The script above does this by passing the user defined decimal value 'R' to a new variable 'decimalred' - with 'decimalred' specifically defined as being a &lt;em&gt;new Number&lt;/em&gt;. This forces Flash to treat the user defined value as a &lt;em&gt;number datatype&lt;/em&gt; thereby allowing &lt;em&gt;toString&lt;/em&gt; to work as expected and convert the decimal &lt;em&gt;number&lt;/em&gt; value to a hexadecimal &lt;em&gt;string.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Result: 255 (number) in, FF (string) out.&lt;br /&gt;&lt;br /&gt;And that's a wrap.&lt;br /&gt;&lt;br /&gt;It is precisely this kind of problem that I see as being the drawback of having come to Flash and Actionscript from a graphic design, rather than a programming background. Nevertheless, I hope that by posting my solution I have helped at least one other poor designer get to grips with with one small area of Actionscript. If my Googling is anything to go by, this may well be the only explanation of this problem on the web (at time of posting of course).&lt;br /&gt;&lt;br /&gt;Happy coding.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-1990655098869475078?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/1990655098869475078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/manipulating-colour-in-flash-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1990655098869475078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1990655098869475078'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/manipulating-colour-in-flash-3.html' title='Manipulating Colour in Flash - #3 - Successfully Converting Decimal to Hexadecimal Using the toString Method (even with user defined variables)'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6956661349579539868</id><published>2009-08-04T18:19:00.010+01:00</published><updated>2009-08-04T21:54:34.413+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='colour'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Manipulating Colour in Flash - #2 - Dynamically Changing MovieClip Colour</title><content type='html'>&lt;a href="http://dansinteractive.blogspot.com/2009/08/manipulating-colour-in-flash-1.html"&gt;Converting decimal colour values into hexadecimal&lt;/a&gt; is one part of the puzzle, but then we have to use the result to dynamically change the colour of a MovieClip.&lt;br /&gt;&lt;br /&gt;One of the inconsistent(?), and certainly annoying things about Flash is the way you modify the colour of a MovieClip with Actionscript. We already know you can modify various attributes of a MovieClip such as _height, _width, _x, _y, _rotation... &lt;em&gt;but&lt;/em&gt; there is &lt;strong&gt;no attribute for colour.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Colour Object&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;What you have to do instead is create a create a colour Object which in turn controls the colour of the MovieClip. It's not difficult, take this as an example:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var my_color:Color = new Color(MovieClipName_mc);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this code we call the object 'my_color' and in the parenthesis we specify the instance name of the MovieClip the colour object will be controlling the colour of, in this case a MovieClip called 'MovieClipName_mc' - you can of course name your MovieClip differently, provided you specify its name in the parenthesis as above.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Changing the Colour&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;We know the name of the colour object - 'my_color' - so now we can tell Flash the colour value of that object in hexadecimal (just as we would specify a colour in HTML). Here's the code:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;my_color.setRGB(0xFFFFFF);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In HTML we prefix a hexadecimal colour value with '#' as in '#FFFFFF'. In Actionscript we prefix with '0x' as above '0xFFFFFF'.&lt;br /&gt;&lt;br /&gt;FFFFFF of course represents the colour White (if white is a colour), if you change this value in the script above the MovieClip specified in the colour object will adopt the same colour.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Practical Use&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;That explains the principles of how we can use a colour object to control the colour of a MovieClip, but how about a practical example...&lt;br /&gt;&lt;br /&gt;1. Create an object on the stage, select it and hit F8 to turn it into a MovieClip. Give the MovieClip the instance name of 'colourthing_mc'.&lt;br /&gt;&lt;br /&gt;2. Create a new layer, name it 'Actions', then select the first frame of the layer.&lt;br /&gt;&lt;br /&gt;3. Now create a Dynamic Text Box of the Input variety on the stage. In the properties panel set the variable to be '_root.usercolour', the reason for this will be explained in my comments below.&lt;br /&gt;&lt;br /&gt;4. Now create a Button on the stage and give it the instance name 'calc_but'.&lt;br /&gt;&lt;br /&gt;And that's the easy bit, now for the easy code:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;/* This is one of those really silly things about Flash. Instead of having a colour attribute like they have _width and _height attributes, you have to create a colour Object which in turn controls the colour of a specified MovieClip. Here's how you do it: */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;var my_color:Color = new Color(colourthing_mc);&lt;br /&gt;&lt;br /&gt;/* This next step sets up for allowing the user to specify the colour of the MovieClip. */&lt;br /&gt;&lt;br /&gt;/* First we create the user controlled variable */&lt;br /&gt;&lt;br /&gt;var usercolour = "000000";&lt;br /&gt;&lt;br /&gt;/* Then we create another variable that is the result of formatting 'usercolour' as required for Flash to understand it as a hexadecimal value by pre-pending it with '0x' */&lt;br /&gt;&lt;br /&gt;var hexusercolour = "0x"+usercolour;&lt;br /&gt;&lt;br /&gt;/* Then we setRGB of 'my_color' to that hexadecimal value */&lt;br /&gt;&lt;br /&gt;my_color.setRGB(hexusercolour);&lt;br /&gt;&lt;br /&gt;/* All that remains is to create a dynamic text box that allows the user to input their own hex value for the 'usercolour' variable and a button that will update the 'my_color' value with the user value from the text box, whenever it is clicked.&lt;br /&gt;&lt;br /&gt;The important thing to remember when setting up the text input box, is to se the variable very precisely. If the variable it is updating is in the root timeline, then you must define the variable in the text box as '_root.variablename' not simply 'variablename'. In this case the variable for the text box must be '_root.usercolour'. */&lt;br /&gt;&lt;br /&gt;/* This code then makes the button update the colour object with the user specified value. */&lt;br /&gt;&lt;br /&gt;_root.calc_but.onPress = function () {&lt;br /&gt;var hexusercolour = "0x"+usercolour;&lt;br /&gt;my_color.setRGB(hexusercolour);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;And that should be it. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;Now we have been able to change the colour of an object through user input of the hex value. This could be developed further to allow the user to change the value by using sliders. This will require us to change 0-255 values into hex values on the fly. But knowing what we know from my &lt;a href="http://dansinteractive.blogspot.com/2009/08/manipulating-colour-in-flash-1.html"&gt;previous post&lt;/a&gt;, this shouldn't be too hard. &lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6956661349579539868?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6956661349579539868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/manipulating-colour-in-flash-2.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6956661349579539868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6956661349579539868'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/manipulating-colour-in-flash-2.html' title='Manipulating Colour in Flash - #2 - Dynamically Changing MovieClip Colour'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-485486482580915353</id><published>2009-08-03T21:36:00.003+01:00</published><updated>2009-08-03T21:51:03.165+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='colour'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='toString'/><category scheme='http://www.blogger.com/atom/ns#' term='hexadecimal'/><category scheme='http://www.blogger.com/atom/ns#' term='convert'/><title type='text'>Manipulating Colour in Flash - #1</title><content type='html'>Following on from my previous post, I have begun to look into how I can use Actionscript to work with colour.&lt;br /&gt;&lt;br /&gt;This experiment looks at how we can convert &lt;span style="font-style: italic;"&gt;decimal&lt;/span&gt; RGB values into &lt;span style="font-style: italic;"&gt;hexadecimal &lt;/span&gt;using Actionscript.&lt;br /&gt;&lt;br /&gt;It's very simple...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: courier new;"&gt;/* First we set the RGB values as decimal integers (whole numbers) from 0-255, as you would see them defined in any graphics program. This example would reproduce white, but you can change the values to be anything you like between 0-255. */&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new;"&gt;var R = 255;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;var G = 255;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;var B = 255;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;/* Then we convert the RGB decimals to their hexadecimal equivalents. The toString method is the easiest way I have found of doing it (&lt;a href="http://www.amazon.co.uk/ActionScript-Flash-Pocket-Reference-Programmers/dp/0596005148/ref=sr_1_2?ie=UTF8&amp;amp;s=books&amp;amp;qid=1249332415&amp;amp;sr=1-2"&gt;thanks to Colin Moock&lt;/a&gt;). This script takes the value of each of the variables and converts the datatype from a numeric value &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: courier new;"&gt;(in this case 255) &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: courier new;"&gt;into a string using '16' as the radix argument of the method. As a result 255 becomes FF, the hexadecimal equivalent. The code below then simply stitches the converted values of the R, G and B variables together to form a 6 digit hex number for the colour. */&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new;"&gt;trace(R.toString(16)+G.toString(16)+B.toString(16)); //Returns FFFFFF&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;What I like about this method is its simplicity. It would form the basis of a very simple colour mixer program, since the R, G and B values could easily be set by sliders, or the user keying in &lt;span style="font-style: italic;"&gt;decimal&lt;/span&gt; values for each of the channels.&lt;br /&gt;&lt;br /&gt;Over to you... meanwhile, I play with colour some more.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-485486482580915353?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/485486482580915353/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/manipulating-colour-in-flash-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/485486482580915353'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/485486482580915353'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/manipulating-colour-in-flash-1.html' title='Manipulating Colour in Flash - #1'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-7139589634359973765</id><published>2009-08-03T18:02:00.009+01:00</published><updated>2009-08-03T19:10:02.856+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='colour'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Thoughts on Colour</title><content type='html'>Colour is a fascinating thing. As a child there was always that wonder of discovery that went with mixing colours to make new colours... always resulting in that grimy brown in the end.&lt;br /&gt;&lt;br /&gt;I have since learned that as a child I was playing with subtractive colour, the mixing of pigments to subtract from white and make black. Meanwhile your computer monitor uses additive colour, mixing light to add to black and make white.&lt;br /&gt;&lt;br /&gt;It gets even more interesting when you introduce colour wheels and start to notice the relationships between primary, secondary and tertiary colours. Or the difference between tint, hue and shade, or complementary colours and colours in common.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;16 Million&lt;/span&gt; +&lt;br /&gt;&lt;br /&gt;Computers make mixing colours so easy, in fact, with the right tools it becomes less about art or aesthetics and more about mathematics. Did you know for instance that the 16 million or so colours your monitor can display are made up of just 3 colours, red, green and blue? Each of these is called a channel, a red channel, a green channel and a blue channel. In fact your computer can display 256 increments (levels of colour strength) on each channel and by mixing those colours in different amounts you get all the colours available to your monitor.&lt;br /&gt;&lt;br /&gt;Just think about it, 3 colour channels, 256 increments of each to mix:&lt;br /&gt;&lt;br /&gt;256 x 256 x 256 = 16,777,216 possible colours&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Decimal v. Hexadecimal&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In decimal we count from 0 to 9 before starting over, giving us 10 increments. like so:&lt;br /&gt;&lt;br /&gt;0 1 2 3 4 5 6 7 8 9&lt;br /&gt;&lt;br /&gt;Using &lt;span style="font-style: italic;"&gt;decimal&lt;/span&gt; to define colour we start with 0 as the lowest colour value, and end with 255 as the highest, giving 256 increments.&lt;br /&gt;&lt;br /&gt;However, HTML (and at times Flash) prefers &lt;span style="font-style: italic;"&gt;hexadecimal&lt;/span&gt; which differs from decimal in that we count from 0 to 15 before starting over, giving us 16 increments. Like so:&lt;br /&gt;&lt;br /&gt;0 1 2 3 4 5 6 7 8 9 A B C D E F&lt;br /&gt;&lt;br /&gt;Using&lt;span style="font-style: italic;"&gt; hexadecimal&lt;/span&gt; to define colour we start with 00 as the lowest colour value, and end with FF as the highest, giving 256 increments also.&lt;br /&gt;&lt;br /&gt;We can say that a &lt;span style="font-style: italic;"&gt;decimal&lt;/span&gt; 255 and a &lt;span style="font-style: italic;"&gt;hexadecimal&lt;/span&gt; FF are of equal value. They represent the same number. Likewise a &lt;span style="font-style: italic;"&gt;decimal&lt;/span&gt; 0 and a &lt;span style="font-style: italic;"&gt;hexadecimal&lt;/span&gt; 00 are also equal.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Defining Colour Values Numerically&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A present we are looking at specifying RGB colour, that is colour defined by the amounts of Red, Green and Blue in their makeup.&lt;br /&gt;&lt;br /&gt;When defining RGB colour numerically, it is vital to remember the order of the colour channels. It is &lt;span style="font-weight: bold;"&gt;always&lt;/span&gt; Red, then Green, then Blue. Take the following &lt;span style="font-style: italic;"&gt;decimal &lt;/span&gt;example:&lt;br /&gt;&lt;br /&gt;255,192,128&lt;br /&gt;&lt;br /&gt;Knowing the order of the colour channels means we can understand that this means the Red channel is on full blast at 255, the green channel is at three-quarter strength at 192 and the blue channel is at about half strength at 128.&lt;br /&gt;&lt;br /&gt;Using &lt;span style="font-style: italic;"&gt;hexadecimal&lt;/span&gt; we would write the same colour as:&lt;br /&gt;&lt;br /&gt;FFC080&lt;br /&gt;&lt;br /&gt;The first 2 digits are the red channel, the second 2 digits the green channel and the last 2 digits the blue channel.&lt;br /&gt;&lt;br /&gt;Fascinating stuff.&lt;br /&gt;&lt;br /&gt;Anyway, as a result of my interest in digital colour, I have decided to take the plunge and see how Flash can be used to manipulate colour. From my initial reading an understanding of the above will be vital to colour manipulation with Actionscript.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-7139589634359973765?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/7139589634359973765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/thoughts-on-colour.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/7139589634359973765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/7139589634359973765'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/08/thoughts-on-colour.html' title='Thoughts on Colour'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-270552567632074123</id><published>2009-07-27T19:55:00.014+01:00</published><updated>2009-08-10T12:02:01.251+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='alternative'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='navigation'/><title type='text'>Sliding-Page Effect - Navigation in Flash</title><content type='html'>The other thing that &lt;a href="http://www.fuelfugitives.com/"&gt;http://www.fuelfugitives.com/&lt;/a&gt; got me interested in was the way the navigation works. The wonder of Flash is that you don't load a new "page" when you click a "link" (or button). In fact anything can happen - make a noise, play a video, basically anything you can imagine and code. This means we are not constrained to the traditional ideas of navigation transitions from "page" to "page".&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.fuelfugitives.com/"&gt;Fuel Fugitives&lt;/a&gt; utilises a nice idea I have seen a few times. Instead of simply &lt;em&gt;changing&lt;/em&gt; to another "page" or screen, you slide gracefully from one place to another, as though all the "pages" are actually on the same sheet, you just change which part of the sheet you are looking at.&lt;br /&gt;&lt;br /&gt;Well, unable to resist the challenge I decided to work out a way of getting the same effect myself, using Flash and AS2.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Let's get started&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="400" height="290"&gt;&lt;br /&gt;  &lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/jumpslide4.swf"&gt;&lt;br /&gt;  &lt;param name=quality value=high&gt;&lt;br /&gt;  &lt;embed src="http://www.digitalarena.co.uk/diblog/jumpslide4.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="400" height="290"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;1. Create a new Actionscript 2 document and set the frame rate to &lt;em&gt;30fps&lt;/em&gt;.&lt;/p&gt;&lt;p&gt;2. Create an object on the stage, hit F8 and convert it into a MovieClip, with the registration set to the &lt;em&gt;middle&lt;/em&gt;.&lt;/p&gt;&lt;p&gt;3. Create 3 more instances of the MovieClip (for a total of 4), space them out, and give them the instance names &lt;em&gt;object1_mc, object2_mc, object3_mc, &lt;/em&gt;and &lt;em&gt;object4_mc&lt;/em&gt;.&lt;/p&gt;&lt;p&gt;4. Select (using SHIFT) &lt;em&gt;all&lt;/em&gt; of the instances of the MovieClip on the stage, then hit F8 and convert the group into a MovieClip with the registration set to the &lt;em&gt;top left. &lt;/em&gt;This new MovieClip should contain all the other clips on the stage. Give this new MovieClip the instance name &lt;em&gt;objholder_mc.&lt;/em&gt;&lt;/p&gt;&lt;p&gt;Once that's done it's time for the Actionscript.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;The Actionscript&lt;/strong&gt;&lt;/p&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;/* First we set a variable called currobj. This will store the name (or in this case number) of the movieclip we want centred on the stage. We will use it later to centre that movieclip if it is not already centred. */ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;var currobj = 1; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;/* Now we need some easing to give the slide animation a bit of style */&lt;br /&gt;var easing = 6;&lt;br /&gt;&lt;br /&gt;/* Then we set variables to define the centrepoint we want to centre movieclips to. */&lt;br /&gt;&lt;br /&gt;var hmiddle = Stage.width/2;&lt;br /&gt;var vmiddle = Stage.height/2;&lt;br /&gt;&lt;br /&gt;/* Then we create the function that moves the current movieclip (defined by currobj) to the centre (defined by hmiddle and vmiddle). */&lt;br /&gt;&lt;br /&gt;onEnterFrame = function () {&lt;br /&gt;&lt;br /&gt;/* Finding the difference between the object holder x and y and the centre x and y */&lt;br /&gt;objh_v = _root.objholder_mc._y;&lt;br /&gt;objh_h = _root.objholder_mc._x;&lt;br /&gt;vdiff = vmiddle-objh_v;&lt;br /&gt;hdiff = hmiddle-objh_h;&lt;br /&gt;&lt;br /&gt;/* Finding the object x and y within object holder. By using the ["object"+currobj+"_mc"] the code works for every object, all we need to do is update the value of the currobj variable. This means that we can keep our code small and reusable. */&lt;br /&gt;&lt;br /&gt;obj_h = _root.objholder_mc["object"+currobj+"_mc"]._x;&lt;br /&gt;obj_v = _root.objholder_mc["object"+currobj+"_mc"]._y;&lt;br /&gt;&lt;br /&gt;/* Finding the difference between the current object (currobj) x and y and the centre x and y */&lt;br /&gt;&lt;br /&gt;finalvdiff = vdiff-obj_v;&lt;br /&gt;finalhdiff = hdiff-obj_h;&lt;br /&gt;&lt;br /&gt;/* Finally we get onto the animation. This basically tells the objholder x and y to move so that the currobj MovieClip inside objholder is centred. All the calculations up to now allowed us to find out exactly where objholder needed to move to for this to happen. So that we get the easing effect on the animation, objholder only moves just under half the actual distance to its destination on each frame (this is controlled by the easing variable). */&lt;br /&gt;&lt;br /&gt;_root.objholder_mc._y += finalvdiff/easing;&lt;br /&gt;_root.objholder_mc._x += finalhdiff/easing;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;/* Making the objects act as links to the next object. I am working on a way to write this code only once for any number of objects, on the basis of telling Flash the total number of objects, but not there yet. meanwhile we need a function for each object manually telling it to go to the next by setting the currobj value to the next object. */&lt;br /&gt;&lt;br /&gt;_root.objholder_mc.object1_mc.onPress = function () {&lt;br /&gt;currobj = 2;&lt;br /&gt;};&lt;br /&gt;_root.objholder_mc.object2_mc.onPress = function () {&lt;br /&gt;currobj = 3;&lt;br /&gt;};&lt;br /&gt;_root.objholder_mc.object3_mc.onPress = function () {&lt;br /&gt;currobj = 4;&lt;br /&gt;};&lt;br /&gt;_root.objholder_mc.object4_mc.onPress = function () {&lt;br /&gt;currobj = 1;&lt;br /&gt;};&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Over to you...&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;As you can see, the code is fairly straightforward (hopefully the comments explain how it works). But so far all we have is the mechanics, to be really effective you need to have good graphics to go with it. A good idea!&lt;/p&gt;&lt;p&gt;That's what &lt;a href="http://www.fuelfugitives.com/"&gt;Fuel Fugitives&lt;/a&gt; has, now over to you.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-270552567632074123?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/270552567632074123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/07/sliding-page-effect-navigation-in-flash.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/270552567632074123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/270552567632074123'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/07/sliding-page-effect-navigation-in-flash.html' title='Sliding-Page Effect - Navigation in Flash'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-1136818829704251184</id><published>2009-07-27T10:03:00.008+01:00</published><updated>2009-07-27T16:30:27.174+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='url'/><category scheme='http://www.blogger.com/atom/ns#' term='swfaddress'/><category scheme='http://www.blogger.com/atom/ns#' term='deep linking'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Controling Flash Navigation through the URL</title><content type='html'>Just came across this site &lt;a href="http://www.fuelfugitives.co.uk/"&gt;http://www.fuelfugitives.co.uk/&lt;/a&gt; which uses the URL in a really interesting way to allow you to access different parts of a Flash Movie depending on the URL. Even though it is the same Flash Movie, not different pages.&lt;br /&gt;&lt;br /&gt;This is useful because it means you can bookmark or "add to favourites" a specific part of the Flash Movie. It also means you can use your browser back button to return to a previous part of the same movie (normally with Flash this would result in you leaving the page containing the embedded movie).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;So how did they do it?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I'm still looking into that, but a quick view of the source code indicates that some cool javascript is the answer. Will investigate more later... meanwhile - gardening.&lt;br /&gt;&lt;br /&gt;Having cleared nigh on 168 square feet of garden (and finding bricks, carpet, bags of clothes and all manner of rubbish buried there by previous owners) with the help of a brother, I have come back to find the answer, and after a bit of searching found if not &lt;em&gt;the&lt;/em&gt; solution, &lt;em&gt;a &lt;/em&gt;solution...&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;And the answer is...&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://www.asual.com/swfaddress/"&gt;http://www.asual.com/swfaddress/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To quote the website:&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;SWFAddress is a small, but powerful library that provides deep linking for&lt;br /&gt;Flash and Ajax. It's a developer tool, allowing creation of unique virtual URLs&lt;br /&gt;that can point to a website section or an application state. SWFAddress enables&lt;br /&gt;a number of important capabilities which are missing in today's rich web&lt;br /&gt;technologies including:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Bookmarking in a browser or social website&lt;/li&gt;&lt;li&gt;Sending links via email or instant messenger&lt;/li&gt;&lt;li&gt;Finding specific content with the major search engines&lt;/li&gt;&lt;li&gt;Utilizing browser history and reload buttons&lt;/li&gt;&lt;/ul&gt;&lt;/blockquote&gt;&lt;p&gt;There are some &lt;a href="http://www.asual.com/swfaddress/samples/flash/"&gt;cool little demos &lt;/a&gt;too so you can see it in action, and sure enough, seems to be pretty much what I saw on &lt;a href="http://www.fuelfugitives.co.uk/"&gt;http://www.fuelfugitives.co.uk/&lt;/a&gt;, the site that started me looking in the first place.&lt;/p&gt;&lt;p&gt;So that seems to be it. One more thing to add to my todo list, but I fully intend to put this to good use this holiday. I hope you find it useful as well.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-1136818829704251184?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/1136818829704251184/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/07/controling-flash-navigation-through-url.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1136818829704251184'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1136818829704251184'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/07/controling-flash-navigation-through-url.html' title='Controling Flash Navigation through the URL'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-8301453076721130145</id><published>2009-07-24T21:31:00.012+01:00</published><updated>2009-08-10T11:59:15.755+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Drag n' Drop (with momentum) in Flash</title><content type='html'>&lt;a href="http://www2.smarttech.com/NR/rdonlyres/BF9D38DD-C330-4705-9451-7952543B3963/0/smarttableimage_03.jpg"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 361px; DISPLAY: block; HEIGHT: 270px; CURSOR: hand" border="0" alt="" src="http://www2.smarttech.com/NR/rdonlyres/BF9D38DD-C330-4705-9451-7952543B3963/0/smarttableimage_03.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A few weeks ago I had the opportunity to attend a &lt;a href="http://www.jisc.ac.uk/whatwedo/themes/elearning.aspx"&gt;JISC&lt;/a&gt; e-learning event. A fair number of educational technology vendors were present promoting their latest products and services, but for a brief moment one thing caught my eye. The SMART Technologies &lt;a href="http://www2.smarttech.com/st/en-US/Products/SMART+Table/default.htm"&gt;SMART Table&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It wasn't so much the idea of the SMART Table that intrigued me but the interactivity it offered. The e-learning game running on the table at the time was a diagram of the human body on which the students would have to correctly identify the different body parts by dragging labels onto them from the edge of the screen. As they were dragged the labels would turn as though being pulled by little strings, then when released would continue on to a gentle stop as though they had their own momentum.&lt;br /&gt;&lt;br /&gt;I thought that idea of dragging and dropping labels that had weight and momentum was really cool, and I immediately realised that you could do a similar thing using flash.&lt;br /&gt;&lt;br /&gt;Well, now that the first evening of my holiday is here I have begun work and have a basic solution for the momentum part of it (I will add the turning and following part another day when that is done).&lt;br /&gt;&lt;br /&gt;So here it is, drag and drop, with momentum, in Flash:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Here's it is&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="400" height="290"&gt;&lt;br /&gt;  &lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/dragndrop%20with%20slide3.swf"&gt;&lt;br /&gt;  &lt;param name=quality value=high&gt;&lt;br /&gt;  &lt;embed src="http://www.digitalarena.co.uk/diblog/dragndrop%20with%20slide3.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="400" height="290"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;If you are not yet an AS3 whizz or using an older version of Flash, don't worry, this one uses AS2.&lt;br /&gt;&lt;br /&gt;Let's get going.&lt;br /&gt;&lt;br /&gt;1. Create a new AS2 document.&lt;br /&gt;&lt;br /&gt;2. Create a shape on the stage, select it and hit F8, then turn it into a MovieClip&lt;br /&gt;&lt;br /&gt;3. Give the new MovieClip the instance name of &lt;em&gt;object_mc&lt;/em&gt; in the Properties panel.&lt;br /&gt;&lt;br /&gt;And that's the easy bit done. Now for the ActionScript.&lt;br /&gt;&lt;br /&gt;4. Create a new layer in the timeline and give it the name &lt;em&gt;Actions.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;5. Select the first frame of the &lt;em&gt;Actions&lt;/em&gt; layer, then hit F9 to open the Actions panel.&lt;br /&gt;&lt;br /&gt;5. Input the following code into the Actions panel (hopefully my comments will explain everything, if not, leave a comment):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;/* set some variables we will use later */ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;var posBh = 0;&lt;br /&gt;var posBv = 0;&lt;br /&gt;var posAh = 0;&lt;br /&gt;var posAv = 0;&lt;br /&gt;var trajh = 0;&lt;br /&gt;var trajv = 0;&lt;br /&gt;var drag = 0; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;/* sets the level of friction, the higher the number, the more friction.*/ &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;var friction = 1.35;&lt;br /&gt;&lt;br /&gt;/*We make the object draggable, and set the drag value to 1*/ &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;object_mc.onPress = function() {&lt;br /&gt;this.startDrag();&lt;br /&gt;drag = 1;&lt;br /&gt;}; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;/*We stop dragging and set the drag value to 0*/ &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;object_mc.onRelease = function() {&lt;br /&gt;this.stopDrag();&lt;br /&gt;drag = 0;&lt;br /&gt;}; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;/*This part controls the momentum of the drag on stopDrag()*/ &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;onEnterFrame = function () { &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;/*If we are dragging the object (and we can tell we are because drag == 1) then we gather information on the trajectory of the drag for ready for when we stop drag. We do this by comparing the X and Y position of the object between frames and so finding out its X and Y velocity. This is stored in the variables trajh and trajv.*/ &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;if (drag == 1) { &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;/* Calculate Y trajectory/velocity*/&lt;br /&gt;&lt;br /&gt;posBv = posAv;&lt;br /&gt;posAv = _ymouse;&lt;br /&gt;trajv = posBv-posAv; &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;/* Calculate X trajectory/velocity*/ &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;posBh = posAh;&lt;br /&gt;posAh = _xmouse;&lt;br /&gt;trajh = posBh-posAh;&lt;br /&gt;} &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;/*If the object has stopped being dragged (and we can tell because drag == 0) we then apply some momentum so the object keeps moving after it is let go. We do this by telling the X and Y position of the object to keep moving each frame with the value of the X and Y velocity as stored in the variables trajh and trajv. However we also apply some friction by reducing the value of trajh and trajv a little on each frame. We do this by dividing the variables trajh and trajv by the friction value on every frame and then setting trajh and trajv to have this new value.*/ &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;if (drag == 0) {&lt;br /&gt;trajh = (trajh/friction);&lt;br /&gt;trajv = (trajv/friction);&lt;br /&gt;_root.object_mc._x -= (trajh);&lt;br /&gt;_root.object_mc._y -= (trajv);&lt;br /&gt;}&lt;br /&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And that's your lot.&lt;br /&gt;&lt;br /&gt;CTRL ENTER to test your movie. You will find you can click and drag the object on the stage and if you let go while moving it will carry on with momentum but come to a gradual halt.&lt;br /&gt;&lt;br /&gt;You can increase or reduce the amount of friction the object encounters on release by changing the value of the &lt;em&gt;friction&lt;/em&gt; variable. Remember, the more friction the quick it slows, the less friction further it travels (like on ice). Have fun experimenting.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;Although this was inspired by my experience of the SMART Table, it won't ever be that versatile because while the SMART table can handle several kids all working at once, Flash will always be limited by the number of "mouse" type inputs your computer supports at once. Usually one.&lt;br /&gt;&lt;br /&gt;But we interactive media types don't care for such trifling limitations. Inspiration is one thing, and application is another. I don't have to make a SMART Table clone.&lt;br /&gt;&lt;br /&gt;I can still use my flash experiment in a variety of ways to spice up my interactive applications, so the inspiration and the experiment was worth it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-8301453076721130145?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/8301453076721130145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/07/drag-n-drop-with-momentum-in-flash.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/8301453076721130145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/8301453076721130145'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/07/drag-n-drop-with-momentum-in-flash.html' title='Drag n&apos; Drop (with momentum) in Flash'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-558931297679470072</id><published>2009-06-03T23:00:00.003+01:00</published><updated>2009-06-03T23:14:46.037+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='creativity'/><category scheme='http://www.blogger.com/atom/ns#' term='Free'/><category scheme='http://www.blogger.com/atom/ns#' term='magazine'/><category scheme='http://www.blogger.com/atom/ns#' term='creative COW'/><title type='text'>Creative COW - a real hidden gem...</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://magazine.creativecow.net/covers_images/14th_issue_cover_240x319.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 240px; height: 319px;" src="http://magazine.creativecow.net/covers_images/14th_issue_cover_240x319.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I have been recieving emails from &lt;a href="http://magazine.creativecow.net/"&gt;Creative COW&lt;/a&gt; for ages now but only just found time to really take a look at what they were about... and that was because they sent me an email telling me  about Stereoscopic 3D (something bound to get my attention, and certainly of interest to a student of mine who produced an anaglyph 3D animation recently).&lt;br /&gt;&lt;br /&gt;So I clicked on over to &lt;a href="http://magazine.creativecow.net/"&gt;Creative COW&lt;/a&gt; only to be astonished that they actually publish a PDF magazine you can download for free, with excellent articles by real professionals about film and media production.&lt;br /&gt;&lt;br /&gt;I immediately downloaded the&lt;a href="http://magazine.creativecow.net/issue/stereoscopic-3d"&gt; latest issue&lt;/a&gt;, and then all back issues.&lt;br /&gt;&lt;br /&gt;It is not often you find something so well produced totally FREE.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-558931297679470072?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/558931297679470072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/06/creative-cow-real-hidden-gem.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/558931297679470072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/558931297679470072'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/06/creative-cow-real-hidden-gem.html' title='Creative COW - a real hidden gem...'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-5686276756997371197</id><published>2009-06-03T00:56:00.006+01:00</published><updated>2009-08-10T12:15:34.702+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chaser'/><category scheme='http://www.blogger.com/atom/ns#' term='follow'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='mouse'/><category scheme='http://www.blogger.com/atom/ns#' term='easing'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Mouse control for flash games</title><content type='html'>Another of my students hit me with a conundrum to solve, and as usual I can't resist the challenge.&lt;br /&gt;&lt;br /&gt;They are constructing a flash game to help new computer users become more comfortable with using a mouse. The idea is to have a top down driving game in which the player must move the car side to side to avoid on coming traffic and bad guys.&lt;br /&gt;&lt;br /&gt;My student is already aware that you can easily make the player character follow the mouse, but they were not happy with such instant precise movements for the game (cars, after all, just don't respond like that). So I have been looking at some code to add a dampening or easing effect on the car so there is a smoother response when the mouse is jerked.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Demo SWF&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="400" height="290"&gt;&lt;br /&gt;    &lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/hittingandeasing.swf"&gt;&lt;br /&gt;    &lt;param name=quality value=high&gt;&lt;br /&gt;    &lt;embed src="http://www.digitalarena.co.uk/diblog/hittingandeasing.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="400" height="290"&gt;&lt;/embed&gt;&lt;br /&gt;  &lt;/object&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Easing with mouse chasing movieclips&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To kick off, the frame rate of the movie is 30fps for nice smooth animation. Then chuck the following code into the first frame:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var easing = 0.1; //The higher the frame rate the lower this number must be&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;onEnterFrame = function () {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.player_mc._x += (_root._xmouse-_root.player_mc._x)*easing;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And it really is that simple. To tighten or loosen the easing just ammend the &lt;em&gt;easing&lt;/em&gt; variable.&lt;br /&gt;&lt;br /&gt;Then just whack a movie clip on the stage called &lt;em&gt;player_mc&lt;/em&gt; and you're done.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Taking the game code further&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;It is too late at night to waffle about it now, but you may find the developed code helpful. I may even get round to finishing it:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/* Students are required to design and build a simple game that teaches mouse control. However one student complained that the mouse is too sensitive for his game idea (a topdown car game).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;One solution to his problem is to have acar contolled onl&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;y along the X axis (left and right) andthat we do some simple algbra to dampen or ease the control ofthe player car.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;Here goes.*/&lt;br /&gt;&lt;br /&gt;/*First declare some variables */&lt;br /&gt;&lt;br /&gt;var easing = 0.1;&lt;br /&gt;/*easing sensitivity, the greater the frame rate the smaller this value needs to be.*/&lt;br /&gt;&lt;br /&gt;var crashcount = 0;&lt;br /&gt;&lt;br /&gt;/*Then we hide the mouse cursor so the user is not distracted and can focus on the player movie clip instead (which will be constrained to follow the mouse only on the X axis.*/&lt;br /&gt;&lt;br /&gt;Mouse.hide();&lt;br /&gt;&lt;br /&gt;/*Now a function to implement the easing and test for collisions with the enemy*/&lt;br /&gt;&lt;br /&gt;onEnterFrame = function () {&lt;br /&gt;/*Here's the easing*/&lt;br /&gt;_root.player_mc._x += (_root._xmouse-_root.player_mc._x)*easing;&lt;br /&gt;&lt;br /&gt;/*Because of limitation on Flash's hit test (whole bounding box or just a single point) the following code checks for collisions on 2 single points on the player, the top right, and the top left of the player. Because all collisions will be front on, this will be sufficient to see if the player collided with the enemy. We choose the single point method because it allows us to lump all the enemies into one movie clip and for us to weave between the gaps without raising a collision as we would if we used the bounding box.*/&lt;br /&gt;&lt;br /&gt;if (_root.enemy_mc.hitTest(_root.player_mc._x+(_root.player_mc._width/2), _root.player_mc._y-(_root.player_mc._height/2), true)) {&lt;br /&gt;crashcount += 1;&lt;br /&gt;} if (_root.enemy_mc.hitTest(_root.player_mc._x-(_root.player_mc._width/2), _root.player_mc._y-(_root.player_mc._height/2), true)) {&lt;br /&gt;crashcount += 1;&lt;br /&gt;}&lt;br /&gt;};&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-5686276756997371197?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/5686276756997371197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/06/mouse-control-for-flash-games.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5686276756997371197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5686276756997371197'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/06/mouse-control-for-flash-games.html' title='Mouse control for flash games'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-4457772232014704197</id><published>2009-05-28T20:08:00.005+01:00</published><updated>2009-05-28T20:33:34.909+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='vivaty'/><category scheme='http://www.blogger.com/atom/ns#' term='3d'/><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='x3d'/><category scheme='http://www.blogger.com/atom/ns#' term='chrome'/><category scheme='http://www.blogger.com/atom/ns#' term='adobe'/><category scheme='http://www.blogger.com/atom/ns#' term='web3d'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><category scheme='http://www.blogger.com/atom/ns#' term='microsoft'/><category scheme='http://www.blogger.com/atom/ns#' term='mozilla'/><category scheme='http://www.blogger.com/atom/ns#' term='browser'/><title type='text'>Let's have some X3D support in browsers, please...</title><content type='html'>&lt;div align="left"&gt;I have just been reading a very interesting &lt;a href="http://www.tola.me.uk/blog/2009/03/29/web3d_and_browser_vendors"&gt;article&lt;/a&gt; on the future of &lt;a href="http://en.wikipedia.org/wiki/X3D"&gt;X3D&lt;/a&gt; by &lt;a href="http://www.tola.me.uk/bio"&gt;Ben Fancis &lt;/a&gt;on his &lt;a href="http://www.tola.me.uk/blog/2009/03/29/web3d_and_browser_vendors"&gt;blog&lt;/a&gt;. Ben suggests that while X3D is already mature as a standard, in terms of adoption it is still in its infancy, and that before it can fully mature we need to see some adoption of the X3D standard into mainstream browsers.&lt;br /&gt;&lt;br /&gt;Since I have recently become interested again in Web3D and this time X3D (rather than VRML) I have been frustrated by the lack of support of web3D standards also. I left my own thoughts as a comment on Ben's blog, but just in case it doesn't make it past moderation I include them below for your consideration. It will make more sense if you read &lt;a href="http://www.tola.me.uk/blog/2009/03/29/web3d_and_browser_vendors"&gt;Ben's article &lt;/a&gt;first.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;My Thoughts&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;I think Ben made some excellent observations on the factors surrounding adoption of X3D. I have been a fan of web based 3D for ages, but even since the VRML days the biggest block was browser support and now that X3D is here this still hasn't really changed.&lt;br /&gt;&lt;br /&gt;But think that outside of browser support the other factor is getting the creative community on board. Too often I think that the software engineers and techies think they own the web and that it is all down to them. But in reality, the popularity (and usability) and growth of the internet in its importance with the general public has a lot to do with the creative application of the technology. It is a collaboration between creative designers and techies that will really bring it about. This brings me to the other missing factor for X3D to become popular - tools for designers.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.vivaty.com/downloads/studio/"&gt;Vivaty Studio &lt;/a&gt;(Formerly known as Flux Studio) is the closest to being a &lt;a href="http://developer.vivaty.com/studiofeatures.php"&gt;decent X3D authoring tool&lt;/a&gt;. It's pretty powerful, having used it myself, but still has room to develop in terms of accessibility for beginners. At present a designer familiar with flash and a 3D authoring program could probably figure it out without too much trouble, but the animation and interaction editing could do with some refining to make it easier to use, and the modelling tools could learn a lot from other programs. Having said all that generally it is really good and certainly the best X3D authoring tool I have come across.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://www.vivaty.com/downloads/studio/studio.jpg"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 275px; DISPLAY: block; HEIGHT: 210px; CURSOR: hand" border="0" alt="" src="http://www.vivaty.com/downloads/studio/studio.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;i&gt;Vivaty Studio Screenshot&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Authoring tools won't be enough, as we learn from &lt;a href="http://mindavenue.2020.net/en/index.htm"&gt;Axel&lt;/a&gt; - an excellent authoring tool (vivaty can learn a lot from their &lt;a href="http://images.snapfiles.com/screenfiles/axel.gif"&gt;animation and interactivity implementation&lt;/a&gt;), but lacked plugin penetration. This is where other vendors like &lt;a href="http://www.adobe.com/products/director/"&gt;Adobe&lt;/a&gt; have already got it made.&lt;br /&gt;&lt;br /&gt;What concerns me is that while proprietary software vendors like Adobe have their own 3D standard, and push it out to all their current Adobe users in software already familiar to most designers, and nice integration with other Adobe apps, X3D will have a hard time getting a look-in. I for one cannot imagine Microsoft adopting an open standard either, when they no doubt add 3D to their &lt;a href="http://www.microsoft.com/expression/"&gt;Expression&lt;/a&gt; suite in the future.&lt;br /&gt;&lt;br /&gt;It is refreshing that &lt;a href="http://developer.vivaty.com/"&gt;Vivaty&lt;/a&gt; are using an open standard however (unlike so many others "second life" for instance), and it is decisions like this that are X3Ds greatest hope.&lt;br /&gt;&lt;br /&gt;Outside of that, I totally agree, browser implementation is the next step for X3D to come of age. MS will be the last to get on board but &lt;a href="http://www.mozilla.org/"&gt;Mozilla&lt;/a&gt;/&lt;a href="http://www.mozilla-europe.org/en/firefox/"&gt;Firefox&lt;/a&gt; could lead the way closely followed by &lt;a href="http://www.google.com/chrome"&gt;Chrome&lt;/a&gt; or &lt;a href="http://www.apple.com/safari/"&gt;Safari&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;What also might help if Vivaty put their plugin source code back into open source. The Flux player &lt;a href="http://www.web3d.org/x3d/publiclists/x3dpublic_list_archives/0711/msg00045.html"&gt;used to be Open Source&lt;/a&gt;, but &lt;a href="http://sourceforge.net/projects/flux3d/"&gt;a visit to sourceforge now will show that all source files have been removed&lt;/a&gt;. Maybe the investors that made Flux into Vivaty want to guard their investment closely (who can blame them), but one wonders if by holding everything too tight X3D might just as well be a proprietary format for all the market penetration it has - and without the customer base of Adobe or MS, Vivaty will slowly dissolve like Axel and nameless others. In my view a better strategy would be to open their plugin source, get it included into a Mozilla release and start seeing popular browsers with built in X3D support. Surely that will help Vivaty's larger business aim (no plugin required) in the longer term, and get them on the market with a good authoring tool. Who knows but Google will buy them out under those conditions and build X3D into &lt;a href="http://sketchup.google.com/"&gt;Sketchup&lt;/a&gt; for some real Web3D competition with Adobe.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-4457772232014704197?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/4457772232014704197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/05/lets-have-some-x3d-support-in-browsers.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4457772232014704197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4457772232014704197'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/05/lets-have-some-x3d-support-in-browsers.html' title='Let&apos;s have some X3D support in browsers, please...'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-4636739870695418516</id><published>2009-04-08T21:42:00.006+01:00</published><updated>2009-04-08T22:03:55.320+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='form'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>Recognising the value of design...</title><content type='html'>&lt;a href="http://www.ideabook.com/"&gt;Chuck Green&lt;/a&gt; is one of those names (a bit like &lt;a href="http://www.lockergnome.com/"&gt;Chris Pirillo&lt;/a&gt;) that has been around, sharing their wisdom, since before the dot com bubble burst - I first came across Chuck Green in 1999 and even then he managed to make plain old HTML look pretty good.&lt;br /&gt;&lt;br /&gt;Anyway, I have been recieving Chuck's emails for a while, but today's was so especially interesting that I have decided to share a chunk with you:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;To those who don't recognize the value of graphic design... »&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I got a plea for help the other day. A designer who frequents this blog had shared a recent post with an engineer friend and the reply was a bit condescending. The post, "The talent that makes a good designer great," points to an engineer who I thought was particularly innovative. My purpose in drawing attention to him was to emphasize the importance of the same type of innovative thinking to the field of graphic design.&lt;br /&gt;&lt;br /&gt;The essence of the engineer's response was they saw little correlation between the skills of an engineer and those of a graphic designer. How could that type of innovation, they posed, have anything to do with a designer's sense of style, their ability to choose typefaces, their knowledge of color, and so on. After all, the subject of my post, the engineer asserted, was a PhD candidate.&lt;br /&gt;&lt;br /&gt;I laughed out loud. Every designer has had (or will have) this conversation. At its root is the implication that devoting one's career to the design of communications and an interest in the aesthetic is somehow less of a calling than some other, more significant field of endeavor.&lt;br /&gt;&lt;br /&gt;My response is this:&lt;br /&gt;&lt;br /&gt;The ergonomics and aesthetics of design are to engineering what taste is to food.&lt;br /&gt;&lt;br /&gt;Remove the aesthetic qualities (style, organization, presentation) of the clothing you wear, the book you are reading, the automobile you drive, the room in which you spend your time, and so on, and all you have left is...function.&lt;br /&gt;&lt;br /&gt;It is important for every student of design (and engineering) to recognize and appreciate the importance of form to function and vice versa. And it is equally important to understand that to be a exceptional practitioner of either discipline requires out-of-the-ordinary instincts, curiosity, knowledge, craft, and so on.&lt;br /&gt;&lt;br /&gt;Lots of people view art and science as a comfortable coexistence. But for those who are particularly attuned to one or the other, it is good to remember that the most debilitating form of blindness is to minimize the way in which others see. It is not only a sure way to limit your potential--it is a certain and swift strategy for diminishing your influence.&lt;br /&gt;&lt;br /&gt;An example of substance without style... &lt;a href="http://www.ideabook.com/substance_without_style.html"&gt;http://www.ideabook.com/substance_without_style.html&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt;Reminds me of a &lt;a href="http://dansinteractive.blogspot.com/2009/01/more-coding-for-fun-while-still-solving.html"&gt;conversation I had with an engineer on this very blog&lt;/a&gt;. Thankfully my engineer friend is open minded to the value of aesthetics, just as I see function as being fundamental too. &lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-4636739870695418516?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/4636739870695418516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/04/recognising-value-of-design.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4636739870695418516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4636739870695418516'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/04/recognising-value-of-design.html' title='Recognising the value of design...'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6832651192583542138</id><published>2009-03-06T19:20:00.014Z</published><updated>2009-03-06T20:56:06.864Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Free'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='carrara'/><title type='text'>Carrara 6 Pro - Free with DigitalArts Magazine</title><content type='html'>&lt;a href="http://media.digitalartsonline.co.uk/images/covers/DA25.jpg"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 178px; DISPLAY: block; HEIGHT: 240px; CURSOR: hand" border="0" alt="" src="http://media.digitalartsonline.co.uk/images/covers/DA25.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;For those of you interested in 3D modelling and animation I have to recommend that you buy the &lt;a href="http://www.digitalartsonline.co.uk/magazine/index.cfm"&gt;April 2009 edition of DigitalArts magazine &lt;/a&gt;(came by mail today - expect in WHSmiths very soon I expect).&lt;br /&gt;&lt;br /&gt;The free software in this edition is none other than Carrara 6 Pro, an extrememly powerful and versatile 3D modeller and animator. &lt;a href="http://www.gamedev.net/features/reviews/productreview.asp?productid=669"&gt;Other people have written far more detailed reviews than I ever will&lt;/a&gt;, but to sum up the changes:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;Carrara 6 allows users to choose from an unprecedented array of tools while exploring new dimensions in 3D creation. Carrara 6 provides 3D figure posing and&lt;br /&gt;animation, modelling, environment-creation and rendering tools within a single&lt;br /&gt;application.&lt;br /&gt;&lt;br /&gt;Carrara 6 features include non-linear animation, giving users the ability to create clips of animation that can be reused and combined on multiple tracks. Also includeds is dynamic hair that allows artists to style, cut, brush and drape the hair, and displacement modeling where the user can paint detail on a model using free-form brush tools. &lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;/blockquote&gt;Apart from the non-linear animating and the hair, the icing on the cake was that it can export in DirectX (.X) format, and converts procedural shaders into raster images on export. &lt;em&gt;Finally&lt;/em&gt;, I can use a program I am extremely familiar with to make models for 3D games and export them directly without having to convert them using other programs (at least that is the implication with .X export - I will of course try it out with my copy of &lt;a href="http://t3dgm.thegamecreators.com/?f=promo"&gt;The 3D Game Maker&lt;/a&gt;, and &lt;a href="http://www.fpscreator.com/"&gt;FPS Creator &lt;/a&gt;(&lt;a href="http://www.fpscreator.com/betafiles/FPSCreatorFree.zip"&gt;also available free for learning purposes&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;Ever since version 1 I have found Carrara to be one of the most easily learned 3D animation and modelling programs. Even so beginners may be glad of a little help in which case they will find &lt;a href="http://www.markbremmer.com/3Bpages/carrara6Pro.html"&gt;Mark Bremmer's video tutorials &lt;/a&gt;helpful to get started.&lt;br /&gt;&lt;br /&gt;I am certainly not going to complain that Daz is continuing to follow its strategy of giving freebies to DigitalArts readers (or readers of any other creative journal for that matter), and earning most of its income from selling content for its Daz Studio product. On pondering why I considered 2 possible causes. First, &lt;a href="http://www.e-onsoftware.com/"&gt;E-on &lt;/a&gt;have had their open beta of Vue 7 going for a while and by launching &lt;a href="http://www.cornucopia3d.com/index.php"&gt;cornucopia&lt;/a&gt; have thrown down the gauntlet to Daz in the pre-made content arena. Second, by giving Carrara away free on design and creative journals they may encourage more talented 3d designers to produce content which can then be sold in their store. Well... it's a nice theory. Whatever the reason, Carrara 6 for the price of a magazine has to be a bargain.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6832651192583542138?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6832651192583542138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/03/carrara-6-pro-free-with-digitalarts.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6832651192583542138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6832651192583542138'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/03/carrara-6-pro-free-with-digitalarts.html' title='Carrara 6 Pro - Free with DigitalArts Magazine'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-1923760409882945772</id><published>2009-03-01T20:56:00.002Z</published><updated>2009-03-01T20:59:08.304Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='web design'/><category scheme='http://www.blogger.com/atom/ns#' term='IE8'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet Explorer 8'/><category scheme='http://www.blogger.com/atom/ns#' term='browser'/><title type='text'>Internet Explorer 8</title><content type='html'>Web designers will be interested to know that Internet Explorer 8 is coming very soon. At present you can download release candidate 1, this means that it is ready for public testing while they iron out the last few bugs.&lt;br /&gt;&lt;br /&gt;You might want to add it to your stash of browsers for testing purposes. After all, you want to make sure the next most popular browser shows your websites nicely.&lt;br /&gt;&lt;br /&gt;Download it here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.microsoft.com/windows/internet-explorer/beta/worldwide-sites.aspx"&gt;http://www.microsoft.com/windows/internet-explorer/beta/worldwide-sites.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-1923760409882945772?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/1923760409882945772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/03/internet-explorer-8.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1923760409882945772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1923760409882945772'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/03/internet-explorer-8.html' title='Internet Explorer 8'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6441309512593071174</id><published>2009-02-27T16:13:00.008Z</published><updated>2009-02-27T16:29:04.521Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='flv'/><title type='text'>Dodgy play/pause button? Try this...</title><content type='html'>I have spent a lot of time looking at FLV players custom built from scratch, since my students have been designing and coding them.&lt;br /&gt;&lt;br /&gt;One problem that keeps popping up is the play/pause button not showing the right icon at the right time. I looked at my latest version and found that my code was slightly different. Here it is in case you want to try it.&lt;br /&gt;&lt;br /&gt;This replaces the play button code in the flv player &lt;a href="http://dansinteractive.blogspot.com/2008/08/flash-projects-3-custom-flv-player.html"&gt;described back in August&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;//Alternative play button code&lt;br /&gt;video_ns.onStatus = function() { &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;if (video_ns.time &gt;= duration-1) { &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;playstatus = 3; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.pause_mc.gotoAndStop("pauseoff"); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;} else { &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;playstatus = 1; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.pause_mc.gotoAndStop("pauseon"); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.pause_mc.onRelease = function() { &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;if (playstatus == 1) { &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;video_ns.pause(); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;playstatus = 2; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.pause_mc.gotoAndStop("pauseoff"); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;} else if (playstatus == 2) { &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;video_ns.pause(); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.pause_mc.gotoAndStop("pauseon"); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;playstatus = 1; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;} else if (playstatus == 3) { &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;video_ns.play(currentvid); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.pause_mc.gotoAndStop("pauseon"); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;playstatus = 1; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For users doing the &lt;em&gt;Flashvars&lt;/em&gt; or &lt;em&gt;Query String &lt;/em&gt;method the only other thing you have to change is the value of the playstatus variable at the top of your code as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;playstatus = 3;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;See how you get on. The biggest difference is that I now have 3 playstatuses, not 2.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6441309512593071174?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6441309512593071174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/02/dodgy-playpause-button-try-this.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6441309512593071174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6441309512593071174'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/02/dodgy-playpause-button-try-this.html' title='Dodgy play/pause button? Try this...'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-5618295559533957957</id><published>2009-02-26T20:17:00.011Z</published><updated>2009-02-26T21:04:41.553Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='flashvars'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='query string'/><category scheme='http://www.blogger.com/atom/ns#' term='flv'/><title type='text'>An alternative to Flashvars: a Query String</title><content type='html'>One thing I did not expect when using Flashvars was that one of my students would experience what appears in all ways to be the browser caching the swf with the Flashvars. (Caching means that the browser saves the file and gets it from the temporary internet files instead of checking for changed files from the server.) I did expect the &lt;em&gt;swf&lt;/em&gt; to cache, but not the Flashvars. After all &lt;a href="http://board.flashkit.com/board/showthread.php?t=674871"&gt;the whole reason for the invention of Flashvars&lt;/a&gt; was to allow the passing of variables to a &lt;em&gt;swf&lt;/em&gt; from the HTML &lt;em&gt;without &lt;/em&gt;the &lt;em&gt;swf &lt;/em&gt;having to be re-downloaded every time.&lt;br /&gt;&lt;br /&gt;I suspect that this is something to do with the students computer and testing from the local machine rather than a server.&lt;br /&gt;&lt;br /&gt;However, to solve my student's problem, the good news is that Flashvars is not the only way to pass variables to a &lt;em&gt;swf&lt;/em&gt; from the HTML. &lt;a href="http://dansinteractive.blogspot.com/2009/02/flash-projects-6-slim-custom-video.htmlhttp://dansinteractive.blogspot.com/2009/02/flash-projects-6-slim-custom-video.html"&gt;Last time I mentioned 3 options&lt;/a&gt;, hard coding, XML or Flashvars. But I missed one: the Query String.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Query String&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This is really well explained &lt;a href="http://www.permadi.com/tutorial/flashQueryString/"&gt;in this website here (click)&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;But to quickly sum it up, one way we can pass variables to flash from the HTML page in which the flash is &lt;em&gt;Object&lt;/em&gt;ed and &lt;em&gt;Embed&lt;/em&gt;ded is by tagging them on to the end of the &lt;em&gt;swf&lt;/em&gt; location path.&lt;br /&gt;&lt;br /&gt;Normally the &lt;em&gt;swf&lt;/em&gt; location path might appear something like this:&lt;br /&gt;&lt;br /&gt;For &lt;em&gt;Object&lt;/em&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;PARAM NAME=movie VALUE="flaMovie.swf"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For &lt;em&gt;Embed&lt;/em&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;src="flaMovie.swf"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We pass the variables to the &lt;em&gt;swf&lt;/em&gt; by tagging them onto the end of the &lt;em&gt;swf&lt;/em&gt; location path as follows:&lt;br /&gt;&lt;br /&gt;For Object:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;PARAM NAME=movie VALUE="flaMovie.swf&lt;span style="color:#cc0000;"&gt;?currentvid=videoname.flv&amp;amp;duration=999&lt;/span&gt;"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For Embed:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;src="flaMovie.swf&lt;span style="color:#cc0000;"&gt;?currentvid=videoname.flv&amp;amp;duration=999&lt;/span&gt;"&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-5618295559533957957?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/5618295559533957957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/02/alternative-to-flashvars-query-string.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5618295559533957957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5618295559533957957'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/02/alternative-to-flashvars-query-string.html' title='An alternative to Flashvars: a Query String'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6116497035283767258</id><published>2009-02-23T23:52:00.021Z</published><updated>2009-02-27T16:41:34.435Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='flashvars'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='flv'/><title type='text'>Flash Projects - #6 - Slim Custom Video Player with Flashvars</title><content type='html'>Well, we have come a long way since the &lt;a href="http://dansinteractive.blogspot.com/2008/02/flash-projects-1-movie-player.html"&gt;swf video player&lt;/a&gt; and the &lt;a href="http://dansinteractive.blogspot.com/2008/08/flash-projects-3-custom-flv-player.html"&gt;flv video player&lt;/a&gt;. Both versions of the player had a menu built in to the flash movie for selecting which video you want to play. But not all applications of a video player require a built in menu, what if you only want to play one video?&lt;br /&gt;&lt;br /&gt;Let's go further. What if you want to play one video on one web page, but another video on another web page?&lt;br /&gt;&lt;br /&gt;Do we have to produce a whole video player flash movie for each video we want to show?&lt;br /&gt;&lt;br /&gt;The good news is NO. The other good news is that building a custom flv player in flash that we can re-use for different videos is a great excuse to learn some more ActionScript.&lt;br /&gt;&lt;br /&gt;Ready? Then let's begin.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Defining the problem&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;So we want to produce a video player in Flash that knows which video to play, when we press play, without having to "hard code" this knowledge into the video player.&lt;span style="FONT-WEIGHT: bold"&gt; &lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Consider solutions&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;There are several ways we can tackle this problem, such as: &lt;/p&gt;&lt;ol&gt;&lt;li&gt;We "hard code" the video player to look for a video of a pre-determined name and pre-determined relative location. But that means having multiple copies of the same video player in different folders. Saves us some ActionScripting, but means that the user has to download the video player every time from a new location.&lt;/li&gt;&lt;li&gt;We use an XML file external to the video player to tell it what video it needs to play. Not a bad idea but some relatively complex ActionScript for a relatively simple thing. No, there is a simpler way.&lt;/li&gt;&lt;li&gt;We use the obscure but very handy &lt;span style="FONT-STYLE: italic"&gt;Flashvars&lt;/span&gt; capability to tell the videoplayer what to play by including the information within the &lt;span style="FONT-STYLE: italic"&gt;Object &lt;/span&gt;and &lt;span style="FONT-STYLE: italic"&gt;Embed&lt;/span&gt; tags in the HTML.&lt;/li&gt;&lt;/ol&gt;We do the last option.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;How does Flashvars work?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_16417"&gt;Adobe sum it up on their website&lt;/a&gt;, but if that looks hard don't worry, I am about to talk you through it.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mediacollege.com/adobe/flash/actionscript/flashvars.html" target="_blank"&gt;Take a look at the example on this page (click).&lt;/a&gt; As you can see it looks pretty much like any &lt;span style="FONT-STYLE: italic"&gt;Object&lt;/span&gt; and &lt;span style="FONT-STYLE: italic"&gt;Embed&lt;/span&gt; tag but this time with the addition of the &lt;span style="FONT-WEIGHT: bold"&gt;Flashvars&lt;/span&gt; parameters.&lt;br /&gt;&lt;br /&gt;Within Flashvars we can define any variable with any value. These variables and their values are then passed to the flash movie we are &lt;span style="FONT-STYLE: italic"&gt;Object&lt;/span&gt;ing and &lt;span style="FONT-STYLE: italic"&gt;Embed&lt;/span&gt;ing and created within the movie &lt;span style="FONT-STYLE: italic"&gt;before&lt;/span&gt; the first frame of the movie. If we were "hard coding" the variables and their values into the video player we would expect to do it in the first few lines of the first frame in the timeline. That Flashvars creates the variables &lt;span style="FONT-STYLE: italic"&gt;before&lt;/span&gt; the first frame is &lt;span style="FONT-STYLE: italic"&gt;just as good&lt;/span&gt; from our point of view.&lt;br /&gt;&lt;br /&gt;This means we can include the &lt;span style="FONT-STYLE: italic"&gt;same&lt;/span&gt; video player in every page of our website, but get each one to play a different &lt;span style="FONT-STYLE: italic"&gt;flv&lt;/span&gt; file by simply changing the values of the Flashvars parameters in the HTML &lt;span style="FONT-STYLE: italic"&gt;Object&lt;/span&gt; and &lt;span style="FONT-STYLE: italic"&gt;Embed &lt;/span&gt;tags.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;A quick recap (before we make changes)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The original code had the name of the &lt;span style="FONT-STYLE: italic"&gt;flv&lt;/span&gt; file "hard coded" for the menu button as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.m1_btn.onRelease = function () {&lt;br /&gt;video_ns.play("video1.flv");&lt;br /&gt;currentvid = "video1.flv";&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The code above does two things when the button is released. First, it tells the NetStream object called "video_ns" to play a specified FLV file. Secondly it sets the value of a variable called currentvid to be the same as the name of the FLV file - this helps us later on when we are programming the playback controls.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Now making the changes&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Basically, instead of having the menu button, you just include the following variable and value in the Flashvars.&lt;br /&gt;&lt;br /&gt;Within &lt;span style="FONT-STYLE: italic"&gt;Object&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold;font-family:courier new;" &gt;param name="FlashVars" value="currentvid=video1.flv"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Within &lt;span style="FONT-STYLE: italic"&gt;Embed&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;flashvars="&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-WEIGHT: bold;font-family:courier new;" &gt;currentvid=video1.flv&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And it is that simple.&lt;br /&gt;&lt;br /&gt;All your existing code should still work.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Taking it further&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you feel like getting more advanced (and if you are not using flv 1.1 files) you could even include the length of the flv video (in seconds) as a Flashvar too. If you remember, only flv 1.1 or later includes the duration of the flv in meta data, and our progress bar relies on knowing the duration of the video. Using Flashvars as follows you can tell the video player the duration without needing meta data:&lt;br /&gt;&lt;br /&gt;Within &lt;span style="FONT-STYLE: italic"&gt;Object&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold;font-family:courier new;" &gt;param name="FlashVars" value="currentvid=video1.flv&amp;amp;duration=999"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Within &lt;span style="FONT-STYLE: italic"&gt;Embed&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;flashvars="&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-WEIGHT: bold;font-family:courier new;" &gt;currentvid=video1.flv&lt;/span&gt;&lt;span style="FONT-WEIGHT: bold;font-family:courier new;" &gt;&amp;amp;duration=999&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;&lt;/span&gt;Then you can delete (or comment out) the code that tries to get the duration of the flv from the metadata, you know, this bit:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;NetStream.prototype.onMetaData = function(obj){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var duration = obj.duration;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can delete the above and your play, pause, and progress bar will still work, because instead of getting the duration from metadata it will now be getting it from Flashvars.&lt;br /&gt;&lt;br /&gt;Voila!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Oops, nearly forgot...&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Oh, one last thing, make sure you add the following code to the first line on your first frame:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var playstatus = 2;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is needed because in the &lt;a href="http://dansinteractive.blogspot.com/2008/08/flash-projects-3-custom-flv-player.html"&gt;original player&lt;/a&gt;, as soon as you selected the video it begins to play, the play/pause system then worked on the assumption that the video is already playing. The code was as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;video_ns.onStatus = function() {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;if (video_ns.time &gt;= duration-1){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;playstatus = 2;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.pause_mc.gotoAndStop("pauseon");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;else {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;playstatus = 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.pause_mc.gotoAndStop("pauseoff");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.pause_mc.onRelease = function () {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;if (playstatus == 1){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;video_ns.pause();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.pause_mc.gotoAndStop("pauseoff");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;else if (playstatus == 2){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;video_ns.play(currentvid);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Read the code and you will see that you can only play the video if playstatus = 2. But because we now get the video info from &lt;em&gt;Flashvars&lt;/em&gt; the video is &lt;em&gt;not&lt;/em&gt; already playing so we need to set the playstatus to 2 manually or you can never play the movie. Hence make sure you add the following code to the first line on your first frame:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var playstatus = 2;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;What fun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6116497035283767258?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6116497035283767258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/02/flash-projects-6-slim-custom-video.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6116497035283767258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6116497035283767258'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/02/flash-projects-6-slim-custom-video.html' title='Flash Projects - #6 - Slim Custom Video Player with Flashvars'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-5549900759767806498</id><published>2009-02-23T22:50:00.012Z</published><updated>2009-02-23T23:39:16.664Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Audio'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='mute'/><category scheme='http://www.blogger.com/atom/ns#' term='flv'/><title type='text'>Flash Projects - #5 - Custom Video Player Mute Control</title><content type='html'>Building further on the custom &lt;a href="http://dansinteractive.blogspot.com/2008/08/flash-projects-3-custom-flv-player.html"&gt;FLV player&lt;/a&gt; in previous posts, and definitely inspired by the &lt;a href="http://www.bbc.co.uk/iplayer"&gt;BBC iPlayer&lt;/a&gt;, I decided to add further functionality, including a mute control to turn off the sound for a video currently playing.&lt;br /&gt;&lt;br /&gt;The ActionScript is really very simple, and logical. Once you understand how to stream and attach video, attaching sound for control is very straight forward.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Quick recap&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The original code required you to create a netConnection object and attach to that a netStream object:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;//Net connection for video stream to video object&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var myConnection_nc:NetConnection = new NetConnection();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;myConnection_nc.connect(null);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var video_ns:NetStream = new NetStream(myConnection_nc);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then you were instructed to attach the video stream to a video object on the stage:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;this.vidHolder_mc.vid_video.attachVideo(video_ns);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Attaching audio&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Setting up to control (or mute) the audio is not all that different. Use the following code:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;//Attach audio of FLV for volume control&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;flv_mc.attachAudio(video_ns);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var audio_sound:Sound = new Sound(flv_mc);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Notice that the video and the audio both attach the same netStream object &lt;span style="font-style: italic;"&gt;video_ns&lt;/span&gt;. While the audio will still be heard without attaching it separately, if we want to control it, we must attach it to a movie clip of its own as above. In this case a movie clip called &lt;span style="font-style: italic;"&gt;flv_mc.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Controlling audio&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Because we want a mute button that will change depending on the mute status (showing whether the sound is currently muted or not - visual feedback is such a wonderful thing), you need to create a variable to store the current &lt;span style="font-style: italic;"&gt;mute status.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Insert the following code right at the top of your ActionScript:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;//Mute control status, 0 = mute off sound on&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var mutestatus = 0;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then you need to create a movie clip to act as the mute button. This has just two frames, one containing an image of a speaker making noise, the other containing an image of a speaker not making noise (decide how to depict this however you like). Give the first frame the label &lt;span style="font-style: italic;"&gt;muteon&lt;/span&gt; and the second frame the label &lt;span style="font-style: italic;"&gt;muteoff&lt;/span&gt;. Don't forget to put a &lt;span style="font-style: italic;"&gt;stop();&lt;/span&gt; action on each of the frames or you will have an animated flickering button. Then drag an instance of the mute button onto the stage and give it the instance name &lt;span style="font-style: italic;"&gt;mute_mc.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The following code will then allow you to mute and un-mute the sound, insert this at some point after the line you just inserted above:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;//Mute control&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.mute_mc.onRelease = function() {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    if (mutestatus == 0) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        _root.mute_mc.gotoAndStop("muteon");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        mutestatus = 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;audio_sound.setVolume(0);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        updateVolume();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    } else if (mutestatus == 1) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        _root.mute_mc.gotoAndStop("muteoff");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        mutestatus = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;audio_sound.setVolume(100);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        updateVolume();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;How does it work? Very simple. First it checks to see what the mute status is (whether it is muted yet or not). If it is not muted, it tells the button to look like it is muted (goes to the frame with the muted speaker picture), then sets the mute status to 1, then sets the volume to be 0, then updates the volume to make the 0 take effect. If, however, it is already muted, it tells the button to look like it is not muted (goes to the frame with the noisy speaker picture), then sets the mute status to 0, then sets the volume to be 100, then updates the volume to make the 100 take effect.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;And that's a wrap.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-5549900759767806498?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/5549900759767806498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/02/flash-projects-5-custom-video-player.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5549900759767806498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5549900759767806498'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/02/flash-projects-5-custom-video-player.html' title='Flash Projects - #5 - Custom Video Player Mute Control'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-223758638731360354</id><published>2009-02-18T23:22:00.003Z</published><updated>2009-02-18T23:55:54.668Z</updated><title type='text'>Being inspired by historical art and design...</title><content type='html'>&lt;p&gt;(I have published this article on another of my blogs, so sorry if you have seen it before.)&lt;/p&gt;&lt;p&gt;Too often I hear students moaning that historical sources are boring, uninspiring, and in some cases irrelevant to the world of contemporary graphics. More often than I am comfortable with students would rather study their &lt;em&gt;peers&lt;/em&gt; on Deviant Art than their &lt;em&gt;superiors&lt;/em&gt; in an art gallery.&lt;/p&gt;&lt;p&gt;While I do understand what my students are saying, from their point of view, I suggest that the problem is not with the historical art, but in our misconceptions about how we think other people's artwork should influence or inspire us.&lt;/p&gt;&lt;p&gt;Take the video for Coldplay's Viva La Vida for example. A fantastic piece of contemporary art &amp;amp; design, packed with modern digital effects, almost totally inspired visually by 19th Century oil paintings.&lt;/p&gt;&lt;p&gt;See if you agree...&lt;br /&gt;&lt;br /&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/dvgZkm1xWPE&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;br /&gt;&lt;br /&gt;&lt;embed src="http://www.youtube.com/v/dvgZkm1xWPE&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Take a close look. You will see animated painterly effects, cracks in the image like the crazing in an old painting, the dress of the performers, the props, the colours and yes, even the lighting, all influenced by oil paintings nearly 200 years old. &lt;/p&gt;&lt;p&gt;Compare the colours and lighting from the video with this portrait of Nelson. The similarities are striking.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://www.marineartists.co.uk/images/Images_Category/Fullsize/Abbott%20-%20Nelson%20-%20small.jpg"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 261px; CURSOR: hand; HEIGHT: 315px; TEXT-ALIGN: center" alt="" src="http://www.marineartists.co.uk/images/Images_Category/Fullsize/Abbott%20-%20Nelson%20-%20small.jpg" border="0" /&gt;&lt;/a&gt;Other examples of paintings from the same era follow. Do you see similarities with these too?&lt;br /&gt;&lt;br /&gt;&lt;a href="http://img.alibaba.com/photo/210866596/handmade_oil_painting_Napoleon_Bonaparte_Crossing_the_St_Bernard_War_Scene_.jpg"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 318px; CURSOR: hand; HEIGHT: 398px; TEXT-ALIGN: center" alt="" src="http://img.alibaba.com/photo/210866596/handmade_oil_painting_Napoleon_Bonaparte_Crossing_the_St_Bernard_War_Scene_.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.marineartists.co.uk/images/Images_Category/Thumbnail/Bostock%20-%20Nelson%20Rigaud%20-%20small%20framed.JPG"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 279px; CURSOR: hand; HEIGHT: 353px; TEXT-ALIGN: center" alt="" src="http://www.marineartists.co.uk/images/Images_Category/Thumbnail/Bostock%20-%20Nelson%20Rigaud%20-%20small%20framed.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.kera.org/blogs/culture/wp-content/uploads/2008/06/goya-400.jpg"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 343px; CURSOR: hand; HEIGHT: 400px; TEXT-ALIGN: center" alt="" src="http://www.kera.org/blogs/culture/wp-content/uploads/2008/06/goya-400.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;As you watch the video you will have seen many visual elements borrowed from paintings like those above. They have taken the &lt;em&gt;visual language&lt;/em&gt; of these paintings and used it in the video.&lt;/p&gt;&lt;p&gt;One painting in particular that appears to inspire the video is the one on the cover of the "Death and All His Friends" album. It features a painting entitled "&lt;a href="http://en.wikipedia.org/wiki/Liberty_Leading_the_People"&gt;Liberty Leading the People&lt;/a&gt;". It was painted in 1830 by &lt;a title="Eugène Delacroix" href="http://en.wikipedia.org/wiki/Eug%C3%A8ne_Delacroix"&gt;Eugène Delacroix&lt;/a&gt; in oil on canvas and currently resides in the Louvre museum in Paris. But if you look closely as the video plays, you will notice a lot of the background imagery appears to be either taken from or inspired by this painting (watch out for the red flag imagery, and towards the end, "Liberty" herself).&lt;/p&gt;&lt;br /&gt;&lt;a href="http://ecx.images-amazon.com/images/I/61yVE6NUh8L._SS500_.jpg"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 420px; CURSOR: hand; HEIGHT: 409px; TEXT-ALIGN: center" alt="" src="http://ecx.images-amazon.com/images/I/61yVE6NUh8L._SS500_.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;What is my point? Just because you are asked to find examples of historical art for research &lt;em&gt;does not mean&lt;/em&gt; you will have to produce an oil painting. For inspiration you might take colours, texture, lighting, composition, style, story telling, imagery, semiotics, mood, effects... anything you like. &lt;/p&gt;&lt;p&gt;You don't &lt;em&gt;have&lt;/em&gt; to feel like you need to be inspired to use the media &lt;em&gt;or&lt;/em&gt; technique - though you &lt;em&gt;might&lt;/em&gt; be. &lt;/p&gt;&lt;p&gt;Inspiration comes in many ways from many sources. Do you have the eye to look beyond the surface? If you have, you may yet produce great things, original things, that go beyond the graphical fashion of the &lt;em&gt;now. &lt;/em&gt;&lt;/p&gt;&lt;p&gt;The Coldplay video proves my point. So look deeper.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-223758638731360354?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/223758638731360354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/02/being-inspired-by-historical-art-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/223758638731360354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/223758638731360354'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/02/being-inspired-by-historical-art-and.html' title='Being inspired by historical art and design...'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-1239860096762371543</id><published>2009-02-16T20:14:00.004Z</published><updated>2009-02-16T20:31:39.430Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='creativity'/><category scheme='http://www.blogger.com/atom/ns#' term='ideas'/><category scheme='http://www.blogger.com/atom/ns#' term='MYST'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='mac'/><category scheme='http://www.blogger.com/atom/ns#' term='hypercard'/><title type='text'>Where Interactive Media Can Go</title><content type='html'>Those of you who are old enough may remember back in 1993 a revolutionary new computer game was released - MYST. Back then it used the Mac's hypercard system (you know, the one that might have been a forerunner to the internet if only anyone had realised the potential of linking between stacks on other machines), simple yet effective.&lt;br /&gt;&lt;br /&gt;As far as today's interactive media is concerned, the original MYST was pretty low tech. When I consider the simplicity of the original MYST back end it becomes clear that pretty much anyone with an intermediate knowledge of Flash and Actionscript could produce a comparable game today.&lt;br /&gt;&lt;br /&gt;What set MYST apart then wasn't the technology, but the creativity with which the technology was used.&lt;br /&gt;&lt;br /&gt;And this is what I keep trying to get my students to understand. It isn't all about being able to use the software, loads of people can do that. It is about the &lt;span style="font-style: italic;"&gt;thinking,  &lt;/span&gt;the &lt;span style="font-style: italic;"&gt;ideas &lt;/span&gt;and the &lt;span style="font-style: italic;"&gt;creativity&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;That is why we emphasise the design process over the final outcome.&lt;br /&gt;&lt;br /&gt;Of course later versions of MYST are a lot more complex than the original in 1993, but the ideas, the thinking and the creativity is still what drives the process, even if the technology has changed.&lt;br /&gt;&lt;br /&gt;As demonstrated in this &lt;span style="font-style: italic;"&gt;making of &lt;/span&gt;video...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;embed style="width: 400px; height: 326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://noolmusic.com/play_google/8812843433125806972&amp;amp;hl=en"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;b&gt;&lt;a href="http://noolmusic.com/google_videos/the_making_of_myst_iii_exile.php"&gt;The Making Of Myst Iii Exile&lt;/a&gt; via &lt;a href="http://noolmusic.com/"&gt;Noolmusic.com&lt;/a&gt;&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-1239860096762371543?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/1239860096762371543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/02/where-interactive-media-can-go.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1239860096762371543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1239860096762371543'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/02/where-interactive-media-can-go.html' title='Where Interactive Media Can Go'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-8715116228585238867</id><published>2009-01-10T00:02:00.003Z</published><updated>2009-01-10T00:13:34.477Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Functions, functions, functions</title><content type='html'>Being originally trained in graphic design, I missed out on formal training in computer programming. The subtleties of programming were all self taught and learned as needed, rather than learned in a logical and structured way. This, and the fact that I come from an art background (definately part of seeing the world a little differently) perhaps explains why I tend to come onto programming solutions to my interactive media problems in a round-about way.&lt;br /&gt;&lt;br /&gt;The purpose and value of functions is a perfect example of this. A programmer could probably explain it to me until they were blue in the face, but in fact the best explanation I have ever had came accidentally in two halves, while actually looking for a solution to something else.&lt;br /&gt;&lt;br /&gt;The following is actually bits taken from two different chapters in the Flash MX 2004 ActionScript reference ("Using built-in functions" and "Returning values from a function"). Why they didn't just explain it this way in the first place I will never know. Still, if having it explained this way makes sense to you I share it below for your benefit:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;A function is a block of ActionScript code that can be reused anywhere in a SWF file. If you pass values as parameters to a function, the function will operate on those values. A function can also return values.&lt;br /&gt;&lt;br /&gt;To call a function, simply use the function name and pass any required parameters.&lt;br /&gt;&lt;br /&gt;For example, the following function returns the square of the parameter x and specifies that the returned value must be a Number:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;function sqr(x:Number):Number {&lt;br /&gt;return x * x;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Some functions perform a series of tasks without returning a value. For example, the following function initializes a series of global variables:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;function initialize() {&lt;br /&gt;boat_x = _global.boat._x;&lt;br /&gt;boat_y = _global.boat._y;&lt;br /&gt;car_x = _global.car._x;&lt;br /&gt;car_y = _global.car._y;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-8715116228585238867?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/8715116228585238867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/01/functions-functions-functions.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/8715116228585238867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/8715116228585238867'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/01/functions-functions-functions.html' title='Functions, functions, functions'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-7129882991555803470</id><published>2009-01-03T22:47:00.006Z</published><updated>2009-01-03T23:31:42.199Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='interactive media'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='problem solving'/><title type='text'>More Coding for Fun (while still solving the design problem)</title><content type='html'>Well, as usual I take the opportunity in the holidays to practice and develop my Interactive Media skills. Last time I made a &lt;a href="http://dansinteractive.blogspot.com/2008/07/uke-tuner-flash-based-ukulele-tuning.html"&gt;Ukulele Tuner&lt;/a&gt;, this time, prompted by a relatives' purchase of a OO gauge railway for Christmas (and my own love of making things and building models) I put together a program to speed up scale calculations to make it easier for me when (and if) I find time to make scale model buildings for my relatives' railway.&lt;br /&gt;&lt;br /&gt;Here it is produced in Flash with ActionScript, graphics produced in Fireworks and exported as PNG 32. Ultimately I will compile it into a windows executable using Zinc or Flash Studio once it has been thoroughly tested:&lt;br /&gt;&lt;br /&gt;&lt;object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" height="450" width="300" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&gt;&lt;param name="_cx" value="7938"&gt;&lt;param name="_cy" value="11906"&gt;&lt;param name="FlashVars" value=""&gt;&lt;param name="Movie" value="http://www.digitalarena.co.uk/coalvillemodels/online_calc.swf"&gt;&lt;param name="Src" value="http://www.digitalarena.co.uk/coalvillemodels/online_calc.swf"&gt;&lt;param name="WMode" value="Window"&gt;&lt;param name="Play" value="0"&gt;&lt;param name="Loop" value="-1"&gt;&lt;param name="Quality" value="High"&gt;&lt;param name="SAlign" value=""&gt;&lt;param name="Menu" value="-1"&gt;&lt;param name="Base" value=""&gt;&lt;param name="AllowScriptAccess" value=""&gt;&lt;param name="Scale" value="ShowAll"&gt;&lt;param name="DeviceFont" value="0"&gt;&lt;param name="EmbedMovie" value="0"&gt;&lt;param name="BGColor" value=""&gt;&lt;param name="SWRemote" value=""&gt;&lt;param name="MovieData" value=""&gt;&lt;param name="SeamlessTabbing" value="1"&gt;&lt;param name="Profile" value="0"&gt;&lt;param name="ProfileAddress" value=""&gt;&lt;param name="ProfilePort" value="0"&gt;&lt;param name="AllowNetworking" value="all"&gt;&lt;param name="AllowFullScreen" value="false"&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;       &lt;embed src="http://www.digitalarena.co.uk/coalvillemodels/online_calc.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="300" height="450"&gt;&lt;/embed&gt;&lt;br /&gt;     &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The model railway community on the &lt;a href="http://www.modelrailforum.com/forums/index.php?act=home"&gt;Model Rail Forum&lt;/a&gt;, the &lt;a href="http://www.newrailwaymodellers.co.uk/"&gt;New Railway Modellers &lt;/a&gt;forum and the &lt;a href="http://www.modelrailwayforum.co.uk/"&gt;Model Railway Forum&lt;/a&gt; were very helpful. Although I like to make models when I have time, I am by no means an OO or even a model railway expert at this point in time, so input from the potential user base was absolutely vital.&lt;br /&gt;&lt;br /&gt;I guess the lesson I would want my students to take from this is that you don't have to be an expert in a field to successfully design for it. But you do have to do thorough research and be &lt;em&gt;genuinely interested&lt;/em&gt; in learning about the field and learning about what is important to your client/the user. If you haven't learned to be &lt;em&gt;interested&lt;/em&gt; you may find that what you produce meets the needs of precisely no-one - and you won't even get paid.&lt;br /&gt;&lt;br /&gt;This lesson was summed up nicely by a designer who has influenced my approach to creative practice, &lt;a href="http://www.hellerbooks.com/pdfs/print_dialogue_chermayeff.pdf"&gt;Ivan Chermayeff&lt;/a&gt;. In a long time ago interview with ID magazine (I think it was ID), in an article called "Design: Another Reconsideration", Ivan simply states that "designers should be interested in everything" (para).&lt;br /&gt;&lt;br /&gt;I think he is right. Almost the one industry a designer will &lt;em&gt;not&lt;/em&gt; design for is his or her own industry. They will be employed to design for a variety of other industries throughout their career however, so an interest in other people's area of expertise is vital. After all, design is about problem solving (&lt;a href="http://www.hellerbooks.com/pdfs/print_dialogue_chermayeff.pdf"&gt;another lesson from Chermayeff&lt;/a&gt;), so designers need to be interested in the problems and get inside them, because as Ivan once described - solutions come directly out of an understanding of the problems (para).&lt;br /&gt;&lt;br /&gt;That's why my research took me directly to the community of model railway enthusiasts. Because in talking to &lt;em&gt;them &lt;/em&gt;(&lt;a href="http://www.modelrailforum.com/forums/index.php?showtopic=7316"&gt;here&lt;/a&gt;, &lt;a href="http://www.newrailwaymodellers.co.uk/Forums/viewtopic.php?f=32&amp;amp;t=19695"&gt;here&lt;/a&gt; and &lt;a href="http://modelrailwayforum.co.uk/showthread.php?t=58"&gt;here&lt;/a&gt;) I would come to correctly understand the problem (the issues surrounding calculating scale conversions for model railways, the scales themselves, what the user needs it to do etc.) Once I understood the problem, the solution was pretty much obvious, all I had to do was apply my new understanding to the interface, visual appearance and make it work.&lt;br /&gt;&lt;br /&gt;And the result? The community feedback was positive about the current version, so I know I have been successful. While a few suggestions for even further development have since been made, for now I have a working product that actually meets my own needs, and the needs of &lt;em&gt;real live&lt;/em&gt; users.&lt;br /&gt;&lt;br /&gt;Only possible, because the &lt;em&gt;users&lt;/em&gt; were consulted about the design problem, and their input turned into a solution. Problem solved.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-7129882991555803470?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/7129882991555803470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2009/01/more-coding-for-fun-while-still-solving.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/7129882991555803470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/7129882991555803470'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2009/01/more-coding-for-fun-while-still-solving.html' title='More Coding for Fun (while still solving the design problem)'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6568534377971544546</id><published>2008-10-10T23:38:00.008+01:00</published><updated>2009-08-10T12:14:19.988+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='key'/><category scheme='http://www.blogger.com/atom/ns#' term='switch'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='listener'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>Switches and Key Listeners for Game Controls</title><content type='html'>Well I just can't help fiddling around with code to see what I can do. I began toying with making some kind of game where you control a craft of some kind and must avoid the bad things and pick-up the good things.&lt;br /&gt;&lt;br /&gt;Rather than dive straight into graphics I followed the best practice and began making the code work first. What follows is the simple beginnings of a game control script that uses a &lt;span style="font-style: italic;"&gt;key listener&lt;/span&gt;  object to check what key the player is using. Then, instead of using &lt;span style="font-style: italic;"&gt;if else&lt;/span&gt; as I might usually be tempted to do I decided to use a &lt;span style="font-style: italic;"&gt;switch&lt;/span&gt; to check which key is being pressed and change the direction of acceleration accordingly. For this to work for you, all you need to do it dump a &lt;span style="font-style: italic;"&gt;movieclip&lt;/span&gt; onto the stage with the instance name "ship_MC", then copy the following code into your first key frame:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/*Up, down, left and right keys control direction. Space is the emergency brake.&lt;/span&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/*Set initial values for direction and speed, and the rate of acceleration&lt;/span&gt; */&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;xspeed = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;yspeed = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;accelerate = 1;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/*Create the key listerner object&lt;/span&gt;*/&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var myControlKeyListener:Object = new Object();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/*Set up a conditional response to the key press that changes the value of xspeed and yspeed depending on which key is being pressed and for how long.&lt;/span&gt;*/&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;myControlKeyListener.onKeyDown = function() {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    switch (Key.getCode()) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    case Key.SPACE :&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        trace("space");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        xspeed = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        yspeed = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    case Key.LEFT :&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        trace("left");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        xspeed -= accelerate;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    case Key.UP :&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        trace("up");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        yspeed -= accelerate;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    case Key.RIGHT :&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        trace("right");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        xspeed += accelerate;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    case Key.DOWN :&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        trace("down");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        yspeed += accelerate;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/*Add the key listener&lt;/span&gt;*/&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Key.addListener(myControlKeyListener);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/*Animate the direction and velocity of the ship_MC movie clip according to the value of xspeed and yspeed&lt;/span&gt; */&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;onEnterFrame = function () {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    this.ship_MC._x += xspeed;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    this.ship_MC._y += yspeed;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The comments between the /* */ in the code above explain how it works. If you have not used  &lt;span style="font-style: italic;"&gt;switch&lt;/span&gt; before, and tend to stick to&lt;span style="font-style: italic;"&gt; if else&lt;/span&gt; you will find in some cases that switch is much easier to work out the logic for and takes less typing.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Demo SWF&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="400" height="290"&gt;&lt;br /&gt;    &lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/spaceship.swf"&gt;&lt;br /&gt;    &lt;param name=quality value=high&gt;&lt;br /&gt;    &lt;embed src="http://www.digitalarena.co.uk/diblog/spaceship.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="400" height="290"&gt;&lt;/embed&gt;&lt;br /&gt;      &lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6568534377971544546?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6568534377971544546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2008/10/switches-and-key-listeners-for-game.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6568534377971544546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6568534377971544546'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2008/10/switches-and-key-listeners-for-game.html' title='Switches and Key Listeners for Game Controls'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-4379663095533008001</id><published>2008-09-01T00:29:00.020+01:00</published><updated>2008-09-27T16:03:48.442+01:00</updated><title type='text'>Flash Projects - #4 - Custom Video Player Dynamic Menu</title><content type='html'>I am typing late on this one, so I will probably re-write it for clarity in a few days. Meanwhile I hope you find it helpful.&lt;br /&gt;&lt;br /&gt;Having programmed a &lt;a href="http://dansinteractive.blogspot.com/2008/08/flash-projects-3-custom-flv-player.html"&gt;custom FLV player in Flash&lt;/a&gt;, I wasn't satisfied with hard coded video selection menu. This would mean that whenever I want to add another video would I need to edit the source file, add another button, add the actionscript for the button, recompile the movie and re-upload the movie - with all the attendant cacheing issues. Not a great approach.&lt;br /&gt;&lt;br /&gt;Better would be to have the video selection menu generate itself dynamically from data in an XML file. This way I would only have to compile the video player once, but could update the menu by uploading a new XML file.&lt;br /&gt;&lt;br /&gt;I hunted down some code on the web (I forgot the URL or I would link to it), it didn't work but with a minor tweak I was left with the following:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;xStart = 0;&lt;br /&gt;yStart = 0;&lt;br /&gt;bWidth = 101;&lt;br /&gt;bHeight = 35;&lt;br /&gt;menuXml = new XML();&lt;br /&gt;menuXml.ignoreWhite = true;&lt;br /&gt;menuXml.onLoad = loadVidData;&lt;br /&gt;menuXml.load("menu.xml");&lt;br /&gt;function loadVidData() {&lt;br /&gt;for (var i = 0; i&amp;lt;this.firstchild.childnodes.length; i++) {&lt;br /&gt;var bn = this.firstChild.childNodes[i].attributes.buttonName;&lt;br /&gt;var b = _root.menuHolder_mc.attachMovie("button", bn, i);&lt;br /&gt;b._x = xStart;&lt;br /&gt;b._y = yStart+(bHeight*i);&lt;br /&gt;b.txt = bn;&lt;br /&gt;b.onPress = function() {&lt;br /&gt;//trace(this.txt);&lt;br /&gt;_root.video_ns.play(this.txt+".flv");&lt;br /&gt;currentvid = this.txt+".flv";&lt;br /&gt;_root.heading = this.txt;&lt;br /&gt;};&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Essentially it sets a few variables to start with - the starting co-ordinates of the menu when it builds (&lt;em&gt;xstart&lt;/em&gt; and &lt;em&gt;ystart&lt;/em&gt;), and the dimensions of the buttons that make up the menu (&lt;em&gt;bWidth&lt;/em&gt; and &lt;em&gt;bHeight&lt;/em&gt;). You can set your own values for these to suite your design.&lt;br /&gt;&lt;br /&gt;Then it creates an XML object and loads an XML file called "menu.xml". If you choose to name your XML file differently, make sure you change it in the Actionscript too.&lt;br /&gt;&lt;br /&gt;The next part builds the menu based on the content of the XML file by attaching a copy of the button library item (more about this later) for each entry in the XML file. It positions each button one below the other based on the &lt;em&gt;bHeight&lt;/em&gt; value you set earlier.&lt;br /&gt;&lt;br /&gt;The text on each button is also taken from the XML file variable &lt;em&gt;txt&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;Then we have the Actionscript that tells the button what to do when clicked. In this case it tells the &lt;em&gt;video_ns&lt;/em&gt; netstream object to play a file with the name defined by the XML variable &lt;em&gt;txt&lt;/em&gt;. (The Actionscript adds the file extension .flv to the end of the value defined in the XML variable &lt;em&gt;txt&lt;/em&gt;).&lt;br /&gt;&lt;br /&gt;We also set the &lt;em&gt;currentvid &lt;/em&gt;variable (&lt;a href="http://dansinteractive.blogspot.com/2008/08/flash-projects-3-custom-flv-player.html"&gt;purpose explained in the other tutorial&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;Finally we set a variable called &lt;em&gt;heading&lt;/em&gt; to have the same value as the XML variable &lt;em&gt;txt&lt;/em&gt;. This is used to display the title of the video in a dynamic text box.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Putting It All Together&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;The Menu&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;First create a movie clip to be used in your menu as a button. This will be repeated vertically for each video file in the XML file. The button needs to have a dynamic text box on it to display the name of the video that will be shown when it is clicked. The variable name of the dynamic text box should be &lt;em&gt;txt&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;Right click the button in the library and select "linkage". Set the movie clip to export for Actionscript and give it the identifier "button".&lt;br /&gt;&lt;br /&gt;Then create an empty movie clip on the stage, and give it the name &lt;em&gt;menuHolder_mc. &lt;/em&gt;The script above will actually fill this empty movie clip with the menu, this makes it possible to adjust the position of the menu visually, by moving the positio of the menuHolder_mc movie clip. (It will also allow us to animate the movie clip in a future tutorial).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;The Title&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Create a dynamic text box with the variable name &lt;em&gt;heading&lt;/em&gt;. Put it where you want it on the screen.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;The XML File&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now the flash movie is done we need to format an XML file in such a way that the Flash movie will be able to parse it to make our menu. Sample XML code follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&amp;#60;?xml version="1.0" encoding="iso-8859-1"?&amp;#62;&lt;br /&gt;&amp;#60;menu&amp;#62;&lt;br /&gt;&amp;#60;menu buttonName = "Vid 1"/&amp;#62;&lt;br /&gt;&amp;#60;menu buttonName = "Vid 2"/&amp;#62;&lt;br /&gt;&amp;#60;menu buttonName = "Vid 3"/&amp;#62;&lt;br /&gt;&amp;#60;menu buttonName = "Vid 4"/&amp;#62;&lt;br /&gt;&amp;#60;menu buttonName = "Vid 5"/&amp;#62;&lt;br /&gt;&amp;#60;menu buttonName = "Vid 6"/&amp;#62;&lt;br /&gt;&amp;#60;/menu&amp;#62;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can enter as many &amp;#60;menu buttonName = "video file name without file extension goes here"/&amp;#62; lines as you like. Just make sure you put the exact file name, minus file extension. If, for instance, your file name is "Summer Holiday.flv" you put "Summer Holiday".&lt;br /&gt;&lt;br /&gt;The Flash movie can cope with spaces in the filename, and don't forget, it is the filename that is being used to label the buttons, so I recommend you name your files with the title of the films and with spaces.&lt;br /&gt;&lt;br /&gt;Let's face it, "Summer Holiday" reads a lot better than "holiday_video_001" on the video select menu.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;Finishing Off&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;All you need to do is make sure the XML file, the Flash movie video player, and the FLV files listed in the XML file are all in the same folder. Then it should just work.&lt;br /&gt;&lt;br /&gt;Anyway, as I said, it is pretty late (01:30am) for me, so I know the above is not as clear as it could be. I will rewrite in a few days.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-4379663095533008001?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/4379663095533008001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2008/09/flash-projects-4-custom-video-player.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4379663095533008001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4379663095533008001'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2008/09/flash-projects-4-custom-video-player.html' title='Flash Projects - #4 - Custom Video Player Dynamic Menu'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-8473543153986006476</id><published>2008-08-29T19:40:00.007+01:00</published><updated>2008-08-29T20:38:22.392+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cinema 4d'/><category scheme='http://www.blogger.com/atom/ns#' term='truespace'/><category scheme='http://www.blogger.com/atom/ns#' term='daz'/><category scheme='http://www.blogger.com/atom/ns#' term='maxon'/><category scheme='http://www.blogger.com/atom/ns#' term='caligari'/><category scheme='http://www.blogger.com/atom/ns#' term='3d'/><category scheme='http://www.blogger.com/atom/ns#' term='carrara'/><title type='text'>Well that didn't take long - Carrara 5 Pro - free on a magazine again!</title><content type='html'>&lt;a href="http://www.pcpro.co.uk/images/latest_mag_shopper.jpg"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 200px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://www.pcpro.co.uk/images/latest_mag_shopper.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I'm not saying I was right, but it is pretty well timed. &lt;a href="http://dansinteractive.blogspot.com/2008/08/truespace-76-free.html"&gt;Only a couple of posts ago &lt;/a&gt;I was speculating that Caligari's give away of TrueSpace 7.2 might be their answer to Daz giving away Carrara 5 Pro on 3D World magazine, and we should expect the next move from Daz.&lt;br /&gt;&lt;br /&gt;Guess what! Daz is giving Carrara 5 Pro away &lt;strong&gt;&lt;em&gt;again&lt;/em&gt;&lt;/strong&gt; - this time on Computer Shopper (sold in the UK for the princely sum of £4.99) - a magazine with a massive distribution. They might as well let people download it from the Daz website now, anyone in the UK who ever planned on buying Carrara 5 will just buy Computer Shopper instead. But I suppose there is the bandwidth issue, the download would be so popular it would seriously slow up their servers so this is just another way of getting market penetration.&lt;br /&gt;&lt;a href="http://www.pcpro.co.uk/images/latest_mag_shopper.jpg"&gt;&lt;/a&gt;&lt;br /&gt;Read about it on the &lt;a href="http://www.computershopper.co.uk/shopper/html/Latest_Issue-shopper.html"&gt;Computer Shopper website here (Note, the content of the linked page will change next month) &gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Meanwhile, where can we expect the next move? I think it's about time Maxon gave something away. I've not seen any offerings from them since Cinema 4D 6SE way back in about 2002. Can they feel their market share shrinking around them? Free is a hard price the compete with, and let's face it, Carrara 5 Pro and TrueSpace 7.2 are both pretty able programs. The workflow, or habit, (or even snobbery) that keeps some users loyal to ridiculously high priced software can only stand up to so much.&lt;br /&gt;&lt;br /&gt;As software like Carrara keeps increasing its power it is only a matter of time before the devoted Max user begins to wonder what extra they are getting by paying $3495.00 for their license instead of the $549.00 they could pay for Carrara 6.&lt;br /&gt;&lt;br /&gt;I predict that for most users, the added extras that come with Max are of a very niche nature, and lots of people could switch to Carrara and still produce what they want at the end of the day. Blender is in the running too, at an even lower price of free, but its unusual interface would make a quick switch too jarring for most users.&lt;br /&gt;&lt;br /&gt;This developing situation reminds me of Quark Xpress. Originally a one product company that dominated the print publication industry as the "standard", sold for a high price and according to an old lecturer of mine didn't offer much of an academic discount. So Adobe launches InDesign with seamless integration with the other Adobe products the designers are already using, at a much lower price, and they practically gave it away for educational purposes. Even little Serif kept building their PagePlus until even that was hailed by industry journals as being a professional level DTP package at a budget price.&lt;br /&gt;&lt;br /&gt;The result? Quark gave away a full copy of their Xpress software on a magazine for the first time ever around a year ago (it happened to be Quark Xpress 5). Were they feeling the pinch of shrinking market share? I reckon so. It would be interesting to look at their pricing structure now to see if they charge as much as they did back in their heyday of the mid 1990s.&lt;br /&gt;&lt;br /&gt;I use this as an example that, no matter how "industry standard" a product is today, a new product is being developed right now that is just as good, just as powerful for every common application, and it is being sold at a fraction of the price (and in some cases given away).&lt;br /&gt;&lt;br /&gt;One day many users will wake up and find that they can use this cheaper product for everything &lt;em&gt;they&lt;/em&gt; need, and wonder why they should pay 6 times as much for the niche gizmos they never used anyway. And this is how market share is eroded.&lt;br /&gt;&lt;br /&gt;Let the battle continue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-8473543153986006476?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/8473543153986006476/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2008/08/well-that-didnt-take-long-carrara-5-pro.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/8473543153986006476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/8473543153986006476'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2008/08/well-that-didnt-take-long-carrara-5-pro.html' title='Well that didn&apos;t take long - Carrara 5 Pro - free on a magazine again!'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-411152577178890795</id><published>2008-08-22T14:16:00.005+01:00</published><updated>2008-08-22T14:21:31.784+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='computer arts'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='Free'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Online Developer Tutorials from .NET</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.netmag.co.uk/files/article_images/152/152dynamic110.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px;" src="http://www.netmag.co.uk/files/article_images/152/152dynamic110.gif" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I have long since been a fan of the tutorials provided by &lt;a href="http://www.computerarts.co.uk"&gt;Computer Arts&lt;/a&gt;. But only today did I learn that &lt;a href="http://www.netmag.co.uk"&gt;.NET&lt;/a&gt; magazine also has some seriously useful tutorials too.&lt;br /&gt;&lt;br /&gt;Ranging from CSS to Flash they are well worth adding to your browser favourites. Check out their repository here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.netmag.co.uk/zine/develop"&gt;http://www.netmag.co.uk/zine/develop&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-411152577178890795?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/411152577178890795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2008/08/online-developer-tutorials-from-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/411152577178890795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/411152577178890795'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2008/08/online-developer-tutorials-from-net.html' title='Online Developer Tutorials from .NET'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-5688682489978300917</id><published>2008-08-16T22:25:00.003+01:00</published><updated>2008-08-16T22:51:29.857+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='truespace'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='3d'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='Free'/><category scheme='http://www.blogger.com/atom/ns#' term='Freeware'/><title type='text'>TrueSpace 7.6 FREE?</title><content type='html'>&lt;a href="http://www.caligari.com/Products/trueSpace/tS75/Brochure/tS76_images/MarcelBarthel_GreenGarden4_s.jpg"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://www.caligari.com/Products/trueSpace/tS75/Brochure/tS76_images/MarcelBarthel_GreenGarden4_s.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Occasionally, as I look around at free software for creative purposes, I am genuinely suprised by some amazing give-aways. Usually these freebies come with one of the well known digital design journals like &lt;a href="http://www.computerarts.co.uk/"&gt;Computer Arts&lt;/a&gt;, &lt;a href="http://www.3dworldmag.com/"&gt;3D World&lt;/a&gt; or DigitalArts (formerly Digit).&lt;br /&gt;&lt;br /&gt;This time though, it is well known 3D Software developer &lt;a href="http://www.caligari.com/"&gt;Caligari &lt;/a&gt;that is giving away their hard developed wares, and not even limiting it to magazine readers. This time &lt;a href="http://cart1.caligari.com/web/Truespacemainreg.aspx"&gt;you can download Truespace 7.6, their latest version, absolutely free&lt;/a&gt;. All you need to do is click the link on the home page, and set up a free membership account if you don't already have one.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://cart1.caligari.com/web/Truespacemainreg.aspx"&gt;What are you waiting for? Download it now &gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Caligari have given away TrueSpace before. V1 and V3 have both been available for a while, but this is the first time they appear to have given away their latest version, and by the looks of things it is pretty powerful.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.caligari.com/Gallery/ImagesGallery/2008/feb/images/3553.jpg"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://www.caligari.com/Gallery/ImagesGallery/2008/feb/images/3553.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;See how it compares with more well known competitor products:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.caligari.com/products/trueSpace/ts75/Brochure/images/tS_external_comparison_matrix.jpg"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://www.caligari.com/products/trueSpace/ts75/Brochure/images/tS_external_comparison_matrix.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I actually found out about this amazing offering when reading on the Computer Arts website, what the content of the new &lt;a href="http://www.computerarts.co.uk/about_us/latest_issue/3d_world_issue_108"&gt;3D World issue was going to be&lt;/a&gt;, then promptly zoomed over to Caligari to see for myself.&lt;br /&gt;&lt;br /&gt;The reasons for this daring move by Caligari are to be discussed in the new issue of 3D World (which I don't have yet), but I can't help wondering if this has something to do with Daz 3D's move to give away Carrara 5 Pro on a magazine a few months ago. If so, watch Daz, because that is where the next move may be.&lt;br /&gt;&lt;br /&gt;Whatever the reason, high competition in the 3D software industry has to be a factor, and so a good thing in the short term. The problem with this type of competition is that there are likely to be casualties, and that may hurt if you have developed a workflow around software from a company that goes under, or stops developing that title.&lt;br /&gt;&lt;br /&gt;But while that is largely out of the control of most of us, make hay while the sun shines and &lt;a href="http://cart1.caligari.com/web/Truespacemainreg.aspx"&gt;download TrueSpace 7.6 today, free.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-5688682489978300917?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/5688682489978300917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2008/08/truespace-76-free.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5688682489978300917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5688682489978300917'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2008/08/truespace-76-free.html' title='TrueSpace 7.6 FREE?'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-5483048513687925493</id><published>2008-08-14T20:22:00.059+01:00</published><updated>2008-08-23T22:37:37.934+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='interactive media'/><category scheme='http://www.blogger.com/atom/ns#' term='progress bar'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='player'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='movieclip'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='flv'/><title type='text'>Flash Projects - #3 - Custom FLV Player</title><content type='html'>Back in February I posted &lt;a href="http://dansinteractive.blogspot.com/2008/02/flash-projects-1-movie-player.html"&gt;a tutorial to make a video player in Flash that played external SWF files&lt;/a&gt;. I promised then to post another tutorial that showed how to make a video player in Flash that played external FLV files. I wrote the program ages ago but finally got round to writing it up for my blog.&lt;br /&gt;&lt;br /&gt;Although both programs are fine, FLV is much the up-to-date way of showing video in Flash so I hope you find this useful. feel free to leave comments or questions.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Getting Started&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To keep things organised I like wherever possible to keep all my code in one place. All the ActionScript in this tutorial should be attached to the first key frame in your movie.&lt;br /&gt;&lt;br /&gt;Unlike the version of the video player that played &lt;a href="http://dansinteractive.blogspot.com/2008/02/flash-projects-1-movie-player.html"&gt;SWF movies&lt;/a&gt;, we cannot use &lt;em&gt;loadmovie&lt;/em&gt; to simply show a movie within a movie. FLV files require us to use &lt;em&gt;NetConnection&lt;/em&gt; and then &lt;em&gt;NetStream&lt;/em&gt; to stream the FLV file from its location.&lt;br /&gt;&lt;br /&gt;First off then we need to create a new &lt;em&gt;NetConnection&lt;/em&gt; called "myConnection_nc":&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var myConnection_nc:NetConnection = new NetConnection();&lt;br /&gt;myConnection_nc.connect(null);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now we need to create a &lt;em&gt;NetStream&lt;/em&gt; called "video_ns" that will stream through the &lt;em&gt;NetConnection&lt;/em&gt; you made above:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var video_ns:NetStream = new NetStream(myConnection_nc);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now we have created a &lt;em&gt;NetConnection&lt;/em&gt; and a &lt;em&gt;NetStream&lt;/em&gt; through which we will stream the FLV file, we need to create a video object on the stage through which the FLV will be displayed.&lt;br /&gt;&lt;br /&gt;First, you need to create a new Embedded Video object in the library. To do this, click the little menu in the corner at the top of the Library and select the "New Video" option. It should appear in the Library as "Embedded Video 1". Then drag an instance of the Embedded Video 1 onto the stage and give it the instance name of "my_video".&lt;br /&gt;&lt;br /&gt;Now we are ready to attach the &lt;em&gt;NetStream&lt;/em&gt; created above to the video object you just placed on the stage called "my_video":&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;my_video.attachVideo(video_ns);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now we need to do two things. First, we need to find out how long the FLV file is (its duration), second we need to set the value of the &lt;em&gt;duration&lt;/em&gt; variable equal to the property of the duration object. This will allow us to control the playback of the FLV later on.&lt;br /&gt;&lt;br /&gt;To do this we first use &lt;em&gt;prototype.OnMetaData&lt;/em&gt; to find the duration of the video - this only works with FLV 1.1 files and later, earlier versions do not include duration in metadata.&lt;br /&gt;&lt;br /&gt;Unfortunately there is no other way of finding the duration of an FLV file (you can't use the &lt;em&gt;_totalframes&lt;/em&gt; method like you can in SWF files).&lt;br /&gt;&lt;br /&gt;Then we can set the value of the &lt;em&gt;duration&lt;/em&gt; variable to be equal to the duration property of the FLV file as defined in the FLV's MetaData. Here goes:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;NetStream.prototype.onMetaData = function(obj){&lt;br /&gt;var duration = obj.duration;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Video Selector&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now for the playback controls. The simplest control is the video selector. This allows the user to choose which video they want to watch.&lt;br /&gt;&lt;br /&gt;First create a button in the Library, then drag two instances of the button onto the stage. Give the buttons the following instance names - "m1_btn" and "m2_btn".&lt;br /&gt;&lt;br /&gt;Because we are playing FLV files and not SWF files, we cannot use the &lt;em&gt;loadMovie&lt;/em&gt; method. Instead we need to tell the NetStream object we created earlier, to &lt;em&gt;play&lt;/em&gt; and tell it which FLV file to play. We create code for each of the buttons we created earlier, so that when each is clicked, the &lt;em&gt;NetStream&lt;/em&gt; object we created streams a different FLV file to the video object:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.m1_btn.onRelease = function () {&lt;br /&gt;video_ns.play("video2.flv");&lt;br /&gt;currentvid = "video2.flv";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;_root.m2_btn.onRelease = function () {&lt;br /&gt;video_ns.play("video1.flv");&lt;br /&gt;currentvid = "video1.flv";&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The code above does two things when the button is released. First, it tells the NetStream object called "video_ns" to play a specified FLV file. Secondly it sets the value of a variable called &lt;em&gt;currentvid&lt;/em&gt; to be the same as the name of the FLV file - this helps us later on when we are programming the playback controls.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Rewind Button&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Dead easy. Create a button in the Library that looks like a rewind icon. Drag an instance of the button onto the stage and give it the instance name of "rw_btn". Then add the following code to the first key frame with the rest:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.rw_btn.onRelease = function () {&lt;br /&gt;playpos = video_ns.time;&lt;br /&gt;if (playpos &gt; 10)&lt;br /&gt;{&lt;br /&gt;video_ns.seek(playpos-10);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;video_ns.seek(0);&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The code above makes the video jump back 10 seconds when the rewind button is clicked. It might seem pretty complex considering that all we want to do is rewind a bit. What it actually does first is check how far into the video we have progressed and the reason for this is that we don't want to jump back to a point &lt;em&gt;before&lt;/em&gt; the video starts, that would be impossible. Depending on how far the video has played the code then does one of two things. If the video has played more than 10 seconds, then it tells the NetStream object to jump back 10 seconds in the FLV, if the video has not yet been playing for more than 10 seconds it tells the NetStream object to go back to the beginning of the FLV.&lt;br /&gt;&lt;br /&gt;I found that in practice, with large FLV files, the rewind is not always reliable, and can get "stuck" at points, refusing to rewind past them. I suspect this is something to do with the FLV itself, rather than the coding - however, I have also included the option of clicking on the progress bar to jump to any point in the video, which so far has proved very reliable - this is explained later in the tutorial.&lt;br /&gt;&lt;br /&gt;NOTE: If you made the &lt;a href="http://dansinteractive.blogspot.com/2008/02/flash-projects-1-movie-player.html"&gt;previous video player that used SWF instead of FLV&lt;/a&gt; files, you will notice that we are using a lot of different methods. Most significant is that with FLV we cannot &lt;em&gt;gotoAndPlay&lt;/em&gt; specific frames as we can with SWF files. Instead we use the &lt;em&gt;seek&lt;/em&gt; method, and it is the NetStream object called "video_ns" that we are instructing to &lt;em&gt;seek&lt;/em&gt;, not the video instance on the stage.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Forward-wind&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This is much more straightforward. As before, create a button in the Library that looks like a forward-wind icon. Drag an instance of the button onto the stage and give it the instance name of "fw_btn". Then add the following code to the first key frame with the rest:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.fw_btn.onRelease = function () {&lt;br /&gt;playpos = video_ns.time;&lt;br /&gt;video_ns.seek(playpos+10);&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;This isn't nearly as complex. When the forward-wind button is released the code sets the value of a variable &lt;em&gt;playpos&lt;/em&gt; to the current &lt;em&gt;time&lt;/em&gt; position of the movie using &lt;em&gt;video_ns.time. &lt;/em&gt;It then simply uses the &lt;em&gt;seek&lt;/em&gt; method to tell the NetStream object to jump forward 10 seconds from the current time position in the FLV.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Play and Pause Button&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now we get more complex. For my player I opted to have the Play and Pause buttons be the same button, but have the icon on the button change depending on whether the movie is playing or not. If the movie is playing, the pause icon is visible, telling the user they can click to pause. If the movie is paused, the play icon is visible, telling the user they can click to play.&lt;br /&gt;&lt;br /&gt;To accomplish this the play/pause button is not a button at all - it is a movie clip. The movie clip has two frames, one frame with the play icon, the other with the pause icon. The frames are then given labels - "pauseon" and "pauseoff". This allows us to dynamically change which frame is currently visible, and therefore the appearance of the play/pause button. Create a movie clip that does all that, then drag an instance of it to the stage and give it the instance name of "pause_mc". Then add the following code to the first key frame in the root timeline with the rest:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;video_ns.onStatus = function() {&lt;br /&gt;if (video_ns.time &gt;= duration-1){&lt;br /&gt;playstatus = 2;&lt;br /&gt;_root.pause_mc.gotoAndStop("pauseon");&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;playstatus = 1;&lt;br /&gt;_root.pause_mc.gotoAndStop("pauseoff");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The code above uses a change in the NetStream status to trigger a check. The code checks whether the current position within the FLV file is greater than or equal to 1 second from the end of the file. If so it sets the value of the &lt;em&gt;playstatus&lt;/em&gt; variable to "2" (we use this later), and tells the play/pause button to move to the frame labelled "pauseon", so the button shows the pause icon, telling the user they can click to pause.&lt;br /&gt;&lt;br /&gt;If the current position within the FLV file shows there is more than 1 second of the movie left to play, then the code sets the value of the &lt;em&gt;playstatus&lt;/em&gt; variable to "1", and tells the play/pause button to show the frame labelled "pauseoff", so the button shows the play icon, telling the user they can click to play.&lt;br /&gt;&lt;br /&gt;the above code just sets the &lt;em&gt;playstatus&lt;/em&gt; variable, and changes the visual appearance of the play/pause button. Now we need to enter the code that actually controls the playing and the pausing. Add the following code to the first key frame in the root timeline with the rest:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.pause_mc.onRelease = function () {&lt;br /&gt;if (playstatus == 1)&lt;br /&gt;{&lt;br /&gt;video_ns.pause();&lt;br /&gt;_root.pause_mc.gotoAndStop("pauseoff");&lt;br /&gt;}&lt;br /&gt;else if (playstatus == 2)&lt;br /&gt;{&lt;br /&gt;video_ns.play(currentvid);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is where lots of the variables we have been setting earlier, with no visible purpose, suddenly become useful. The code above runs whenever the play/pause button is released.&lt;br /&gt;&lt;br /&gt;First it checks the value of the &lt;em&gt;playstatus&lt;/em&gt; variable&lt;em&gt;.&lt;/em&gt; If the value of &lt;em&gt;playstatus&lt;/em&gt; is "1" (which means the FLV file has more than 1 second left to play - see above), then it tells the NetStream object called "video_ns" to pause, and tells the play/pause button to show the frame labelled "pauseoff", so the button shows the play icon, telling the user they can click to play again.&lt;br /&gt;&lt;br /&gt;If the value of playstatus is "2" (which means the FLV file is in its last second of playback - see above), then it tells the NetStream object called "video_ns" to play the FLV file again, and uses thevalue of the currentvid variable, which was set when the user click the button to select which video they wanted to see, to tell it which FLV file that was. This &lt;em&gt;currentvid&lt;/em&gt; reminder is needed because we are playing FLV files and so must use &lt;em&gt;NetStream &lt;/em&gt;and not &lt;em&gt;loadmovie &lt;/em&gt;as we would if we were playing SWF files&lt;em&gt;. &lt;/em&gt;With &lt;em&gt;loadmovie &lt;/em&gt;the SWF file remains loaded into memory and so the program does not need reminding which movie to play because it still has it, with &lt;em&gt;NetStream&lt;/em&gt; the file is streamed from its location and not kept in memory - this is why the &lt;em&gt;currentvid&lt;/em&gt; variable was needed, to remind the program which FLV to play, without the user having to select it again using one of the video selector buttons we created right at the beginning. This is all about making it work more smoothly for the user - trying to make it work how they expect, rather than expecting them to learn the quirks of how your's works.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Progress Bar&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;No video player is complete without a progress bar telling the user how quickly the video is progressing, where they are in the video timewise, and how long is left.&lt;br /&gt;&lt;br /&gt;To create the progress bar graphics, draw a rectangle on the stage to represent the video progress bar. Make sure the rectangle has a fill and a stroke. Then select the filled area only, press F8 and convert it into a movieclip called progbar. Make sure you set the registration point of the symbol to be top left. Then select the stroke that outlined the rectangle, again press F8 and convert it into a movieclip called progbarframe. Again make sure you set the registration point of the symbol to be top left. Give each an instance names "progbar_mc" and&lt;br /&gt;"progbarframe_mc".&lt;br /&gt;&lt;br /&gt;Add the following code to the first key frame in the root timeline with the rest:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;onEnterFrame = function() {&lt;br /&gt;comppc = video_ns.time / duration;&lt;br /&gt;_root.progbar_mc._width = _root.progbarframe_mc._width*comppc;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The above code sets a variable called &lt;em&gt;comppc&lt;/em&gt; with a value that comes out of dividing the current position of the FLV movie in seconds with the duration of the movie in seconds. This gives &lt;em&gt;comppc&lt;/em&gt; a a value between 0 and 1. A value of 0.5 would mean the movie was half way through. We then multiply the maximum width of the progress bar (based on the width of the progbarframe_mc) by the value of &lt;em&gt;comppc &lt;/em&gt;to set the current width of the progress bar. By using onEnterFrame the progress bar updates several times per second as the movie plays, thus giving an accurate graphical representation of how far the movie has to go.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Progress Bar Jumper&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now we want to make it so the user can click anywhere on the progress bar and jump to that part of the movie. Add the following code to the first key frame in the root timeline with the rest:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;_root.progbarframe_MC.onRelease = function() {&lt;br /&gt;barleft = _root.progbarframe_MC._x;&lt;br /&gt;jumppos = (_xmouse-barleft)/_root.progbarframe_MC._width;&lt;br /&gt;if (playstatus == 1)&lt;br /&gt;{&lt;br /&gt;video_ns.seek(Math.round(jumppos*duration));&lt;br /&gt;}&lt;br /&gt;else if (playstatus == 2)&lt;br /&gt;{&lt;br /&gt;video_ns.play(currentvid);&lt;br /&gt;video_ns.seek(Math.round(jumppos*duration));&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The above code is probably the most complex part of the whole program. Funny how the luxuries, the "optional extras", that provide the least functionality are often the most complicated parts of the program.&lt;br /&gt;&lt;br /&gt;First we define a variable for the left side of theprogress bar called &lt;em&gt;barleft&lt;/em&gt;. This gives us a zero point against which to measure the location of the user's click on the progress bar. Then we define a variable that represents the users click on the progress bar called &lt;em&gt;jumppos.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;The value of &lt;em&gt;jumppos&lt;/em&gt; is defined by getting the X coordinate of the mouse when the bar is clicked and then subtracting from that the value of &lt;em&gt;barleft &lt;/em&gt;(the X coordinate of the the start of the bar). This tells us how far along the bar the user clicked. This number is then divided by the total width of the bar to give a number that represents how far along the bar the user clicked as a value between 0 and 1. A result of 0.5 would mean the user clicked in the middle of the bar.&lt;br /&gt;&lt;br /&gt;We then tell the &lt;em&gt;NetStream&lt;/em&gt; object to &lt;em&gt;seek&lt;/em&gt; to the point in the movie corresponding to where the user clicked on the bar. This is calculated by multiplying the value of &lt;em&gt;jumppos&lt;/em&gt; (where on the bar the user clicked) by the value of the &lt;em&gt;duration &lt;/em&gt;of the FLV file in seconds. However, I have also used Math.round to convert the result into an integer (by rounding up or down to the nearest whole number). This just helps keep things tidy and means the FLV will jump to a whole second, rather than a fraction of a second which may not exist.&lt;br /&gt;&lt;br /&gt;If the value of &lt;em&gt;playstatus &lt;/em&gt;is "1" then we just attempt to seek straight to the relevant point in the FLV file. However if the &lt;em&gt;playstatus&lt;/em&gt; is "2" this means there is only 1 second or less of the movie to go, so to make sure it works and we get no glitches, we tell the &lt;em&gt;NetStream&lt;/em&gt; object to play the &lt;em&gt;currentvid&lt;/em&gt; from the beginning and then seek to the relevant point in the FLV file. We have to do this because, as mentioned before, with &lt;em&gt;NetStream&lt;/em&gt; the video is not stored in memory, and so if there is less than 1 second left in the video, the streaming might be over before Flash has a chance to &lt;em&gt;seek&lt;/em&gt; to another part of the movie. By telling the video to start again using the &lt;em&gt;currentvid&lt;/em&gt; variable to remind it which video, and &lt;strong&gt;then&lt;/strong&gt; &lt;em&gt;seek&lt;/em&gt; to the relevant point, we can get a smoother operation.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Converting Video to FLV Format&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Of course, for this player to be any use, you need to be able to convert your video to FLV format.&lt;br /&gt;&lt;br /&gt;One programme that has worked for me without trouble is &lt;a href="http://www.dvdvideosoft.com/products/dvd/Free-Video-to-Flash-Converter.htm"&gt;Free Video to Flash Converter&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It is completely freeware and can convert video into SWF or FLV. You can even export video with its own player interface - and, while this defeats the object for my use of it, since I wanted a custom interface of my own design, some people may find this feature helpful.&lt;br /&gt;&lt;br /&gt;The program is pretty self explanatory, all you need to do is remember to export the movie as a FLV and save it with the name you programmed into your player and in the same directory as the player.&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;The End&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;And there we have it. Export your player as a SWF into the same directory as the FLV files you linked to and it should just work. Any problems, leave a comment and I will try to help.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-5483048513687925493?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/5483048513687925493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2008/08/flash-projects-3-custom-flv-player.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5483048513687925493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/5483048513687925493'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2008/08/flash-projects-3-custom-flv-player.html' title='Flash Projects - #3 - Custom FLV Player'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-2458387134566357047</id><published>2008-08-14T00:20:00.004+01:00</published><updated>2009-08-10T12:06:57.948+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swf'/><category scheme='http://www.blogger.com/atom/ns#' term='interactive media'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Playing Sound with your Computer Keyboard - Flash</title><content type='html'>I had a chat with one of my old Multimedia students on Facebook today. I pointed him to my Ukulele Tuner and he told me that he was currently building a Flash based interactive drum kit (he is a drummer after all).&lt;br /&gt;&lt;br /&gt;He had already produced a prototype that worked by clicking each drum with the mouse, but was not happy with the inability to play the drums properly on it. To play drums you need to be able to switch instrument quickly and at times strike two instruments at the same time. You can't do this with a single mouse and clicking on each drum. It's like playing the drums with one stick.&lt;br /&gt;&lt;br /&gt;He had the idea of allowing the user to play the drums using the keys on their computer keyboard, but was unsure how to proceed. Unable to leave teacher mode with a challenge like this I put together the following code.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Stage 1&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;Create a new AS2 Flash file and insert the following code into the first keyframe:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;//This attaches the sound for drum 1, make sure you did the linkage thing in the library&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var sound1:Sound = new Sound();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sound1.attachSound("drum_1");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;//This attaches the sound for drum 2, make sure you did the linkage thing in the library&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var sound2:Sound = new Sound();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sound2.attachSound("drum_2");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;//This code listens out for the user to press a key, then, depending on which key is pressed will trigger one of the sounds attached above.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var myDrumKeyListener:Object = new Object();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;myDrumKeyListener.onKeyDown = function () {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;if (Key.getCode()==65) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sound1.start();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;} else if (Key.getCode()==66) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sound2.start();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Key.addListener(myDrumKeyListener);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Stage 2&lt;/strong&gt;&lt;/p&gt;You will notice a bit where it says:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(Key.getCode()==&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and then there is a number, this number is the keycode for the key that plays the sound. You can find a list of keycodes online here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&amp;amp;file=00001113.html" target="_blank" rel="nofollow"&gt;http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&amp;amp;file=00001113.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Stage 3&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now you need to add the actual sound files. Do this by importing the sounds into the Library. Then right click the first sound and choose "Linkage" from the menu. Select the "Export for Actionscript" and "Export in First Frame" options. Then make sure you give the sound an &lt;strong&gt;&lt;em&gt;identifier&lt;/em&gt;&lt;/strong&gt;. This is the name by which the sound will be referenced in the actionscript above. I called the sound for the first drum "drum_1". Then in the actionscript it is referenced as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var sound1:Sound = new Sound();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sound1.attachSound("&lt;strong&gt;&lt;em&gt;drum_1&lt;/em&gt;&lt;/strong&gt;");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you put a different name as the &lt;strong&gt;&lt;em&gt;identifier&lt;/em&gt;&lt;/strong&gt;, make sure you also change it in the actionscript.&lt;br /&gt;&lt;br /&gt;Once that's all done you can press "OK". Then just repeat &lt;strong&gt;Stage 3&lt;/strong&gt; for each sound in the library.&lt;br /&gt;&lt;br /&gt;And that is about it.&lt;br /&gt;&lt;br /&gt;The challenge for my ex-student then, is to modify the code to include more drums and have them respond to an appropriate range of keys on the keyboard.&lt;br /&gt;&lt;br /&gt;Have jolly fun.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Demo SWF&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="250" height="100"&gt;&lt;br /&gt;  &lt;param name="movie" value="http://www.digitalarena.co.uk/diblog/sound%20keys%20flash.swf"&gt;&lt;br /&gt;  &lt;param name=quality value=high&gt;&lt;br /&gt;  &lt;embed src="http://www.digitalarena.co.uk/diblog/sound%20keys%20flash.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="250" height="100"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-2458387134566357047?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/2458387134566357047/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2008/08/playing-sound-with-your-computer.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/2458387134566357047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/2458387134566357047'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2008/08/playing-sound-with-your-computer.html' title='Playing Sound with your Computer Keyboard - Flash'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-1508842550633059120</id><published>2008-07-26T10:56:00.004+01:00</published><updated>2008-12-09T23:19:15.161Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='interactive media'/><category scheme='http://www.blogger.com/atom/ns#' term='all rights reserved'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='adobe'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Uke Tuner - Flash Based Ukulele Tuning Application</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_slqBonXlsN0/SIr2K16AHLI/AAAAAAAAABk/nPcmrARy5-E/s1600-h/uketuner_ss.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5227260983646362802" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_slqBonXlsN0/SIr2K16AHLI/AAAAAAAAABk/nPcmrARy5-E/s400/uketuner_ss.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now that I teach interactive media, rather than practice commercially for a living, I sometimes get fidgety, wanting to &lt;em&gt;do&lt;/em&gt; more of my own but never having the time.&lt;br /&gt;&lt;br /&gt;Finally the holiday's arrived and I was able to get inspired, on account of my wife buying a Ukulele. She was using an online tuning system, but it wasn't as helpful as it could have been. The problem with the online tuning system, was that it only gave audio samples of a Ukulele string being plucked. However it is much easier to tune an instrument to a continuous tone. In Uke Tuner I gave the option, plucked note, or continuous tone, so the user can choose their preferred method. Then of course I went overboard on graphics and interactivity - just for the fun of it.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.digitalarena.co.uk/dafreefiles/Uke%20Tuner%200.92.zip"&gt;You can download Uke Tuner 0.92 (Beta) here free &gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For the more technically minded, graphics were produced in &lt;a href="http://www.adobe.com/products/fireworks/"&gt;Fireworks&lt;/a&gt; then exported as &lt;a href="http://en.wikipedia.org/wiki/Portable_Network_Graphics"&gt;PNG 32 to preserve alpha channels &lt;/a&gt;or &lt;a href="http://en.wikipedia.org/wiki/Swf"&gt;SWF&lt;/a&gt;, for use in Flash. Audio was recorded from a &lt;a href="http://www.yamaha.com/yamahavgn/CDA/ContentDetail/ModelSeriesDetail/0,,CNTID%25253D1611%252526CTID%25253D205000%252526LGFL%25253DY,00.html"&gt;Yamaha PSR-240&lt;/a&gt; keyboard via a line-in cable from the keyboard's headphone socket. Sound was recorded and processed with &lt;a href="http://audacity.sourceforge.net/"&gt;Audacity&lt;/a&gt; then exported as &lt;a href="http://en.wikipedia.org/wiki/WAV"&gt;WAV&lt;/a&gt; 32-bit for use in Flash. Interactivity was produced in &lt;a href="http://www.adobe.com/products/flash/"&gt;Flash&lt;/a&gt;, with &lt;a href="http://www.adobe.com/devnet/flash/actionscript/actionscript02.html"&gt;ActionScript 2&lt;/a&gt;. Flash Audio settings were set to export sound at 22Khz stereo and 128kbps. Playback speed is &lt;a href="http://en.wikipedia.org/wiki/Frame_rate"&gt;30 fps &lt;/a&gt;to make it animate more smoothly. The application was compiled with &lt;a href="http://www.multidmedia.com/"&gt;MDM Flash Studio &lt;/a&gt;because it has a faster projector engine than the Flash Standalone Player, extends the ActionScript classes available in Flash with some additional functionality, and allows the creator to tweak the display options (such as turning off the blue bar at the top).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-1508842550633059120?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/1508842550633059120/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2008/07/uke-tuner-flash-based-ukulele-tuning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1508842550633059120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/1508842550633059120'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2008/07/uke-tuner-flash-based-ukulele-tuning.html' title='Uke Tuner - Flash Based Ukulele Tuning Application'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_slqBonXlsN0/SIr2K16AHLI/AAAAAAAAABk/nPcmrARy5-E/s72-c/uketuner_ss.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-9012503584924971530</id><published>2008-07-20T18:46:00.006+01:00</published><updated>2008-12-09T23:19:15.351Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='accessibility'/><category scheme='http://www.blogger.com/atom/ns#' term='web design'/><category scheme='http://www.blogger.com/atom/ns#' term='colour blind'/><title type='text'>Accessibility and Colour Blindness</title><content type='html'>Colour blindness has been more relevant to me this year more than previous years on account of having a colour blind student.&lt;br /&gt;&lt;br /&gt;While it certainly doesn't make life easier for an Art &amp;amp; Design &amp;amp; Interactive Media student it doesn't make it impossible to work in the design industry either. I did know of a former product designer, who was colour blind, who had a successful career in industry and in teaching.&lt;br /&gt;&lt;br /&gt;Even so, as a teacher, it is helpful to have some understanding of colour blindness so I know what to expect, and can help the student develop strategies to cope with areas of difficulty.&lt;br /&gt;One resource I found recently is a website called &lt;a href="http://www.vischeck.com/"&gt;Vischeck&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Vischeck provides colour blindness simulation tools, including an &lt;a href="http://www.vischeck.com/vischeck/vischeckImage.php"&gt;image previewer&lt;/a&gt;, a &lt;a href="http://www.vischeck.com/vischeck/vischeckURL.php"&gt;website previewer&lt;/a&gt; and a &lt;a href="http://www.vischeck.com/downloads/"&gt;Photoshop filter&lt;/a&gt;. The site also gives information about a &lt;a href="http://www.vischeck.com/daltonize/"&gt;Daltonization algorithm &lt;/a&gt;for correcting images for colour blind people. All fascinating stuff.&lt;br /&gt;&lt;br /&gt;I downloaded the Photoshop filter and installed it for Photoshop and Fireworks. It works fine in both.&lt;br /&gt;&lt;br /&gt;I wondered how the normal visible spectrum would look to a colour blind person, and so I used the Photoshop filter to adjust a bog standard colour wheel. The results were truly astonishing:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_slqBonXlsN0/SIN_UBQ1BBI/AAAAAAAAAAs/zaqXD8DpmwE/s1600-h/colourblind.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5225159974593037330" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_slqBonXlsN0/SIN_UBQ1BBI/AAAAAAAAAAs/zaqXD8DpmwE/s400/colourblind.jpg" border="0" /&gt;&lt;/a&gt;I just cannot imagine a world so radically different to the one I see now.&lt;br /&gt;&lt;br /&gt;Now I know why my student picked a muted grey/green instead of a vibrant green to represent grass in a client visual. To them they looked the same.&lt;br /&gt;&lt;br /&gt;This insight into how colour blind people actually see the world is probably the most valuable outcome of this find. Meanwhile the Photoshop filter will allow me to demonstrate it to other people, and to gauge usability of my own designs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-9012503584924971530?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/9012503584924971530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2008/07/accessibility-and-colour-blindness.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/9012503584924971530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/9012503584924971530'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2008/07/accessibility-and-colour-blindness.html' title='Accessibility and Colour Blindness'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_slqBonXlsN0/SIN_UBQ1BBI/AAAAAAAAAAs/zaqXD8DpmwE/s72-c/colourblind.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-258972534316772554</id><published>2008-03-17T12:42:00.004Z</published><updated>2008-03-17T12:48:56.524Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Free'/><category scheme='http://www.blogger.com/atom/ns#' term='magazine'/><category scheme='http://www.blogger.com/atom/ns#' term='adobe'/><title type='text'>Creative Reading</title><content type='html'>&lt;a href="http://www.adobe.com/products/adobemag/images/amagsm.jpg"&gt;&lt;img style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 200px; CURSOR: hand" alt="" src="http://www.adobe.com/products/adobemag/images/amagsm.jpg" border="0" /&gt;&lt;/a&gt; &lt;span style="font-size:130%;"&gt;Sometimes you just wish you could find that really useful resource from a source that is reliable, that is well designed, discusses creative issues in a professional way AND doesn't ask you to pay for it. The &lt;a href="http://www.adobe.com/products/adobemag/pastissues.html"&gt;Adobe Magazine &lt;/a&gt;is one of those resources.&lt;/span&gt; &lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;You can access it free at this address - &lt;a href="http://www.adobe.com/products/adobemag/pastissues.html"&gt;http://www.adobe.com/products/adobemag/pastissues.html&lt;/a&gt; - and it includes a full archive right back to 1995.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;I also read a plethora of other creative journals but this has to be one of the best of the free. What are you waiting for?&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-258972534316772554?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/258972534316772554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2008/03/creative-reading.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/258972534316772554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/258972534316772554'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2008/03/creative-reading.html' title='Creative Reading'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-3186807940455715273</id><published>2008-03-08T09:25:00.006Z</published><updated>2008-03-08T10:25:27.707Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='3d'/><category scheme='http://www.blogger.com/atom/ns#' term='parralax mapping'/><title type='text'>Parallax Mapping</title><content type='html'>While we are on the subject of mapping images to 3D meshes, you might want to learn about &lt;a href="http://en.wikipedia.org/wiki/Parallax_mapping"&gt;parallax mapping&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Parallax mapping finally begins to overcome the problem with all the other mappings (&lt;a href="http://en.wikipedia.org/wiki/Texture_mapping"&gt;texture&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Bump_mapping"&gt;bump&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Normal_mapping"&gt;normal&lt;/a&gt;), which is that they all look painted on and flat when viewed up close, especially at an angle.&lt;br /&gt;&lt;br /&gt;That is because they are in effect painted on. Parallax mapping works by actually displacing the coordinates of the texture, so that bumps actually obscure dents as you move round in 3D space. Hoorah.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://graphics.cs.brown.edu/games/SteepParallax/compare.jpg"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://graphics.cs.brown.edu/games/SteepParallax/compare.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p align="center"&gt;Comparison of mapping methods (&lt;a href="http://graphics.cs.brown.edu/games/SteepParallax/compare.jpg"&gt;Brown University, Rhode Island&lt;/a&gt;) click to enlarge.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-3186807940455715273?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/3186807940455715273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2008/03/parallax-mapping.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/3186807940455715273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/3186807940455715273'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2008/03/parallax-mapping.html' title='Parallax Mapping'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-6020304581609557976</id><published>2008-03-07T22:23:00.006Z</published><updated>2008-03-08T09:57:29.381Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='3d'/><category scheme='http://www.blogger.com/atom/ns#' term='normal map'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><category scheme='http://www.blogger.com/atom/ns#' term='genius'/><title type='text'>Normal Mapping</title><content type='html'>Just a quickie tonight, I just had to tell you about this great tutorial I found for creating &lt;a href="http://en.wikipedia.org/wiki/Normal_mapping#Normal_mapping_in_videogames"&gt;normal maps&lt;/a&gt;. &lt;a href="http://zarria.net/nrmphoto/nrmphoto.html"&gt;A genius called Ryan Clarke is altruistic enough to share his technique free and for nothing on his site here &gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Why do I care? Basically as an interactive media blokey, I am interested in this latest method of adding detail and realism to games.&lt;br /&gt;&lt;br /&gt;To begin with 3D games were made using very low res meshes and &lt;a href="http://en.wikipedia.org/wiki/Texture_mapping"&gt;texture mapping&lt;/a&gt;. &lt;a href="http://en.wikipedia.org/wiki/Bump_mapping"&gt;Bump mapping&lt;/a&gt; adds more realism by adding a little height and depth to a surface texture on the polygons - this is done using a grayscale image to represent the height of the bumps, (the lighter the pixel the higher the altitude etc.) but it still looks like blocks with textures. To remove the blockiness of the models you would expect to have to increase the number of polygons they are made up of. This is no good for games where the computer has to render 30+ fps on the fly. This is where &lt;a href="http://en.wikipedia.org/wiki/Normal_mapping#Normal_mapping_in_videogames"&gt;normal maps&lt;/a&gt; help.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Surface_normal"&gt;To really grasp this you need to know what a normal is &gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Normal mapping works on a similar principle to bump mapping in that it is essentially a graphic wrapped round a mesh, but it goes much further. Normal maps use an RGB image which instead of containing just height data in each pixel contains the X Y Z 3D orientation of the normal.&lt;br /&gt;&lt;br /&gt;These then render much more realistically almost as though they were meshes themselves and have the added bonus of rendering faster. This allows PC's and games consoles to increase the apparent level of detail in the models without increasing the polygon count.&lt;br /&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;a href="http://www.inagoni.com/e107_images/newspost_images/rendernormal.jpg"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 200px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://www.inagoni.com/e107_images/newspost_images/rendernormal.jpg" border="0" /&gt;&lt;/a&gt; Normal mapping (above) compared to bump mapping (below) - images courtesy of &lt;a href="http://www.inagoni.com/content.php?content.2"&gt;Inagoni makers of a normal mapping plugin for Carrara&lt;/a&gt;.&lt;br /&gt;&lt;/div&gt;&lt;a href="http://www.inagoni.com/e107_images/newspost_images/renderdist.jpg"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 200px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://www.inagoni.com/e107_images/newspost_images/renderdist.jpg" border="0" /&gt;&lt;/a&gt;Anyway, I just wanted to bring your attention to the fact that you can make your own normal maps quite easily using a torch, a digital camera, and some &lt;a href="http://www.digitalarena.co.uk/image_paint_raster.htm"&gt;image editing software&lt;/a&gt; - &lt;a href="http://zarria.net/nrmphoto/nrmphoto.html"&gt;take a peep &gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-6020304581609557976?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/6020304581609557976/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2008/03/normal-mapping.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6020304581609557976'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/6020304581609557976'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2008/03/normal-mapping.html' title='Normal Mapping'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-4520121211132664786</id><published>2008-02-16T12:49:00.008Z</published><updated>2008-08-23T22:39:01.105+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='swf'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='player'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='Freeware'/><category scheme='http://www.blogger.com/atom/ns#' term='flv'/><category scheme='http://www.blogger.com/atom/ns#' term='convert'/><title type='text'>Flash Projects - #2 - Converting Video to SWF</title><content type='html'>The video player you created in the last tutorial allows the user to select and control the playback of video files in SWF format (not FLV format).&lt;br /&gt;&lt;br /&gt;The reason for this, as I mentioned at the introduction of the &lt;a href="http://dansinteractive.blogspot.com/2008/02/flash-projects-1-movie-player.html"&gt;last tutorial&lt;/a&gt;, was because I wanted to have a video player that worked with the features of Flash MX 2004 standard (which lacks the additional video capability of MX 2004 Professional).&lt;br /&gt;&lt;br /&gt;One of the limitations with the standard version of Flash was that it could only encode video to be embedded in the timeline; this would then be exported in SWF format (not FLV).&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Note: Freeware applications for converting video to FLV however have become more commonplace, so I have already begun work on a player that uses the netconnect and netstream capabilities of Flash to play FLV videos instead. Look out for this tutorial in a few weeks. Meanwhile...&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;So how do you encode video to SWF?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;You can use Flash to encode video to SWF or some available freeware.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;The Flash method&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If you have Flash you can do it very easily by choosing File &gt; Import &gt; Import Video.&lt;br /&gt;&lt;br /&gt;Flash MX 2004 standard will only encode video to be emdedded into the timeline, Professional and later versions give more options - make sure you select the option that embeds video into the timeline.&lt;br /&gt;&lt;br /&gt;Work your way through the wizard and when the video has encoded, make sure the document size (and the video) are the right size for your player (&lt;a href="http://dansinteractive.blogspot.com/2008/02/flash-projects-1-movie-player.html"&gt;see previous tutorial&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;Then export the movie as a SWF and save it with the name you programmed into your player and in the same directory as the player.&lt;br /&gt;&lt;br /&gt;All done. However I tend to find that Flash takes an excessively long time over encoding video, and sometimes prefer to use a freeware programe that seems a bit quicker.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;The freeware method&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://i.d.com.com/i/dl/media/dlimage/13/93/46/139346_small.jpeg"&gt;&lt;/a&gt;One programme that has worked for me without trouble is &lt;a href="http://www.dvdvideosoft.com/products/dvd/Free-Video-to-Flash-Converter.htm"&gt;&lt;em&gt;Free Video to Flash Converter&lt;/em&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It is completely freeware and can convert video into SWF or FLV. You can even export video with its own player interface - and, while this defeats the object for my use of it, since I wanted a custom interface of my own design, some people may find this feature helpful.&lt;br /&gt;&lt;br /&gt;The program is pretty self explanatory, all you need to do is remember to export the movie as a SWF and save it with the name you programmed into your player and in the same directory as the player.&lt;br /&gt;&lt;br /&gt;And thats it. Again any problems just leave a comment and I will try to help.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4698512362740560993-4520121211132664786?l=dansinteractive.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dansinteractive.blogspot.com/feeds/4520121211132664786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dansinteractive.blogspot.com/2008/02/flash-projects-2-converting-video-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4520121211132664786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4698512362740560993/posts/default/4520121211132664786'/><link rel='alternate' type='text/html' href='http://dansinteractive.blogspot.com/2008/02/flash-projects-2-converting-video-to.html' title='Flash Projects - #2 - Converting Video to SWF'/><author><name>Insight</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://www.digitalarena.co.uk/da_avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4698512362740560993.post-5114794331398836846</id><published>2008-02-15T17:56:00.053Z</published><updated>2008-02-18T21:48:04.582Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='custom'/><category scheme='http://www.blogger.com/atom/ns#' term='progress bar'/><category scheme='http://www.blogger.com/atom/ns#' term='as2'/><category scheme='http://www.blogger.com/atom/ns#' term='player'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript'/><category scheme='http://www.blogger.com/atom/ns#' term='movieclip'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Flash Projects - #1 - Movie Player</title><content type='html'>&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I first figured this out because I wanted to have a video player but was running Flash MX 2004 standard and so lacked the Video features of Professional. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;/p&gt;&lt;/span&gt;&lt;strong&gt;Download Files&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://www.mediafire.com/?emamzz4upo3"&gt;Click here to download source code and files for this tutorial &gt;&lt;/a&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This tutorial teaches you to build a video player interface only that loads and plays external video files when requested by the user. This means the finished SWF is very small and downloads quickly.&lt;br /&gt;&lt;br /&gt;The player includes the following features:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:verdana;"&gt;Playback window&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:verdana;"&gt;Play&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:verdana;"&gt;Stop&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:verdana;"&gt;Fwd&lt;/span
