<?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-7239447129918882627</id><updated>2012-01-31T23:20:29.281+01:00</updated><category term='math'/><category term='jQuery'/><category term='Microsoft'/><category term='Codec'/><category term='Internet'/><category term='java'/><category term='FlashBuilder'/><category term='development'/><category term='AIR'/><category term='Screencast'/><category term='tutorial'/><category term='ActionScript'/><category term='Modernizr'/><category term='os x'/><category term='h.264'/><category term='iPhone Development'/><category term='Apple'/><category term='demo'/><category term='Algorithms'/><category term='Web 2.0'/><category term='RIA'/><category term='Voyage'/><category term='Ajax'/><category term='Google'/><category term='Quicktips'/><category term='Catalyst'/><category term='DashCode'/><category term='ui'/><category term='Flash'/><category term='DOM'/><category term='iLife'/><category term='iPhone'/><category term='Graphics'/><category term='opinion'/><category term='CSS3'/><category term='tips'/><category term='concepts'/><category term='design'/><category term='Flex'/><category term='windows'/><category term='iOS'/><category term='iPad'/><category term='JavaScript'/><category term='Video'/><category term='usability'/><category term='touch'/><category term='HTML5'/><category term='humor'/><title type='text'>O.C.A.S</title><subtitle type='html'>JT on computers and stuff</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>60</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-5423985624941896775</id><published>2012-01-08T18:59:00.000+01:00</published><updated>2012-01-08T18:59:20.437+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Modernizr'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><title type='text'>Extending the Modernizr.prefixed method</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-GZb-db90lww/TwnYrgbhYGI/AAAAAAAAAkQ/gmCwBZidF8k/s1600/modernizr.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="97" src="http://3.bp.blogspot.com/-GZb-db90lww/TwnYrgbhYGI/AAAAAAAAAkQ/gmCwBZidF8k/s200/modernizr.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;Starting with version 2.0 the awesome feature detection js library &lt;a href="http://www.modernizr.com/" target="_blank"&gt;Modernizr&lt;/a&gt; includes a method called "&lt;a href="http://www.modernizr.com/docs/#prefixed" target="_blank"&gt;prefixed&lt;/a&gt;". In short, this method will give you the correct prefixed version of a CSS 3 property which still requires this. E.g: -webkit, -moz and so on. Used in conjunction with the jQuery library you can use &lt;a href="http://www.modernizr.com/docs/#prefixed" target="_blank"&gt;Modernizr.prefixed&lt;/a&gt; for typical tasks like adding a transition to an element in script without having to clutter up your CSS with a gazillion lines of vendor prefixes.&lt;br /&gt;&lt;br /&gt;However, the &lt;a href="http://www.modernizr.com/docs/#prefixed" target="_blank"&gt;Modernizr.prefixed&lt;/a&gt; method will always return the JavaScript version of the style property. Modernizr.prefixed('transform') will return "WebkitTransform" in a Webkit browser. If you are using &lt;a href="http://api.jquery.com/css/" target="_blank"&gt;jQuery.css()&lt;/a&gt; this might not be a problem as &lt;a href="http://api.jquery.com/css/" target="_blank"&gt;jQuery.css()&lt;/a&gt; understands this format as well, if it's passed as the property (first parameter). However the prefixes might also be needed as the actual value of an style property. Consider the following:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; $('#myDiv').css(Modernizr.prefixed('transition'),Modernizr.prefixed('transform') + ' 1s linear');  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This snippet will attempt to set a transition on the "myDiv" HTML element using jQuerys´ "css" method and the &lt;a href="http://www.modernizr.com/docs/#prefixed" target="_blank"&gt;Modernizr.prefixed&lt;/a&gt; method, but it will fail to do so. Why? Well, since jQuery is awesome it will allow us to pass "WebkitTransition" or "-webkit-transition" (if in a webkit browser) as the first parameter to the "css" method. For the second parameter &lt;a href="http://api.jquery.com/css/" target="_blank"&gt;jQuery.css()&lt;/a&gt; expects a CSS formatted string «-webkit-transform 1s linear», however the code above will generate «WebkitTransform 1s linear», which is not valid CSS and hence the entire method fails. What is needed is a Modernizr method which spits out a CSS formatted and prefixed string, let's call it "Modernizr.cssprefixed". Sadly this is not a part of Modernizr as of today, but the solution is given in the &lt;a href="http://www.modernizr.com/docs/#prefixed" target="_blank"&gt;Modernizr.prefixed&lt;/a&gt; documentation, we only need a more convenient version of the RegExp given in the docs.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; Modernizr.cssprefixed = function(str)  &lt;br /&gt; {  &lt;br /&gt;      return this.prefixed(str).replace(/([A-Z])/g,function(str,m1){   &lt;br /&gt;         return '-' + m1.toLowerCase();   &lt;br /&gt;      }).replace(/^ms-/,'-ms-');   &lt;br /&gt; }  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now that we have this spanking new method we can update our line of code to:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; $('#myDiv').css(Modernizr.prefixed('transition'),Modernizr.&lt;strong&gt;css&lt;/strong&gt;prefixed('transform') + ' 1s linear');  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Voila, it works!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-5423985624941896775?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/5423985624941896775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=5423985624941896775' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5423985624941896775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5423985624941896775'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2012/01/extending-modernizrprefixed-method.html' title='Extending the Modernizr.prefixed method'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-GZb-db90lww/TwnYrgbhYGI/AAAAAAAAAkQ/gmCwBZidF8k/s72-c/modernizr.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-4561999240956619685</id><published>2011-10-23T20:46:00.000+02:00</published><updated>2011-10-23T20:46:57.441+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='iOS'/><title type='text'>Getting you bearings with JavaScript on iOS</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-QET_3qcN1ks/TqRcJ7a3qBI/AAAAAAAAAhk/2IQZLomtn8w/s1600/compass.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-QET_3qcN1ks/TqRcJ7a3qBI/AAAAAAAAAhk/2IQZLomtn8w/s200/compass.png" width="160" /&gt;&lt;/a&gt;&lt;/div&gt;This post is an extension of my &lt;a href="http://kinderas.blogspot.com/2011/06/accessing-gyroscope-and-accelerometer.html"&gt;previous post&lt;/a&gt; on accessing the gyroscope in your iOS device from JavaScript for a web application. So be sure to read &lt;a href="http://kinderas.blogspot.com/2011/06/accessing-gyroscope-and-accelerometer.html"&gt;that one&lt;/a&gt; first or you'll probably get squat.&lt;br /&gt;&lt;br /&gt;New in iOS 5 is the ability to access the compass using JavaScript. This is done precisely in the same way as with all other «orientation data». The «deviceorientation» event on the window object will (on iPhone 4 or newer running iOS 5 and newer) contain two properties related to the compass, these are:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;«webkitCompassHeading» [0-360°] - Where 0 is magnetic north&lt;/li&gt;&lt;li&gt;«webkitCompassAccuracy» - How many degrees the heading is off (-1 if error)&lt;/li&gt;&lt;/ul&gt;So for the &lt;a href="http://web.kinderas.com/demos/compass/index.html"&gt;demo&lt;/a&gt; I'm using the same arrow as in the gyroscope post, except now with gorgeous «north» and «south» indicators added. The goal of the &lt;a href="http://web.kinderas.com/demos/compass/index.html"&gt;demo&lt;/a&gt; is to make the arrow point towards north. When you're done playing with it, take a look at the &lt;a href="http://web.kinderas.com/demos/compass/main.js"&gt;source&lt;/a&gt; and amaze at its simplicity.&lt;br /&gt;&lt;br /&gt;Further reading:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://web.kinderas.com/demos/compass/index.html"&gt;The amazing demo&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://developer.apple.com/library/safari/#documentation/SafariDOMAdditions/Reference/DeviceOrientationEventClassRef/DeviceOrientationEvent/DeviceOrientationEvent.html"&gt;DeviceOrientationEvent Class Reference&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-4561999240956619685?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/4561999240956619685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=4561999240956619685' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4561999240956619685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4561999240956619685'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/10/getting-you-bearings-with-javascript-on.html' title='Getting you bearings with JavaScript on iOS'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-QET_3qcN1ks/TqRcJ7a3qBI/AAAAAAAAAhk/2IQZLomtn8w/s72-c/compass.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-8942704764462954803</id><published>2011-10-09T18:04:00.000+02:00</published><updated>2011-10-09T18:18:02.492+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>The HTML 5 History API</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-T2FfPSUQYxk/TpG2B2lPfjI/AAAAAAAAAg4/8Lu-WOfpBHQ/s1600/34337.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-T2FfPSUQYxk/TpG2B2lPfjI/AAAAAAAAAg4/8Lu-WOfpBHQ/s1600/34337.png" /&gt;&lt;/a&gt;&lt;/div&gt;The &lt;a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#the-history-interface"&gt;HTML 5 History API&lt;/a&gt;&amp;nbsp;will allow us to update the browser history and&amp;nbsp;keep the all so important functionality of the back and forward browser buttons when the site is&amp;nbsp;loading content dynamically using &lt;a href="http://www.w3.org/TR/XMLHttpRequest/"&gt;XMLHttpRequest&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;You want to use XMLHttpRequests (AJAX) to avoid&amp;nbsp;unnecessary&amp;nbsp;page loads, hence reducing network traffic and therefore speeding up you web-app, you probably already do this in your web-apps. However, before the advent of the HTML 5 History API there was a problem with this otherwise smart approach to building web-apps. When a page updated it's content this would not be reflected in the browser history and you had to do a lot of work to make the back and forward buttons work as&amp;nbsp;expected. Thanks to the HTML 5 History API this is now much simpler. In this article I'll explain an approach to "mimicking" a common server-side approach to "dynamic" page loading using parameters in the url, while retaining the functionality of the browser history. &lt;a href="http://web.kinderas.com/demos/history/index.html"&gt;Take a look at the demo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;What this typical AJAX demo does is pretty basic:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;At startup it loads a page depending upon the&amp;nbsp;presence&amp;nbsp;of a parameter.&lt;/li&gt;&lt;li&gt;When you click a link (at the top), it fetches and swaps the content of the "content" holder of the main page.&lt;/li&gt;&lt;/ul&gt;&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-JrXEr1jRuqo/TpG7mzszIXI/AAAAAAAAAg8/7vJwFc9w2_A/s1600/history.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="123" src="http://4.bp.blogspot.com/-JrXEr1jRuqo/TpG7mzszIXI/AAAAAAAAAg8/7vJwFc9w2_A/s320/history.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Pushed history items&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div&gt;However, after having clicked the links you'll also notice that the back and forward buttons are working, without&amp;nbsp;actually&amp;nbsp;navigating you away from the main page, like the're integrated with the app. Also, items are "pushed" onto the browser history, making it possible to navigate directly to a previously loaded page. It's just updating the content of the content box when you click a link, not the entire page. This is what happens:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;When a link is clicked the new content is fetched using a XMLHttpRequest.&lt;/li&gt;&lt;li&gt;The current content is replaced and the browser history is updated.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;All of these operations are accomplished using only three (3) API calls:&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;The «&lt;a href="https://developer.mozilla.org/en/DOM/window.onpopstate"&gt;onpopstate&lt;/a&gt;» event allows us to listen to events fired when the history is being navigated, like when using the back button. (see line 57'ish in the &lt;a href="http://web.kinderas.com/demos/history/main.js"&gt;demo code&lt;/a&gt; for how this is handled).&lt;/li&gt;&lt;li&gt;The «&lt;a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#dom-history-replacestate"&gt;replaceState&lt;/a&gt;» method allows us to replace the current state in the browser history. This is used to create a state when for example on initial page load.&lt;/li&gt;&lt;li&gt;The «&lt;a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#dom-history-pushstate"&gt;pushState&lt;/a&gt;» method allows us to add things to the history stack (it's a stack, hence push and pop).&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-HlupYtn15RM/TpHDt2tBQOI/AAAAAAAAAhA/dZ449GxMz6Q/s1600/browsers.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="140" src="http://1.bp.blogspot.com/-HlupYtn15RM/TpHDt2tBQOI/AAAAAAAAAhA/dZ449GxMz6Q/s200/browsers.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Now, this does not work in all browsers (IE..duh!) and as of writing this post still has «&lt;a href="http://whatis.techtarget.com/definition/0,,sid9_gci491373,00.html"&gt;Working Draft&lt;/a&gt;» status. However, &lt;a href="http://caniuse.com/#search=history"&gt;support&lt;/a&gt; is pretty good and when Microsoft finally adds support in IE 10, all major browsers will support the History API.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Take a look at the &lt;a href="http://web.kinderas.com/demos/history/index.html"&gt;demo&lt;/a&gt; and the &lt;a href="http://web.kinderas.com/demos/history/main.js"&gt;source code&lt;/a&gt; (which is heavily commented) and feel free to use the source freely.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Bye!&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/7239447129918882627-8942704764462954803?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/8942704764462954803/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=8942704764462954803' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8942704764462954803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8942704764462954803'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/10/html-5-history-api.html' title='The HTML 5 History API'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-T2FfPSUQYxk/TpG2B2lPfjI/AAAAAAAAAg4/8Lu-WOfpBHQ/s72-c/34337.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-365340309959682541</id><published>2011-07-03T18:29:00.000+02:00</published><updated>2011-07-03T18:29:32.118+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='usability'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><title type='text'>Creating a simple WYSIWYG editor with HTML and JavaScript</title><content type='html'>Wouldn't it be nice to provide the users of your website with a WYSIWYG rich text editor instead of boring forms and a bunch of textfields? Enter «contenteditable». This is a simple property which can be set on any DOM element, like divs, sections and so on. What it does it making the element writable for the user, directly inline with all your&amp;nbsp;predefines&amp;nbsp;styles and content.&lt;br /&gt;&lt;code&gt;contenteditable="true"&lt;/code&gt;&lt;br /&gt;To get set up, set the «contenteditable» property of your selected element to "true". In my &lt;a href="http://web.kinderas.com/demos/contenteditable/index.html"&gt;demo&lt;/a&gt; I'm using a «section» element, but as noted above, you can use any DOM element. And that is it&amp;nbsp;actually. You now have a working rich text editor running on you web-page. You can use the keyboard shortcuts like «cmd+b» to make selected text bold and so on. But wait, there's more.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color: green;"&gt;document&lt;/span&gt;.execCommand(&lt;span style="color: #ba2121;"&gt;'bold'&lt;/span&gt;&lt;span style="color: #666666;"&gt;,&lt;/span&gt;&lt;span style="color: green; font-weight: bold;"&gt;false&lt;/span&gt;&lt;span style="color: #666666;"&gt;,&lt;/span&gt;&lt;span style="color: green; font-weight: bold;"&gt;null&lt;/span&gt;);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;This simple JavaScript command will allow you to&amp;nbsp;programmatically&amp;nbsp;make text bold and thats not all, there are a dozen of built in commands which can be executed on the selected text, for an&amp;nbsp;overview&amp;nbsp;take a look at the &lt;a href="http://blog.whatwg.org/the-road-to-html-5-contenteditable"&gt;WHATWG&amp;nbsp;specification&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;When combining «contenteditable» with the HTML 5 storage APIs you can pretty easily make a powerful rich text editor for your users. Take a look at my simple &lt;a href="http://web.kinderas.com/demos/contenteditable/index.html"&gt;demo&lt;/a&gt; to see how you can accomplish this. As a side note, iOS 5 brings support for «contenteditable» on mobile platforms as well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-365340309959682541?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/365340309959682541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=365340309959682541' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/365340309959682541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/365340309959682541'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/07/creating-simple-wysiwyg-editor-with.html' title='Creating a simple WYSIWYG editor with HTML and JavaScript'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-7074234987447871877</id><published>2011-06-26T17:06:00.001+02:00</published><updated>2011-06-26T17:52:23.628+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='DOM'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='Apple'/><title type='text'>Accessing the gyroscope and accelerometer using JavaScript</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-gQuZCxssSrA/TgdC7wCxsgI/AAAAAAAAATo/fNbasa9xiHA/s1600/Gyroscope2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="169" src="http://3.bp.blogspot.com/-gQuZCxssSrA/TgdC7wCxsgI/AAAAAAAAATo/fNbasa9xiHA/s200/Gyroscope2.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;With the advent of "mobile" devices such as the iPad, iPhone and all the gazillion Android devices, an&amp;nbsp;increasing&amp;nbsp;demand for browser-applications to sport the features and functionality native applications arises. In this article I'll have a quick look at one of these features, namely «device orientation». First of all, take a look at the &lt;a href="http://web.kinderas.com/demos/orientation/index.html"&gt;demo&lt;/a&gt;. In this demo I'm using the "deviceorientation" event listener of the «window» object to listen for orientation events. Orientation events are in short events triggered when your device is twisting and turning, sort of. In my iPhone, these events originate in the&amp;nbsp;accelerometer&amp;nbsp;and the&amp;nbsp;gyroscope. For your phone this might be different, but it doesn't matter as the API's for accessing the data are pretty much the same and part of the «&lt;a href="http://dev.w3.org/geo/api/spec-source-orientation"&gt;DeviceOrientation Event Specification&lt;/a&gt;». Note that this demo is only tested on the iPhone 4, so if you have something else it might not work. Let's get to it then.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color: green;"&gt;window&lt;/span&gt;.addEventListener(&lt;span style="color: #ba2121;"&gt;'deviceorientation'&lt;/span&gt;&lt;span style="color: #666666;"&gt;,&lt;/span&gt; orientationHandler&lt;span style="color: #666666;"&gt;,&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;false&lt;/span&gt;);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;First of all we need to add an event listener for the «device orientation» event. This event is fired by the «window» object as mentioned above. We then simply set up our event handler.&lt;br /&gt;&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color: green; font-weight: bold;"&gt;function&lt;/span&gt; orientationHandler(e)&lt;br /&gt;{&lt;br /&gt; image.style.webkitTransform &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;"perspective(500) &lt;br /&gt;rotateZ("&lt;/span&gt;&lt;span style="color: #666666;"&gt;+&lt;/span&gt;e.alpha&lt;span style="color: #666666;"&gt;+&lt;/span&gt;&lt;span style="color: #ba2121;"&gt;"deg) &lt;br /&gt;rotateX("&lt;/span&gt;&lt;span style="color: #666666;"&gt;+&lt;/span&gt;e.beta&lt;span style="color: #666666;"&gt;+&lt;/span&gt;&lt;span style="color: #ba2121;"&gt;"deg) &lt;br /&gt;rotateY("&lt;/span&gt;&lt;span style="color: #666666;"&gt;+&lt;/span&gt;e.gamma&lt;span style="color: #666666;"&gt;+&lt;/span&gt;&lt;span style="color: #ba2121;"&gt;"deg)"&lt;/span&gt;&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;There are three properties of the «orientation event» we want to get at.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;«alpha» - This is rotation about the Z axis. In other words left and right rotation.&lt;/li&gt;&lt;li&gt;«beta» - This is rotation about the X axis. This means how much you are tilting the device towards you.&lt;/li&gt;&lt;li&gt;«gamma» - This is the rotation about the Y axis, or the angle of the device screen if you may.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;There are also two other properties present in iOS 5 which gives you access to the compass and it's accuracy, but those are not used in this example.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The «perspective(500)» transform simply defines how "far away" from the object you are when it's rotated, or the depth if you like. Since the properties of the «device orientation» event correlates to the values handled by the CSS transform properties, no calculation is needed. &lt;a href="http://web.kinderas.com/demos/orientation/index.html"&gt;Try it out&lt;/a&gt;! (Should work on iPhone 4 and iPad 2)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;References:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.w3.org/geo/api/spec-source-orientation"&gt;W3C -&amp;nbsp;DeviceOrientation Event Specification&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-7074234987447871877?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/7074234987447871877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=7074234987447871877' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7074234987447871877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7074234987447871877'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/06/accessing-gyroscope-and-accelerometer.html' title='Accessing the gyroscope and accelerometer using JavaScript'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-gQuZCxssSrA/TgdC7wCxsgI/AAAAAAAAATo/fNbasa9xiHA/s72-c/Gyroscope2.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-3068526969891246778</id><published>2011-06-05T19:08:00.003+02:00</published><updated>2011-06-11T13:51:46.911+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='Algorithms'/><title type='text'>HTML 5 Web Workers and image processing</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-P7T9ORNtdkk/TeunNN9-KAI/AAAAAAAAATU/N0idEOPGV0c/s1600/Lego-construction-workers.jpeg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="210" src="http://3.bp.blogspot.com/-P7T9ORNtdkk/TeunNN9-KAI/AAAAAAAAATU/N0idEOPGV0c/s320/Lego-construction-workers.jpeg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;One of the more exiting things we are getting via the new &lt;a href="http://www.whatwg.org/specs/web-apps/current-work/"&gt;HTML&lt;/a&gt;&amp;nbsp;specification&amp;nbsp;is &lt;a href="http://www.whatwg.org/specs/web-workers/current-work/"&gt;Web Workers&lt;/a&gt;. If you have no idea what Web Workers (lets call them Worker from now on) are you can basically think of them as "sandboxed" &lt;a href="http://en.wikipedia.org/wiki/Thread_(computer_science)"&gt;threads&lt;/a&gt;. By threads I do refer to threads as in «&lt;a href="http://en.wikipedia.org/wiki/Multithreading_(computer_architecture)"&gt;multithreading&lt;/a&gt;», an architectural feature of modern CPUs and operating systems. Workers allow us to run tasks&amp;nbsp;separately&amp;nbsp;from the main thread where all the drawing, animation and DOM manipulation is going on. This allows us to do calculations without leaving the impression on the user that the browser is "hanging". If you have worked with other "thread wrapping"&amp;nbsp;technologies&amp;nbsp;like &lt;a href="http://en.wikipedia.org/wiki/Grand_Central_Dispatch"&gt;Grand Central Dispatch (GCD)&lt;/a&gt; you will get Workers without fuzz, however Workers do have some limitations that other similar&amp;nbsp;technologies&amp;nbsp;don't have.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Workers limitations and usage&lt;/b&gt;&lt;br /&gt;First of all, Workers are separate code blocks of JavaScript not found in the spawning script, kinda.. In most cases a Worker is a separate JavaScript file which you DO NOT refer to in you HTML script tags in the HTML document. However, Workers can also be defined inline through the &lt;a href="http://code.google.com/apis/gears/api_blobbuilder.html"&gt;BlobBuilder&lt;/a&gt; interface. In this post I will use only external Workers. Also, there are two kinds of Workers, «&lt;a href="http://www.whatwg.org/specs/web-workers/current-work/#sharedworker"&gt;Shared&lt;/a&gt;» and «&lt;a href="http://www.whatwg.org/specs/web-workers/current-work/#dedicated-workers-and-the-worker-interface"&gt;Dedicated&lt;/a&gt;». I will only use «Dedicated Workers» in this post.&lt;br /&gt;&lt;br /&gt;Workers cannot access the following:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The DOM or the DOM APIs&lt;/li&gt;&lt;li&gt;The window object&lt;/li&gt;&lt;li&gt;The document and the parent object.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;A worker can access:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The «navigator» object&lt;/li&gt;&lt;li&gt;«XMLHttpRequest»&lt;/li&gt;&lt;li&gt;A read-only version of the «location» object&lt;/li&gt;&lt;li&gt;The Application cache&lt;/li&gt;&lt;li&gt;setTimeout(), clearTimeout() and setInterval(), clearInterval()&lt;/li&gt;&lt;/ul&gt;A Worker can also spawn other Workers and import external scripts via «importScripts()».&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The demo (aka. the fun part)&lt;/b&gt;&lt;br /&gt;For the &lt;a href="http://web.kinderas.com/demos/web_workers_images/"&gt;demo&lt;/a&gt; this time I have created a simple web-app which loads and displays 3 pictures n times. You can randomize the position of the images by clicking the randomize button. You can pick the number of images displayed as well as their size. The two image manipulation buttons will grayscale and invert the images, if you check the checkbox the images will perform the randomize animation&amp;nbsp;concurrently with the image processing. It's this latter part which calls for the usage of Workers.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://web.kinderas.com/demos/web_workers_images/"&gt;demo&lt;/a&gt; will show you how to spawn a separate Worker for each of the images, thereby allowing for concurrent processing and animation without much&amp;nbsp;degradation&amp;nbsp;in performance. I won't&amp;nbsp;explicitly&amp;nbsp;go through all the layout and animation code here, rather&amp;nbsp;focusing&amp;nbsp;on the usage of the Workers.&lt;br /&gt;&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color: green; font-weight: bold;"&gt;var&lt;/span&gt; worker &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;new&lt;/span&gt; Worker(&lt;span style="color: #ba2121;"&gt;'DWGrayscale.js'&lt;/span&gt;);&lt;br /&gt;worker.addEventListener(&lt;span style="color: #ba2121;"&gt;'message'&lt;/span&gt;&lt;span style="color: #666666;"&gt;,&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;function&lt;/span&gt;(e){&lt;br /&gt;   ctxAr[e.data.index].context.putImageData(e.data.imagedata&lt;span style="color: #666666;"&gt;,0,0&lt;/span&gt;);&lt;br /&gt;});&lt;br /&gt;worker.postMessage(...imagedata...);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;On line &lt;a href="http://web.kinderas.com/demos/web_workers_images/"&gt;126 - 133 within the grayscale function&lt;/a&gt; we create a Worker for each of the images, then we add a listener for the «onmessage» event allowing the Worker to&amp;nbsp;communicate&amp;nbsp;with the main thread. We finish off by posting a message to the worker using «postMessage» and passing the image data. These messages are the only way to communicate with a Worker. This means that we also need to implement this interface in the Worker itself.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;addEventListener(&lt;span style="color: #ba2121;"&gt;'message'&lt;/span&gt;&lt;span style="color: #666666;"&gt;,&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;function&lt;/span&gt;(e){&lt;br /&gt; &lt;span style="color: green; font-weight: bold;"&gt;var&lt;/span&gt; imageData &lt;span style="color: #666666;"&gt;=&lt;/span&gt; e.data.imagedata&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: #408080; font-style: italic;"&gt;//....process image data....&lt;/span&gt;&lt;br /&gt; postMessage(...imagedata...);&lt;br /&gt;});&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;In the Worker «&lt;a href="http://web.kinderas.com/demos/web_workers_images/DWGrayscale.js"&gt;DWGrayscale.js&lt;/a&gt;» we grab the passed image data from the «data» property of the event. We then go on processing the image data, when done we post a message back to the main thread passing the image data which then in turn can be used to update the canvas element on screen.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Why not pass the Canvas element or at least the Canvas context?&lt;/b&gt;&lt;br /&gt;Workers do not have access to the DOM, because it would not be thread safe. Workers are limited to passing object which can be serialized into JSON, which does not support cyclic objects. The Canvas element is a DOM element and the context is a cyclic object, hence we need to get the actual pixel array which we can pass back and forth to the Worker.&lt;br /&gt;&lt;br /&gt;Take a look at the &lt;a href="http://web.kinderas.com/demos/web_workers_images/"&gt;demo&lt;/a&gt; and the &lt;a href="http://web.kinderas.com/demos/web_workers_images/main.js"&gt;source code&lt;/a&gt; to learn in more detail how the demo was created.&lt;br /&gt;&lt;i&gt;Note also that you should probably run the demo in Safari as it has no limitation on the number of Workers concurrently running like Chrome has, also the animations uses the WebKit prefix and will not work in non WebKit browsers. So, please don't use this code in an production environment!&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.html5rocks.com/tutorials/workers/basics/"&gt;The basics of Web Workers - HTML 5 Rocks&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.whatwg.org/specs/web-workers/current-work/"&gt;WHATWG - Web Workers&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-3068526969891246778?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/3068526969891246778/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=3068526969891246778' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3068526969891246778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3068526969891246778'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/06/html-5-web-workers-and-image-processing.html' title='HTML 5 Web Workers and image processing'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-P7T9ORNtdkk/TeunNN9-KAI/AAAAAAAAATU/N0idEOPGV0c/s72-c/Lego-construction-workers.jpeg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-3826079600380584158</id><published>2011-05-01T20:14:00.000+02:00</published><updated>2011-05-01T20:14:11.783+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS3'/><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><title type='text'>Quicktip: Skewing an image with JavaScript and CSS3</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-87Rp4qQsjKA/Tb2gr_BBERI/AAAAAAAAATI/DlMqcpN0lxM/s1600/skew_rabbit.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="153" src="http://1.bp.blogspot.com/-87Rp4qQsjKA/Tb2gr_BBERI/AAAAAAAAATI/DlMqcpN0lxM/s200/skew_rabbit.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;Have you ever found yourself in a situation where you needed to skew a rabbit? If you haven't, you'll probably enter this place soon, so here I am to prepare you. The task is to skew an image on a HTML page using CSS and JavaScript. This could be attached to for instance a button click event. This is a one liner..&lt;br /&gt;&lt;code&gt;document.getElementById('myImage').style.transform = "skew(-15deg)"&lt;/code&gt;&lt;br /&gt;The «skew» property of the «transform» CSS method takes degrees of skew as an input. Negative numbers will skew the image top right, bottom left and positive numbers..the other way around.&lt;br /&gt;Note that in order for this to&amp;nbsp;actually&amp;nbsp;work, you will need to use vendor prefixes as the time of writing this post. For Safari (desktop and iOS) and Chrome (and Android) you would use «webkitTransform» for FireFox «mozTransform» and so on.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-3826079600380584158?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/3826079600380584158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=3826079600380584158' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3826079600380584158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3826079600380584158'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/05/quicktip-skewing-image-with-javascript.html' title='Quicktip: Skewing an image with JavaScript and CSS3'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-87Rp4qQsjKA/Tb2gr_BBERI/AAAAAAAAATI/DlMqcpN0lxM/s72-c/skew_rabbit.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-5821108830510551198</id><published>2011-04-11T20:21:00.000+02:00</published><updated>2011-04-11T20:21:39.479+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='opinion'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS3'/><category scheme='http://www.blogger.com/atom/ns#' term='os x'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='Apple'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft'/><title type='text'>The Peacekeeper</title><content type='html'>&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-AdsJFdHbMSE/TaM8q1yp1TI/AAAAAAAAASw/zz__bMTCUHo/s1600/results.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="302" src="http://1.bp.blogspot.com/-AdsJFdHbMSE/TaM8q1yp1TI/AAAAAAAAASw/zz__bMTCUHo/s640/results.png" width="640" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Peacekeeper on an iMac 3.0 Ghz&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;I decided to try out &lt;a href="http://www.futuremark.com/"&gt;Futuremaks&lt;/a&gt; spanking "new" &lt;a href="http://clients.futuremark.com/peacekeeper"&gt;Peacekeeper&lt;/a&gt; browser tester today. In contrast to other more "nerdy" tests like &lt;a href="http://acid3.acidtests.org/"&gt;Acid3&lt;/a&gt; and &lt;a href="http://www.webkit.org/perf/sunspider/sunspider.html"&gt;SunSpider&lt;/a&gt;&amp;nbsp;which are useful for people like me, Peacekeepers tests are more targeted at actual normal usage of a browser, making it slightly more&amp;nbsp;interesting&amp;nbsp;for users without a degree in computer science.&lt;br /&gt;&lt;br /&gt;On the other hand, if you want to understand the six test, well.. it gets a bit technical. The first test «rendering» is a test of how fast the browser can draw stuff to the screen, while doing other calculations and operations at the same time. The second test which Futuremark calls «social networking» is actually a test in how fast the browser can create a SHA1 hash, parse some XML and filtering and sorting the elements of an array. Thirdly we arrive at the «complex graphics» test, which is a test on canvas drawing operations, canvas being part of the new HTML 5 standard. The «data» test which I have renamed to "arrays" does work on&amp;nbsp;exactly&amp;nbsp;that, array manipulation. The «DOM manipulation» test, is one of the most important tests as this tests the browsers ability to look up elements in the DOM fast. This should be of particular interest to jQuery fans. The last test «text parsing», is what its name suggests, parsing and searching in strings. To get a full detailed&amp;nbsp;explanation&amp;nbsp;of what the individual test entails, see &lt;a href="http://clients.futuremark.com/peacekeeper/faq.action"&gt;Futuremarks FAQ site&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;My testcomputer was an iMac 3.06 GHz, with 8GB of RAM and an&amp;nbsp;ATI Radeon HD 4670 graphics card running OS X 10.6.7. It matters, because these tests will very, much, depending on your computer and OS.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-QJihHDumlOM/TaNEdnJbSTI/AAAAAAAAAS0/UDCNouEGQ8A/s1600/google-chrome-logo1.jpeg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-QJihHDumlOM/TaNEdnJbSTI/AAAAAAAAAS0/UDCNouEGQ8A/s1600/google-chrome-logo1.jpeg" /&gt;&lt;/a&gt;&lt;/div&gt;As for the results one can clearly see that the WebKit browsers beat the snot out of Firefox. Chrome is clearly the fastest browser overall, however for DOM manipulation Safari is slightly faster than Chrome. Again, beware of this one jQuery fans because this is where all those selectors come into play. Chrome is ruling the array manipulation speed, this might be due to the &lt;a href="http://code.google.com/p/v8/"&gt;V8 JavaScript engine&lt;/a&gt;. All the browsers&amp;nbsp;basically&amp;nbsp;suck when it comes to rendering HTML 5 Canvas graphics.&lt;i&gt;&amp;nbsp;As a side-note, I observed a test that was run on a Windows based computer as well. To our surprise, both Chrome and Opera beat Internet Explorer 9 into the slippers when it came to canvas performance. &lt;a href="http://www.beautyoftheweb.com/"&gt;Beauty of the web&lt;/a&gt;&amp;nbsp;my &lt;a href="http://www.animalinfo.org/image/equuafri6%2033%20j.jpg"&gt;ass&lt;/a&gt;, in your own tests internally made tests perhaps.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;So, judging from this Google Chrome is the browser your should go for. And in my opinion, it is. For me, I'm sticking with Safari for my day to day use, but I'm using Chrome when&amp;nbsp;writing&amp;nbsp;this blog post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-5821108830510551198?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/5821108830510551198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=5821108830510551198' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5821108830510551198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5821108830510551198'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/04/peacekeeper.html' title='The Peacekeeper'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-AdsJFdHbMSE/TaM8q1yp1TI/AAAAAAAAASw/zz__bMTCUHo/s72-c/results.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-4142604623732870684</id><published>2011-04-03T19:40:00.006+02:00</published><updated>2011-04-03T19:54:00.161+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS3'/><category scheme='http://www.blogger.com/atom/ns#' term='touch'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><title type='text'>Scaling and rotating an elephant using JavaScript</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-EsmalIv59Q8/TZihCfKnmSI/AAAAAAAAASo/iJEqBXGAyrA/s1600/Screen+shot+2011-04-03+at+18.31.46.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="246" src="http://2.bp.blogspot.com/-EsmalIv59Q8/TZihCfKnmSI/AAAAAAAAASo/iJEqBXGAyrA/s320/Screen+shot+2011-04-03+at+18.31.46.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;This second post about «touch» is somewhat an extension to my previous post «&lt;a href="http://kinderas.blogspot.com/2011/03/drawing-by-touching-using-javascript.html"&gt;Drawing by touching using JavaScript&lt;/a&gt;». However in this post the focus will be on «gesture events». A &lt;a href="http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html"&gt;gesture event&lt;/a&gt; is an event which will fire when more than one finger is present on the screen. Due to the somewhat complex nature of the&amp;nbsp;accompanying&amp;nbsp;&lt;a href="http://web.kinderas.com/demos/touch_gestures/"&gt;demo&lt;/a&gt;, I will not walk through it line by line, but rather focus on some key ares which are important when dealing with touches and gestures.&lt;br /&gt;Step 1 is to take a look at the &lt;a href="http://web.kinderas.com/demos/touch_gestures/"&gt;demo&lt;/a&gt; and read through my comments. To understand this you will need a basic understanding of object oriented JavaScript and I will not walk through that part of the demo in this post. What I will explain in some detail is how the gesture events work (to see how touch events work, refer to my previous post) and some nifty tricks you can do with event handlers and transforms. Oh..and you will be needing a touch device to test this thing. Let's get cracking then.&lt;br /&gt;&lt;br /&gt;The basic functionality of this &lt;a href="http://web.kinderas.com/demos/touch_gestures/"&gt;demo&lt;/a&gt; is to place images on the page which have some &lt;a href="http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html"&gt;touch&lt;/a&gt; and &lt;a href="http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html"&gt;gesture&lt;/a&gt; events applied to them. This will allow us to move, scale and rotate the images using gestures. An array «elephants» is used to keep track of all the images on the page. On &lt;u&gt;&lt;a href="http://web.kinderas.com/demos/touch_gestures/main.js"&gt;line 70&lt;/a&gt;&lt;/u&gt;&amp;nbsp;(in the &lt;a href="http://web.kinderas.com/demos/touch_gestures/main.js"&gt;demo JavaScript file&lt;/a&gt;) an Object called «TouchImage» is defined. This object will keep track of all events and transforms associated with one image. We create a new «TouchImage» on &lt;u&gt;&lt;a href="http://web.kinderas.com/demos/touch_gestures/main.js"&gt;line 52&lt;/a&gt;&lt;/u&gt;. This happens for every time you hit the «Create elephant» button. Then on &lt;u&gt;line &lt;a href="http://web.kinderas.com/demos/touch_gestures/main.js"&gt;99 - 104&lt;/a&gt;&lt;/u&gt;:&lt;br /&gt;&lt;code&gt;tImage.image.addEventListener('gesturestart', tImage, false);&lt;br /&gt;tImage.image.addEventListener('gesturechange', tImage, false);&lt;br /&gt;tImage.image.addEventListener('gestureend', tImage, false);&lt;br /&gt;tImage.image.addEventListener('touchcancel', tImage, false);&lt;br /&gt;tImage.image.addEventListener('touchstart', tImage, false);&lt;br /&gt;tImage.image.addEventListener('touchend', tImage, false);&lt;/code&gt;&lt;br /&gt;Now, this might look a bit strange, we're passing «this» («tImage» is a closure for «this») as the event handler for the listeners. This is because at &lt;u&gt;&lt;a href="http://web.kinderas.com/demos/touch_gestures/main.js"&gt;line 117&lt;/a&gt;&lt;/u&gt; we define a method called «&lt;a href="http://www.java2s.com/Tutorial/JavaScript/0200__Form/SelecthandleEvent.htm"&gt;handleEvent&lt;/a&gt;» on the «TouchImage». This is a magical&amp;nbsp;method&amp;nbsp;in JavaScript which will basically handle any event passed to it's object. Within this&amp;nbsp;method&amp;nbsp;we check to see if the caller is a function and if it is, we simply call it.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;TouchImage.prototype.handleEvent &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;function&lt;/span&gt;(event)&lt;br /&gt;{&lt;br /&gt; &lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt;(&lt;span style="color: green; font-weight: bold;"&gt;typeof&lt;/span&gt;(&lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;[event.type]) &lt;span style="color: #666666;"&gt;===&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;"function"&lt;/span&gt;){&lt;br /&gt;  &lt;span style="color: green; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;[event.type](event);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;This way we can extend the «TouchImage» object with methods called «gesturesstart» and so on, the same names as the events. An additional plus is that we stay within scope of the object, avoiding to pass closures around like rag dolls. Now to the gesture handlers. In contrast to «touch» handlers, there are only three «gesture» handlers: «&lt;a href="http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html"&gt;getsurestart&lt;/a&gt;», «&lt;a href="http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html"&gt;gesturechange&lt;/a&gt;» and «&lt;a href="http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html"&gt;gestureend&lt;/a&gt;». Each of these will trigger only if there are more than one finger on the screen.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;TouchImage.prototype.gesturestart &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;function&lt;/span&gt;(event)&lt;br /&gt;{&lt;br /&gt; event.preventDefault();&lt;br /&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.startRotation &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.rotation&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.startScale    &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.scale&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;In «gesturestart» which triggers when a second finger is placed on screen, we capture the current scale and rotation values of the «TouchImage» in question.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;TouchImage.prototype.gesturechange &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;function&lt;/span&gt;(event)&lt;br /&gt;{&lt;br /&gt; event.preventDefault();&lt;br /&gt; &lt;br /&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.scale    &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.startScale &lt;span style="color: #666666;"&gt;*&lt;/span&gt; event.scale&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.rotation &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.startRotation &lt;span style="color: #666666;"&gt;+&lt;/span&gt; event.rotation&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.applyTransforms(); &lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;In «gesturechange» we calculate the scale and rotation by using the start values and the changed values. The &lt;a href="http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchEventClassReference/TouchEvent/TouchEvent.html#//apple_ref/javascript/cl/TouchEvent"&gt;scale&lt;/a&gt; is multiplied with the new scale and the &lt;a href="http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchEventClassReference/TouchEvent/TouchEvent.html#//apple_ref/javascript/cl/TouchEvent"&gt;rotation&lt;/a&gt; is calculated by adding the start rotation to the current rotation. This works because both values in the change handler will give us the amount changed since the start event. Then we call the «applyTransforms()» method where the actual transform is done.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;TouchImage.prototype.applyTransforms &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;function&lt;/span&gt;()&lt;br /&gt;{&lt;br /&gt; &lt;span style="color: green; font-weight: bold;"&gt;var&lt;/span&gt; transform &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'translate3d('&lt;/span&gt; &lt;span style="color: #666666;"&gt;+&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.posX &lt;span style="color: #666666;"&gt;+&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'px,'&lt;/span&gt; &lt;span style="color: #666666;"&gt;+&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.posY &lt;span style="color: #666666;"&gt;+&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'px, '&lt;/span&gt;&lt;span style="color: #666666;"&gt;+&lt;/span&gt;&lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.posZ&lt;span style="color: #666666;"&gt;+&lt;/span&gt;&lt;span style="color: #ba2121;"&gt;'px)'&lt;/span&gt;&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt; transform &lt;span style="color: #666666;"&gt;+=&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;' rotate('&lt;/span&gt; &lt;span style="color: #666666;"&gt;+&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.rotation &lt;span style="color: #666666;"&gt;+&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'deg)'&lt;/span&gt;&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt; transform &lt;span style="color: #666666;"&gt;+=&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;' scale('&lt;/span&gt; &lt;span style="color: #666666;"&gt;+&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.scale &lt;span style="color: #666666;"&gt;+&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;')'&lt;/span&gt;&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: green; font-weight: bold;"&gt;this&lt;/span&gt;.image.style.webkitTransform &lt;span style="color: #666666;"&gt;=&lt;/span&gt; transform&lt;span style="color: #666666;"&gt;;&lt;/span&gt;  &lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;The &lt;a href="http://developer.apple.com/library/safari/#documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Transforms/Transforms.html#//apple_ref/doc/uid/TP40008032-CH5-SW1"&gt;transform&lt;/a&gt; is done on all properties at the same time. You cannot separate them from each other, because we are in effect overwriting the entire transform style element each time something is changing. Do also note that we are in fact using «&lt;a href="http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariCSSRef/Articles/Functions.html#//apple_ref/doc/uid/TP40007955-SW2"&gt;transform3d&lt;/a&gt;», which is quite different from the regular «transform». The reason for this is twofold. First, the «transform3d» will render the image on it's own 3D layer, at times triggering hardware rendering. This will&amp;nbsp;yield&amp;nbsp;a significant performance increase. Secondly, the «transform3d» allow us to stack elements in the «z-axis», hence we can move the active element to the front. We do this sorting by &amp;nbsp;calling the «sortDepth» method, which only sorts the «elephants» array.&lt;br /&gt;&lt;br /&gt;That's the gesture events. Now, there are regular &lt;a href="http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html"&gt;touch events&lt;/a&gt; in this application as well. These are used to move the «TouchImage» objects around the screen. I won't cover how this is done in detail here because it's much the same as in the &lt;a href="http://kinderas.blogspot.com/2011/03/drawing-by-touching-using-javascript.html"&gt;previous post.&lt;/a&gt; However one thing to notice is that an offset is calculated in the «touchstart» handler. This is done so that when moving the image it tracks from the point where the user places her finger on the image. If we didn't do this the image would snap to 0,0 under the users finger when moved, making for an unexpected user experience. That's it and that's that!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-4142604623732870684?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/4142604623732870684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=4142604623732870684' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4142604623732870684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4142604623732870684'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/04/scaling-and-rotating-elephant-using.html' title='Scaling and rotating an elephant using JavaScript'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-EsmalIv59Q8/TZihCfKnmSI/AAAAAAAAASo/iJEqBXGAyrA/s72-c/Screen+shot+2011-04-03+at+18.31.46.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-5579491001757280785</id><published>2011-03-19T18:46:00.001+01:00</published><updated>2011-03-19T23:12:14.996+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='touch'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='iOS'/><title type='text'>Drawing by touching using JavaScript</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://web.kinderas.com/demos/touch_draw_simple/"&gt;&lt;img border="0" src="https://lh5.googleusercontent.com/-jBBZyD5NhWQ/TYTLUwH5FhI/AAAAAAAAASA/QwNSBHwbgEo/s1600/Screen+shot+2011-03-19+at+16.24.31.png" /&gt;&lt;/a&gt;&lt;/div&gt;The web is no longer exclusive for desktop and laptop computers. With the introduction of the iPhone and the iPad Apple changed how we interact with the web. In the wake of Apples success with iOS devices we see the&amp;nbsp;emergence&amp;nbsp;of a slew of "handheld" devices. They are all different, some are small, others bigger and more powerful, however most of them utilize touch as a means of input. In this article I take a look at how we can create a simple touch enabled drawing application using only JavaScript and a tinsy-winsy bit of HTML 5.&lt;br /&gt;&lt;br /&gt;First, you can try the finished app (with comments) and download the&amp;nbsp;source code&amp;nbsp;from &lt;a href="http://web.kinderas.com/demos/touch_draw_simple/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The first thing we need to do is to make sure that the user visiting our web-app is on a device which can understand touch events. This is pretty straight forward. We accomplish this by asking the «window» DOM element if is knows about one of the touch events.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color: green; font-weight: bold;"&gt;if&lt;/span&gt;(&lt;span style="color: #ba2121;"&gt;'ontouchstart'&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;in&lt;/span&gt; &lt;span style="color: green;"&gt;window&lt;/span&gt; &lt;span style="color: #666666;"&gt;==&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;false&lt;/span&gt;){&lt;br /&gt;   alert(&lt;span style="color: #ba2121;"&gt;'Sorry, you need a touch enabled device to use this app'&lt;/span&gt;);&lt;br /&gt;   &lt;span style="color: green; font-weight: bold;"&gt;return&lt;/span&gt;&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;If this does not stop our script, we know that the current device supports the touch events we need. The next step is to prevent the screen itself from scrolling when you drag your finger across it. We need to do this because touch events «bubbles» in JavaScript. This means that all the parent elements will get a chance to handle the touch event after we have handled it in our function. So after we have handled the «touchmove» event in our canvas element it will bubble right up to the window element where the browser will try to scroll the window. PS: Sometimes you might want this&amp;nbsp;behavior, for&amp;nbsp;example&amp;nbsp;when you're scrolling a page. For our demo, we don't need it. To disable page scrolling we listen for the «touchmove» event on the document element, then we flag the event as handled using «event.preventDefault()».&lt;br /&gt;&lt;br /&gt;Now to the construction part. We need to create a canvas element.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color: green; font-weight: bold;"&gt;var&lt;/span&gt; canvas &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;document&lt;/span&gt;.createElement(&lt;span style="color: #ba2121;"&gt;'canvas'&lt;/span&gt;);&lt;br /&gt;canvas.width  &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;window&lt;/span&gt;.innerWidth&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt;canvas.height &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;window&lt;/span&gt;.innerHeight&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;document&lt;/span&gt;.body.appendChild(canvas);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;We now have a «canvas» element which is the same size as our entire page. Next up we need to create a context in which to draw for the canvas. A context is kinda like a page within a drawing pad. The context can&amp;nbsp;receive&amp;nbsp;JavaScript drawing commands as we will see later on.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;ctx  &lt;span style="color: #666666;"&gt;=&lt;/span&gt; canvas.getContext(&lt;span style="color: #ba2121;"&gt;'2d'&lt;/span&gt;);&lt;br /&gt;ctx.strokeStyle &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;"rgba(255,0,0,1)"&lt;/span&gt;&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt;ctx.lineWidth   &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: #666666;"&gt;5;&lt;/span&gt;&lt;br /&gt;ctx.lineCap     &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'round'&lt;/span&gt;&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;The context is now set up using the color red with a 5 pixel wide stroke and rounded ends. You can change these values as you like of course.&lt;br /&gt;&lt;br /&gt;In order for our fingers to be able to produce wonderful line drawings, we need to tell our application to listen for touch events. We'll need three of them. The «touchstart» event is where we set our starting position for the drawing operation. This event fires when a finger is added to the screen. The «touchmove» is where we draw the lines, this event fires when we move a finger on the screen. The «touchcancel» is where we handle&amp;nbsp;exceptions, like what happens if you&amp;nbsp;receive&amp;nbsp;a call in the middle of your art creation extravaganza. This event fires whenever it needs to.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;canvas.addEventListener(&lt;span style="color: #ba2121;"&gt;"touchstart"&lt;/span&gt;&lt;span style="color: #666666;"&gt;,&lt;/span&gt;touchstartHandler&lt;span style="color: #666666;"&gt;,&lt;/span&gt;&lt;span style="color: green; font-weight: bold;"&gt;false&lt;/span&gt;);&lt;br /&gt;canvas.addEventListener(&lt;span style="color: #ba2121;"&gt;"touchmove"&lt;/span&gt;&lt;span style="color: #666666;"&gt;,&lt;/span&gt; touchmoveHandler&lt;span style="color: #666666;"&gt;,&lt;/span&gt;&lt;span style="color: green; font-weight: bold;"&gt;false&lt;/span&gt;);&lt;br /&gt;canvas.addEventListener(&lt;span style="color: #ba2121;"&gt;"touchcancel"&lt;/span&gt;&lt;span style="color: #666666;"&gt;,&lt;/span&gt; touchcancelHandler&lt;span style="color: #666666;"&gt;,&lt;/span&gt;&lt;span style="color: green; font-weight: bold;"&gt;false&lt;/span&gt;);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Now we'll need to handle those events as well, here is where the real fun begins! Let's have a look a the «touchstart» handler first.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color: green; font-weight: bold;"&gt;function&lt;/span&gt; touchstartHandler(event)&lt;br /&gt;{&lt;br /&gt;   ctx.moveTo(event.touches[&lt;span style="color: #666666;"&gt;0&lt;/span&gt;].pageX&lt;span style="color: #666666;"&gt;,&lt;/span&gt; event.touches[&lt;span style="color: #666666;"&gt;0&lt;/span&gt;].pageY);&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;It's just one line, but do take notice in the «touches» object contained within the event. This is an array (well, kind of) of touches. The reason for this is that most humans have more than one finger, so the «touches» object could&amp;nbsp;actually&amp;nbsp;contain several values. We only need one, so we refer to the first (0) element in the «touches» object. Now that we have found the first finger we get it's location on the screen by asking for the «pageX/Y» values. We then continue to move the canvas context pointer to the coordinates for this finger using the «moveTo» method. This happens every time we place a finger on the screen. But, only for the first finger.&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color: green; font-weight: bold;"&gt;function&lt;/span&gt; touchmoveHandler(event)&lt;br /&gt;{&lt;br /&gt;    ctx.lineTo(event.touches[&lt;span style="color: #666666;"&gt;0&lt;/span&gt;].pageX&lt;span style="color: #666666;"&gt;,&lt;/span&gt; event.touches[&lt;span style="color: #666666;"&gt;0&lt;/span&gt;].pageY);&lt;br /&gt;    ctx.stroke();&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;In the «thouchmove» handler we do the actual work of telling the canvas context to draw a line from where it's last location was to where the finger is now. The first time this is called the line is drawn from where we placed the finger on to the screen, set in the «touchstart» handler. After that, the canvas context will update it's starting position to the location of the last drawing operation. Like the «moveTo» command in «touchstart» the «lineTo» will update the coordinate position, but it will also issue a drawing command which is rendered to the screen when we call the «stroke» method.&lt;br /&gt;&lt;br /&gt;That's it. Try it out on your iPad, iPhone or any other touch device which understands the new HTML 5 APIs by clicking this &lt;a href="http://web.kinderas.com/demos/touch_draw_simple/"&gt;magical link&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Recommended further reading:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html"&gt;Safari web-content guide - Handling events&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-5579491001757280785?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/5579491001757280785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=5579491001757280785' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5579491001757280785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5579491001757280785'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/03/drawing-by-touching-using-javascript.html' title='Drawing by touching using JavaScript'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh5.googleusercontent.com/-jBBZyD5NhWQ/TYTLUwH5FhI/AAAAAAAAASA/QwNSBHwbgEo/s72-c/Screen+shot+2011-03-19+at+16.24.31.png' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-6086840217200258985</id><published>2011-03-16T18:46:00.003+01:00</published><updated>2011-03-17T13:37:57.277+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS3'/><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><title type='text'>Quicktip: Flipping an image with JavaScript</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh3.googleusercontent.com/-89Eyu8LjKGc/TYDzdL7y8HI/AAAAAAAAAR8/HUH5LXBZKPE/s1600/flipped.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://lh3.googleusercontent.com/-89Eyu8LjKGc/TYDzdL7y8HI/AAAAAAAAAR8/HUH5LXBZKPE/s1600/flipped.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;Let's say you wanted to flip an image in you web-app&amp;nbsp;horizontally&amp;nbsp;or vertically. By using a tiny bit of JavaScript and CSS 3 this is really easy.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;span style="color: #408080; font-style: italic;"&gt;//Get the image&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green; font-weight: bold;"&gt;var&lt;/span&gt; img &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;document&lt;/span&gt;.getElementById(&lt;span style="color: #ba2121;"&gt;'myimage'&lt;/span&gt;);&lt;br /&gt;&lt;span style="color: #408080; font-style: italic;"&gt;//Flip it horizontally&lt;/span&gt;&lt;br /&gt;img.style.webkitTransform &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'scaleX(-1)'&lt;/span&gt;&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And you're done! Note that this will only work in webkit browsers. The equivalent for Mozilla browsers would be «img.style.MozTransform». To flip the image vertically you could use: «scaleY(-1)». And to flip both horizontally and vertically at the same time: «scale(-1,-1)».&lt;br /&gt;&lt;br /&gt;&lt;i&gt;[edit 17.03.2011]&lt;/i&gt;&lt;br /&gt;You can of course do this in other browsers besides Gecko or WebKit based browsers, as pointed out in the comments. Safari will&amp;nbsp;actually&amp;nbsp;support both the «webkit» and the «Moz» prefix, but this will most likely go away soon. So what you'll need to use is feature detection. This will still not work in ALL browsers, but the usable ones will most likely support it.&lt;br /&gt;&lt;code&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span style="color: #008000; font-weight: bold"&gt;if&lt;/span&gt;(img.style.webkitTransform){&lt;br /&gt;  img.style.webkitTransform &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;#39;scaleX(-1)&amp;#39;&lt;/span&gt;&lt;span style="color: #666666"&gt;;&lt;/span&gt;&lt;br /&gt;}&lt;span style="color: #008000; font-weight: bold"&gt;else&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;if&lt;/span&gt;(img.style.MozTransform){&lt;br /&gt;  img.style.MozTransform &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;#39;scaleX(-1)&amp;#39;&lt;/span&gt;&lt;span style="color: #666666"&gt;;&lt;/span&gt;&lt;br /&gt;}&lt;span style="color: #008000; font-weight: bold"&gt;else&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;if&lt;/span&gt;(img.style.OTransform){&lt;br /&gt;   img.style.OTransform &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;#39;scaleX(-1)&amp;#39;&lt;/span&gt;&lt;span style="color: #666666"&gt;;&lt;/span&gt;&lt;br /&gt;}&lt;span style="color: #008000; font-weight: bold"&gt;else&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;if&lt;/span&gt;(img.style.msTransform){&lt;br /&gt;   img.style.msTransform &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;#39;scaleX(-1)&amp;#39;&lt;/span&gt;&lt;span style="color: #666666"&gt;;&lt;/span&gt;&lt;br /&gt;}&lt;span style="color: #008000; font-weight: bold"&gt;else&lt;/span&gt;{&lt;br /&gt;   img.style.transform &lt;span style="color: #666666"&gt;=&lt;/span&gt; &lt;span style="color: #BA2121"&gt;&amp;#39;scaleX(-1)&amp;#39;&lt;/span&gt;&lt;span style="color: #666666"&gt;;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-6086840217200258985?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/6086840217200258985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=6086840217200258985' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/6086840217200258985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/6086840217200258985'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/03/quicktip-flipping-image-with-javascript.html' title='Quicktip: Flipping an image with JavaScript'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh3.googleusercontent.com/-89Eyu8LjKGc/TYDzdL7y8HI/AAAAAAAAAR8/HUH5LXBZKPE/s72-c/flipped.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-7839106093643176244</id><published>2011-02-28T22:21:00.000+01:00</published><updated>2011-02-28T22:21:09.784+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='demo'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>HTML 5 Offline data storage</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh3.googleusercontent.com/-LFJmur8IlRg/TWv1zqopGII/AAAAAAAAAQw/bDtmF9dW1BY/s1600/data2.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="152" src="https://lh3.googleusercontent.com/-LFJmur8IlRg/TWv1zqopGII/AAAAAAAAAQw/bDtmF9dW1BY/s200/data2.jpeg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;One of the most anticipated features of HTML 5 and all it's&amp;nbsp;consequential&amp;nbsp;technologies&amp;nbsp;and APIs are the «offline storage» APIs. In this post I'll take a "real world" approach to using the &lt;a href="http://www.w3.org/TR/webdatabase/"&gt;HTML 5 Web-Database&lt;/a&gt; and the «&lt;a href="http://www.w3.org/TR/offline-webapps/"&gt;HTML 5 Offline application cache&lt;/a&gt;». I will take you through an&amp;nbsp;example&amp;nbsp;where a complete elephant gets stored on your computer. That's right! A pink one as well! The point of this demo is to investigate how to store both static data as well as dynamic data which might not be known at design time. For this&amp;nbsp;occasion&amp;nbsp;I have created a &lt;a href="http://web.kinderas.com/demos/dynamic_offline/"&gt;demo&lt;/a&gt; which you are free to download and inspect. It is fully commented and somewhat verbose for easier reading. What this application does in essence is to store a HTML and a &lt;a href="http://web.kinderas.com/demos/dynamic_offline/main.js"&gt;JavaScript file&lt;/a&gt; on your computer, then it will go on to store a picture (which could be dynamic data) in a local database, hence making the application usable when not online. Let's have a look!&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh4.googleusercontent.com/-BMpVomiw4jU/TWv5Xg5yxUI/AAAAAAAAAQ0/ryp-tukNhto/s1600/self-storage-closet.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://lh4.googleusercontent.com/-BMpVomiw4jU/TWv5Xg5yxUI/AAAAAAAAAQ0/ryp-tukNhto/s1600/self-storage-closet.png" /&gt;&lt;/a&gt;&lt;/div&gt;So, our goal is to store both static data and some dynamic data. To achieve this we'll need to use two&amp;nbsp;approaches&amp;nbsp;as mentioned above. The first one, called «HTML 5 Offline Application Storage» is almost automatic once you have it configured. We will utilize this method to store our main JavaScript file so that it will work when you're not online. Cool!&lt;br /&gt;This approach uses a simple text file, called a «manifest file» which tells the browser which data to store locally. In order for this file to be interpreted by the browser correctly you'll need to (1) configure your web-server to serve this file with the «text/cache-manifest» mime-type. It doesn't matter what kind of extension you use, but I prefer either «.manifest» or «.cache». Now that thats out of the way we need to create the «manifest file». Mine looks something like this.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;CACHE MANIFEST&lt;br /&gt;# Cache manifest version 1.0.5&lt;br /&gt;# If you change the version number in this comment,&lt;br /&gt;# the cache manifest is no longer byte-for-byte&lt;br /&gt;# identical.&lt;br /&gt;&lt;br /&gt;main.js&lt;br /&gt;&lt;br /&gt;NETWORK:&lt;br /&gt;# All URLs that start with the following lines&lt;br /&gt;# are whitelisted.&lt;br /&gt;&lt;br /&gt;http://web.kinderas.com/&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;The first line MUST be the text «CACHE MANIFEST». After that you'll go on to specify the files you'll like to be cached. Here you'll put stuff like JavaScript files, HTML pages, CSS files and so on. Mine only has the one «main.js». Note that you do NOT need to specify the HTML file which declares the manifest file. This will&amp;nbsp;typically&amp;nbsp;be your «index.html» file or something like that. More on that later. The next section is the «NETWORK:» section. In this section you specify a "white list" containing URL's from where your application is allowed to get it's data. If you don't specify this your app will not download any data, not from the server it's hosted on or from anywhere else. I have specified my own domain since this is where the elephant is hosted.&lt;br /&gt;You declare the manifest file in your HTML file like so:&lt;br /&gt;&lt;code&gt;&amp;lt;html manifest="cache.manifest"&amp;gt;&lt;/code&gt;&lt;br /&gt;That is it for the manifest file&amp;nbsp;actually. If you are simply going to host a static site, a game or something like that, this will work just file as is. Note that to update your files, you do need to make a change in the manifest file itself, like incrementing the version number.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-4gXcqFqziBQ/TWwDySD_a-I/AAAAAAAAARA/a8sFPxjuV1A/s1600/js.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://lh5.googleusercontent.com/-4gXcqFqziBQ/TWwDySD_a-I/AAAAAAAAARA/a8sFPxjuV1A/s1600/js.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;Next we need to add some &lt;a href="http://web.kinderas.com/demos/dynamic_offline/main.js"&gt;sexy JavaScript&lt;/a&gt; in order to make the pink elephant available for your viewing pleasure in locations the WiFi gods have forsaken. There are three main steps to this: (1) Opening and creating the database and the table if it's not already&amp;nbsp;present.&amp;nbsp;(2) Reading the image from the database or saving it to the database if it's not already in there. (3) Displaying the image. I will not be explaining every line of the code in this post, you'd rather &lt;a href="http://web.kinderas.com/demos/dynamic_offline/main.js"&gt;take a look at the JavaScript file&lt;/a&gt; and read the comments. However I will discuss some of the more important points briefly.&lt;br /&gt;Not all browsers will support the HTML 5 database APIs, so we need to check for this before we can do anything. To do this we check for the existence of the «openDatabase» method on the «window» object, like so:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;if(!window.openDatabase){&lt;br /&gt;// No support for HTML 5 db&lt;br /&gt;return;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;This will detect if the browser has support for the methods we need. If not, give the user a message or some alternative content.&lt;br /&gt;Then, to open / create the database we would we simply write:&lt;br /&gt;&lt;code&gt;db = openDatabase('testdb','1.0','Offline Elephant DB',1024*1024);&lt;/code&gt;&lt;br /&gt;We have just created a 1MB database or opened one if it already existed. Now it's ready to execute SQL queries using transactions.&lt;br /&gt;&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color: green; font-weight: bold;"&gt;var&lt;/span&gt; sql &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: #ba2121;"&gt;'CREATE TABLE IF NOT EXISTS offline_image (id INTEGER ....);'&lt;/span&gt;&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt;db.transaction(&lt;br /&gt; &lt;span style="color: green; font-weight: bold;"&gt;function&lt;/span&gt;(transaction){&lt;br /&gt;  transaction.executeSql(sql&lt;span style="color: #666666;"&gt;,&lt;/span&gt;[]&lt;span style="color: #666666;"&gt;,&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: green; font-weight: bold;"&gt;function&lt;/span&gt;(transaction&lt;span style="color: #666666;"&gt;,&lt;/span&gt; result){&lt;br /&gt;   &lt;span style="color: #408080; font-style: italic;"&gt;//The table was created&lt;/span&gt;&lt;br /&gt;  }&lt;span style="color: #666666;"&gt;,&lt;/span&gt;&lt;br /&gt;  errorHandler);&lt;br /&gt; }&lt;br /&gt;);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;The&amp;nbsp;database&amp;nbsp;table has now been created if it wasn't already there. We now need to check if there is an image already saved in the database, this happens on line 56 in the «readImage()» function. If there is an image with the matching filename saved, we use that, if not we go on to loading and serializing the image, as follows.&lt;br /&gt;&lt;br /&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color: green; font-weight: bold;"&gt;var&lt;/span&gt; canvas &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;document&lt;/span&gt;.createElement(&lt;span style="color: #ba2121;"&gt;'canvas'&lt;/span&gt;);&lt;br /&gt;&lt;span style="color: green; font-weight: bold;"&gt;var&lt;/span&gt; ctx    &lt;span style="color: #666666;"&gt;=&lt;/span&gt; canvas.getContext(&lt;span style="color: #ba2121;"&gt;'2d'&lt;/span&gt;);&lt;br /&gt;&lt;span style="color: green; font-weight: bold;"&gt;var&lt;/span&gt; img    &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;document&lt;/span&gt;.createElement(&lt;span style="color: #ba2121;"&gt;'img'&lt;/span&gt;); &lt;br /&gt;img.onload &lt;span style="color: #666666;"&gt;=&lt;/span&gt; &lt;span style="color: green; font-weight: bold;"&gt;function&lt;/span&gt;(){&lt;br /&gt; canvas.width  &lt;span style="color: #666666;"&gt;=&lt;/span&gt; img.width&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt; canvas.height &lt;span style="color: #666666;"&gt;=&lt;/span&gt; img.height&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt; ctx.drawImage(img&lt;span style="color: #666666;"&gt;,0,0,&lt;/span&gt;img.width&lt;span style="color: #666666;"&gt;,&lt;/span&gt;img.height);&lt;br /&gt; &lt;span style="color: green; font-weight: bold;"&gt;var&lt;/span&gt; base64Image &lt;span style="color: #666666;"&gt;=&lt;/span&gt; canvas.toDataURL();&lt;br /&gt; showImage(base64Image);  &lt;br /&gt;}&lt;br /&gt;img.src &lt;span style="color: #666666;"&gt;=&lt;/span&gt; sImgURL&lt;span style="color: #666666;"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;To be able to save the image we need to create a text version of it's data. We can accomplish this by loading the image and then rendering it in a &lt;a href="http://www.w3.org/TR/html5/the-canvas-element.html"&gt;canvas element&lt;/a&gt;. The Canvas element has a method called «&lt;a href="http://www.w3.org/TR/html5/the-canvas-element.html#dom-canvas-todataurl"&gt;toDataURL&lt;/a&gt;» which will create a &lt;a href="http://en.wikipedia.org/wiki/Data_URI_scheme"&gt;base64 representation&lt;/a&gt; of the Canvas content. Base64 images, also&amp;nbsp;referred&amp;nbsp;to as data urls can easily be saved to the database. Base64 data can also be read directly by the «img» element, so there is no need to decode the base64 string again once it's encoded. But, do note that the canvas element will give you the png base64 version of the image, and it's quite a bit larger than the original binary file.&lt;br /&gt;&lt;br /&gt;That's the gist of it, but you do need to take a look at the &lt;a href="http://web.kinderas.com/demos/dynamic_offline/"&gt;demo&lt;/a&gt; and the &lt;a href="http://web.kinderas.com/demos/dynamic_offline/main.js"&gt;JavaScript&lt;/a&gt; in order to really understand what it going on here. Once you get the hang of it, this is a really powerful approach to making web-applications much more&amp;nbsp;accessible&amp;nbsp;and more&amp;nbsp;interesting.&lt;br /&gt;&lt;br /&gt;Further reading:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://web.kinderas.com/demos/dynamic_offline/"&gt;The Dynamic Offline Demo application- with pink elephant&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://developer.apple.com/library/safari/#documentation/iPhone/Conceptual/SafariJSDatabaseGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007256-CH1-SW1"&gt;Safari Client-Side Storage and Offline Applications Programming Guide&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.w3.org/TR/html5/the-canvas-element.html"&gt;The Canvas Element - W3C&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-7839106093643176244?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/7839106093643176244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=7839106093643176244' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7839106093643176244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7839106093643176244'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/02/html-5-offline-data-storage.html' title='HTML 5 Offline data storage'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh3.googleusercontent.com/-LFJmur8IlRg/TWv1zqopGII/AAAAAAAAAQw/bDtmF9dW1BY/s72-c/data2.jpeg' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-1347940494260409775</id><published>2011-02-09T22:37:00.004+01:00</published><updated>2011-02-14T09:23:32.703+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS3'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='DOM'/><category scheme='http://www.blogger.com/atom/ns#' term='concepts'/><title type='text'>9 things I've learned about web-development</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_wlEpKpwwGr0/TVLa0P9iW5I/AAAAAAAAAQA/2ys6JUw2gUg/s1600/puzzle-cufflinks.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="152" src="http://1.bp.blogspot.com/_wlEpKpwwGr0/TVLa0P9iW5I/AAAAAAAAAQA/2ys6JUw2gUg/s200/puzzle-cufflinks.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;I've been a developer for quite some time now, meddling with both the web-centric and the native side of things. As of lately, that is for the last 3 months or so I have focused more in depth on "standards" based web development. Meaning HTML, CSS and JavaScript. Even if I've been writing HTML since 1996 (yeah, I'm getting old), I have never really bothered to really focus in depth on the basic building blocks of HTML, CSS and JavaScript, until now. 4 books and many many hours of training videos later I feel that I've learned something, which is that an iPad make for a lousy pillow if you keep trying to sleep on it! But more than that, I found 9 things that I have learned, which may be blatantly obvious to you if you are a fancy pantsy web-developer, but then again, maybe you'll learn something new?&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_wlEpKpwwGr0/TVLge_3DT2I/AAAAAAAAAQI/BynYdU_3j9w/s1600/webdesign.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_wlEpKpwwGr0/TVLge_3DT2I/AAAAAAAAAQI/BynYdU_3j9w/s1600/webdesign.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;1. Web-designers and web-developers think differently.&lt;/b&gt;&lt;br /&gt;What do I mean by that? Consider of how you're tagging your HTML with classes and id's. The designer approach to this would be classes all the way, then using the clever selector syntax of CSS to reach the nested areas of the document. This makes sense when working with formatting. Developers tend to view the HTML as a framework with components. Classes are used for formatting while id's are used to identify areas of the markup one would need to reach via JavaScript. Designers will prioritize the "flow" of the «document» whilst developers don't consider it a document at all. I don't think either approach is «correct» or «wrong», it's just two ways of approaching the same challenge.&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/_wlEpKpwwGr0/TVLj0Y_Pm8I/AAAAAAAAAQM/NCLhJlwgsoI/s1600/CSSEditLogo.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_wlEpKpwwGr0/TVLj0Y_Pm8I/AAAAAAAAAQM/NCLhJlwgsoI/s1600/CSSEditLogo.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;2. CSS is not a layout language.&lt;/b&gt;&lt;br /&gt;Almost all layout in modern HTML based webpages are done using &lt;a href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets"&gt;CSS&lt;/a&gt;, so how can anybody claim that it's &lt;a href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets#Limitations"&gt;not a layout language&lt;/a&gt;? I too was somewhat surprised when time and time again the "people who knew what they are talking about" kept repeating this. From the &lt;a href="http://www.whatwg.org/"&gt;WHATWG&lt;/a&gt; to &lt;a href="http://www.w3.org/"&gt;W3C&lt;/a&gt; and several books on the topic kept driving this home..«not a layout language». Turns out, CSS is a formatting language with some layout features. Semantics? Well, not really. If you compare CSS 2.1 to a "real" layout language like &lt;a href="http://en.wikipedia.org/wiki/MXML"&gt;MXML&lt;/a&gt; you'll soon notice a big difference. Layout languages, or UI markup languages have special layout components to group element, flow elements, sort elements both horizontally and vertically. CSS 2.1 does not have this, it's totally reliant on either floats or absolute positioning. This will better with the introduction of the f&lt;a href="http://www.w3.org/TR/css3-flexbox/"&gt;lexible box model&lt;/a&gt; in CSS3, but still it will remain a formatting language at heart.&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/_wlEpKpwwGr0/TVLqDPbV3mI/AAAAAAAAAQQ/StgUPVQ5v5Y/s1600/Awesome%255B1%255D.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_wlEpKpwwGr0/TVLqDPbV3mI/AAAAAAAAAQQ/StgUPVQ5v5Y/s1600/Awesome%255B1%255D.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;3. CSS selectors are incredible powerful...stuff&lt;/b&gt;&lt;br /&gt;This is one of the areas on which I have discovered most new stuff. CSS 2.1 embodies most of them, but with the introduction of the &lt;a href="http://www.w3.org/TR/css3-selectors/"&gt;CSS 3 standard&lt;/a&gt;, selectors can now do some amazing stuff. Conditional child selection, substrings within attributes while traversing child elements are just some examples. And the best part is that they are &lt;a href="http://caniuse.com/"&gt;largely supported&lt;/a&gt; in all modern browsers, including Internet Explorer 8. If I where to recommend one area on with to focus you attention, if you don't already know this, it would be CSS selectors. It's not complicated or hard to understand, there are just so much under the hood which can make your CSS writing a lot more enjoyable.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_wlEpKpwwGr0/TVLuWnGN_jI/AAAAAAAAAQc/t88CcqKLJ_c/s1600/computer_frustration1.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_wlEpKpwwGr0/TVLuWnGN_jI/AAAAAAAAAQc/t88CcqKLJ_c/s1600/computer_frustration1.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;4. Things will look different in different places.&lt;/b&gt;&lt;br /&gt;If you try to create pixel perfect designs across all browsers and platforms you will go bonkers, that is unless you are a technophile machochist whom derives enjoyment from banging your head up against the gigantic wall of Internet Explorer inconsistency. You're much better off using either the &lt;a href="http://kinderas.blogspot.com/2011/01/graceful-degradation-vs-progressive.html"&gt;progressive enhancement or the graceful degradation&lt;/a&gt; approach where you serve different users the same content, only wrapped in a slightly different presentation. This way Internet Explorer users can sit and stare at that black and white page of rich text all day long, while us WebKit fanboys can swim in the loveliness that is a modern browser with animations and shit.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;5. A position is not the same position elsewhere, or everywhere&lt;/b&gt;.&lt;br /&gt;Since this is more or less an extension of point 4, I can't be bothered to find a pretty picture for this one. (&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;As a side note, if you use Google image search for the term "position", turn safe search on!&lt;/span&gt;&lt;/i&gt;) What this point is concerning, what I've found is: Firefox and Chrome (or any other browsers) does not have the same interpretation when it comes to rendering a point at, say x: 100, y: 100. Since it's up to the user agent (browser) to parse your CSS and HTML and then draw it on the screen, you will at certain points end up in a situation where an absolute point in the top left coordinate system will differ from user agent to user agent and even on the same user agent on different operating systems. This can be avoided by using floats and containers instead of using absolute positioning. But, it's better to accept that things might not look exactly the same everywhere.&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/_wlEpKpwwGr0/TVL17STIrwI/AAAAAAAAAQg/Dwpx8A_bKS0/s1600/modernizer_50817324.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_wlEpKpwwGr0/TVL17STIrwI/AAAAAAAAAQg/Dwpx8A_bKS0/s1600/modernizer_50817324.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;6. Modernizer Rocks!&lt;/b&gt;&lt;br /&gt;If you ever need to use conditional CSS 3 or HTML 5, &lt;a href="http://www.modernizr.com/"&gt;Modernizer&lt;/a&gt; is by far the best solution I've found. The way Modernizer works is&amp;nbsp;actually&amp;nbsp;twofold. You can first use it with CSS directly. Lets say you want to take advantage of the RGBA color model found in CSS 3, but you also need to support those pesky Internet Explorer users. All you need to do in your stylesheet is to prefix your class or id selector with ".rgba". Let's say I wanted to apply a style via the selector «h2[class*="onkey"]», but only for browsers supporting RGBA. It would look like this: «.rgba h2[class*="onkey"]». The RGBA class simply adds itself as a ascendant class. This style would then only apply if RGBA was supported. The other way of using Modernizer is with JavaScript. To check for support for H.264 video playback abilities, simply use «Modernizer.video.h264» and it'll return false, "maybe" or "probably". Yep, that is the HTML 5 spec for video format detection..&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_wlEpKpwwGr0/TVL4M-uitRI/AAAAAAAAAQk/up986w7bkS4/s1600/jquery-logo1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_wlEpKpwwGr0/TVL4M-uitRI/AAAAAAAAAQk/up986w7bkS4/s1600/jquery-logo1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;7. jQuery selectors are convenient, JavaScript is fast!&lt;/b&gt;&lt;br /&gt;If you don't know what &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; is, you should go find out! Someone once wrote that &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; is Gods gift to JavaScript. Where God is of course&amp;nbsp;&lt;a href="http://ejohn.org/"&gt;John Resig&lt;/a&gt; and I was the one that wrote that, just now in fact. jQuery is seriously awesome, it allows for fast and easy cross browser development. Underscoring &lt;u&gt;cross browser&lt;/u&gt;, which is what it does really really well. It is just a JavaScript framework, a tiny one at that, but crammed with neat functionality, from animations, ajax loading and the usage of CSS selectors to get a hold of &lt;a href="http://en.wikipedia.org/wiki/Document_Object_Model"&gt;DOM&lt;/a&gt; elements. You can say things like: «jQuery('div.donkey')» which would give you all the donkey divs in the page. This is really convenient, because you can find stuff in the DOM with the same syntax used in the CSS. There is a downside however. When using CSS selectors in a CSS file or in the HTML file, the user agent takes care of all the heavy lifting required to traverse the DOM and find those elements. This is fast because the user agent does this natively using a compiled language such as C. However, jQuery is not written into the native part of the browser and will therefore need to use JavaScript to traverse the DOM to find the elements based on the CSS selector. Hence using the build in JavaScript functions «getElementById», «getElementsByTagName» or the spanking new «&lt;a href="https://developer.mozilla.org/En/DOM/Document.getElementsByClassName"&gt;getElementsByClassName&lt;/a&gt;» is much faster than using the jQuery selectors. What you can do is combine them like so «jQuery(getElementById('id-name'))». Then you would get the speed of the native JavaScript functions while keeping all the jQuery goodness as well.&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/_wlEpKpwwGr0/TVMBZlmQRQI/AAAAAAAAAQo/5j_D5RDTjbE/s1600/ConvertDatatype-48.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_wlEpKpwwGr0/TVMBZlmQRQI/AAAAAAAAAQo/5j_D5RDTjbE/s1600/ConvertDatatype-48.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;8. There are datatypes in JavaScript!&lt;/b&gt;&lt;br /&gt;!!Nerd alert!! Even if you don't explicitly declare datatypes in JS, there is a difference between for example «"2"» and «2». If you where to add these two values together «"2" + 2», you'd get «"22"», while «2 + 2» returns «4». Now, what if «a =&amp;nbsp;[2,3,"a"]» and «b = 2». What would «a + b» give you? That's right «a + b =&amp;gt; "2,3,a2"». JS has a lot of functions for dealing with this. You have «toString()» to convert a number to a string, «parseInt(strNum)» to convert a string into a whole number and so on. The important thing is to be astutely aware of it, even if you can't declare a strict datatype.&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/_wlEpKpwwGr0/TVMCDN8YblI/AAAAAAAAAQs/GP1ZhMctomk/s1600/171944-webkit_logo180_original.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_wlEpKpwwGr0/TVMCDN8YblI/AAAAAAAAAQs/GP1ZhMctomk/s1600/171944-webkit_logo180_original.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;9. The WebKit Web Inspector is your most important tool&lt;/b&gt;&lt;br /&gt;If you're in any WebKit browser, Safari, Chrome so on you have access to the build in "&lt;a href="http://trac.webkit.org/wiki/WebInspector"&gt;Web Inspector&lt;/a&gt;". This tool is your best friend when working with HTML, CSS and JavaScript. It will do anything the more famous &lt;a href="http://getfirebug.com/"&gt;Firebug&lt;/a&gt; does and more. Don't get me wrong, I'm not railing on Firebug which is an awesome tool, I am however highly recommending the WebKit Web Inspector because of it's speed, advanced profiling tools and unsurpassed JavaScript debugger. Try it and you'll see why I'm praising it!&lt;br /&gt;&lt;br /&gt;So that's it, or more likely, that's some of it. If you have actually read all the text down to this I truly hope that this post have contributed in some small way to your blah blah blah blah..you know the drill. Now get back to work, those recursive functions won't be creating themselves ;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-1347940494260409775?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/1347940494260409775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=1347940494260409775' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/1347940494260409775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/1347940494260409775'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/02/9-things-ive-learned-about-web.html' title='9 things I&apos;ve learned about web-development'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_wlEpKpwwGr0/TVLa0P9iW5I/AAAAAAAAAQA/2ys6JUw2gUg/s72-c/puzzle-cufflinks.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-3410136502845274894</id><published>2011-01-18T23:15:00.000+01:00</published><updated>2011-01-18T23:15:00.166+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Codec'/><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='Google'/><category scheme='http://www.blogger.com/atom/ns#' term='h.264'/><category scheme='http://www.blogger.com/atom/ns#' term='Apple'/><title type='text'>The truth about Google and H.264</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&amp;nbsp;If you leave this post remembering only one thing, let it be this: &lt;i&gt;Making something Open Source does not automatically make it better, it just makes it Open Source.&lt;/i&gt; How's that for flamebait?&lt;br /&gt;&lt;br /&gt;Unless you have been living in a box buried underground lately, you have probably noticed the shitstorm surrounding &lt;a href="http://blog.chromium.org/2011/01/html-video-codec-support-in-chrome.html"&gt;Googles decision&lt;/a&gt; to drop support for the &lt;a href="http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC"&gt;H.264 codec&lt;/a&gt; in it's Chrome web-browser. Of course, as a web-developer I do indeed have some thoughts on why this happened and whether it's a smart move. However, before sharing from my goldmine of biased opinion we'll need to get the REAL facts straight, so you can judge for yourself.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Open vs. Free&lt;/b&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_wlEpKpwwGr0/TTYH3lPGEvI/AAAAAAAAAOw/Q5Gp4qJARFg/s1600/h264-1.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_wlEpKpwwGr0/TTYH3lPGEvI/AAAAAAAAAOw/Q5Gp4qJARFg/s1600/h264-1.png" /&gt;&lt;/a&gt;&lt;/div&gt;H.264 is a codec constructed from a bunch of patented technologies and it's developed by the «&lt;a href="http://en.wikipedia.org/wiki/Video_Coding_Experts_Group"&gt;Video Coding Experts Group&lt;/a&gt;» and the «&lt;a href="http://en.wikipedia.org/wiki/Moving_Picture_Experts_Group"&gt;MPEG Group&lt;/a&gt;». H.264 is a video standard (ISO/IEC 14496-10) handled by the «&lt;a href="http://en.wikipedia.org/wiki/International_Organization_for_Standardization"&gt;International Organization for Standardization&lt;/a&gt;». H.264 is an open standard, however it is not a free standard. All the patents included in H.264 are handled by &lt;a href="http://en.wikipedia.org/wiki/MPEG-LA"&gt;MPEG-LA&lt;/a&gt;, not to be confused with the MPEG Group. Microsoft and Apple are some of the minor patent holders of H.264. H.264 is free to use for non-commercial usage, for end users for it's lifetime. For commercial usage (e.g. iTunes Store) and for usage in decoders (e.g. in browsers) one will have to pay a &lt;a href="http://www.zdnet.com/blog/bott/a-closer-look-at-the-costs-and-fine-print-of-h264-licenses/2884"&gt;license fee&lt;/a&gt; capped at $6.5M. H.264 sports a bunch of hardware decoders, from iOS devices to Televisions and DVD/BlueRay players. To create H.264 files you can use everything from &lt;a href="http://www.apple.com/quicktime/download/"&gt;Apple QuickTime&lt;/a&gt; to &lt;a href="http://ffmpeg.org/"&gt;FFMPEG&lt;/a&gt;. H.264 is supported by Apple Safari, Internet Explorer 9 and Google Chrome via the Mpeg4 container.&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/_wlEpKpwwGr0/TTYFVxB_tYI/AAAAAAAAAOc/mXJ_TlylBLo/s1600/webm.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_wlEpKpwwGr0/TTYFVxB_tYI/AAAAAAAAAOc/mXJ_TlylBLo/s1600/webm.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;a href="http://en.wikipedia.org/wiki/VP8"&gt;VP8&lt;/a&gt;, the codec within the &lt;a href="http://en.wikipedia.org/wiki/Webm"&gt;WebM&lt;/a&gt; container, was developed as a proprietary product by a company called &lt;a href="http://en.wikipedia.org/wiki/On2_Technologies"&gt;On2 Technologies&lt;/a&gt;. In 2010 On2 Technologies was acquired by Google, whom continued to release the patents within VP8 under a &lt;a href="http://en.wikipedia.org/wiki/Creative_Commons_licenses"&gt;Creative Commons License&lt;/a&gt;. VP8 is free to use and free to implement. As of today there are slim to none hardware support for VP8 decoding. To decode/encode VP8 today you'll most likely use Google own software based «&lt;a href="http://www.webmproject.org/code/"&gt;libvpx&lt;/a&gt;» library or the FFMPEG(&lt;a href="http://x264dev.multimedia.cx/archives/499"&gt;ffvp8&lt;/a&gt;) implementation. VP8 is today supported by Opera and Firefox 4 via the WebM container.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"&gt;&lt;span class="Apple-style-span" style="font-family: Times;"&gt;&lt;span class="Apple-style-span" style="font-size: small; line-height: normal;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The thing to notice here is that H.264 is indeed an open standard, developed by an independent companies and approved as a standard by ISO, but it's not free to implement. VP8 was developed as a proprietary product by one company, later released into the public domain as Open Source. VP8 is free to implement.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_wlEpKpwwGr0/TTYGtTs2lLI/AAAAAAAAAOo/p5_E693HaJM/s1600/571.ExclamationMark.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="133" src="http://1.bp.blogspot.com/_wlEpKpwwGr0/TTYGtTs2lLI/AAAAAAAAAOo/p5_E693HaJM/s200/571.ExclamationMark.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;What does it all mean?&lt;/b&gt;&lt;br /&gt;In my opinion Googles move has nothing to do with being open, it might have something to do with being free however. For companies like Mozilla, which develops a truly Open Source product it totally makes sense to not implement a video codec for which you have to pay patent royalties. Note that&amp;nbsp;&lt;a href="https://developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements"&gt;Mozilla does not support MP3&lt;/a&gt; either, which also contains commercial patents. It's not that Mozilla can't pay the license fees, it is more the fact that you cannot freely distribute as Open Source a product which implements a patent encumbered video decoder. Mozilla (Firefox) has never had support for H.264, which is a decision I completely support on the basis of their completely open approach in other areas of the implementation as well.&lt;br /&gt;Google on the other hand made the rather strange decision to remove it's already existing support for a widely used codec in a browser littered with other patented technologies. Under the flag of being "open". It's this "being open" part which rubs me the wrong way. Google Chrome is NOT an open browser in the same sense as Firefox is, it implements mp3 and it's own embedded FlashPlayer to mention a few things. As far as I can see, the only logical explanation for Googles move is that this is a business decision. They don't want to pay for a license partly under the control of Apple and Microsoft and would rather control their own codec, namely VP8, which is under Googles control, even if it's Open Source. VP8 has never been through any independent standards organization like H.264 has, it was developed as a proprietary product, in sharp contrast to the independent development of H.264 which was a joint operation shared by many companies. Codec developers also&lt;a href="http://x264dev.multimedia.cx/archives/377"&gt; claim the superiority in quality of H.264 over VP8&lt;/a&gt;. It's estimated that about 60-70% of all web video is encoded in H.264 already, a large part of that is YouTube owned by Google. The reason you can watch video for hours on your Android. Microsoft or iOS device is the H.264 hardware encoder which sits inside of it. Despite all of this Google chooses to exclude H.264 from it's web-browser.. to be open.. yea right!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-3410136502845274894?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/3410136502845274894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=3410136502845274894' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3410136502845274894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3410136502845274894'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/01/truth-about-google-and-h264.html' title='The truth about Google and H.264'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_wlEpKpwwGr0/TTYH3lPGEvI/AAAAAAAAAOw/Q5Gp4qJARFg/s72-c/h264-1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-1365623171523242633</id><published>2011-01-09T18:38:00.000+01:00</published><updated>2011-01-09T18:38:42.678+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='opinion'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='concepts'/><title type='text'>Graceful degradation vs. Progressive enhancement</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_wlEpKpwwGr0/TSncnwFoE0I/AAAAAAAAAOE/skcONr_jwnI/s1600/confused-man.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_wlEpKpwwGr0/TSncnwFoE0I/AAAAAAAAAOE/skcONr_jwnI/s1600/confused-man.png" /&gt;&lt;/a&gt;&lt;/div&gt;There are three possible things you might be feeling after seeing that header. (1) No interest at all (confused?), (2) somewhat intrigued and curious (and confused?) or (3) already in the trenches ready to defend your position.&lt;br /&gt;&lt;br /&gt;First of all, I know that this is somewhat of a "controversial" area, but in the end you do not need to agree with what I have to say, it's just my point of view. But, before we get to the subjective part, let's take an objective look at what is involved when considering these two approaches to (in this case) making web-applications.&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/_wlEpKpwwGr0/TSnjIDzuJqI/AAAAAAAAAOI/yOjLoXpCGBI/s1600/graceful.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="130" src="http://1.bp.blogspot.com/_wlEpKpwwGr0/TSnjIDzuJqI/AAAAAAAAAOI/yOjLoXpCGBI/s200/graceful.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;&lt;a href="http://en.wikipedia.org/wiki/Graceful_degradation"&gt;Graceful&amp;nbsp;degradation&lt;/a&gt; &lt;/b&gt;&lt;i&gt;(or fault-tolerant system).&lt;/i&gt;&lt;br /&gt;In web design, this is the basic idea that we design and write code for the most capable browsers first, then we add support for less capable browsers. An example of this is the "alt" attribute of the «img» tag. Most users will get the image, while those that browsers that do not support (or choose not to display) images gets the "degraded" text representation. The «noscript» tag is another example.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_wlEpKpwwGr0/TSnmbwI1oMI/AAAAAAAAAOU/fKXfs9OrtBI/s1600/progressive-enhancement_sh.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="102" src="http://4.bp.blogspot.com/_wlEpKpwwGr0/TSnmbwI1oMI/AAAAAAAAAOU/fKXfs9OrtBI/s200/progressive-enhancement_sh.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;&lt;a href="http://en.wikipedia.org/wiki/Progressive_enhancement"&gt;Progressive enhancement.&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;When subscribing to «progressive enhancement», you will first design and write code for the least capable browsers (like &lt;a href="http://www.ie6nomore.com/"&gt;Internet Explorer&lt;/a&gt;). Then you'll add in functionality to enhance the experience for users with more capable browsers (like Opera, Firefox, Chrome and Safari). The linked stylesheet is a much used example of this. First you create the web-app in pure HTML (works almost everywhere), then you link a stylesheet to the page (which is ignored by old browsers), making the experience better for more up to date users. The FlashPlugin based «&lt;a href="http://www.mikeindustries.com/blog/sifr"&gt;SIFR&lt;/a&gt;» method is also an example of&amp;nbsp;«progressive enhancement».&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_wlEpKpwwGr0/TSnljNE4MAI/AAAAAAAAAOM/OTo35xQIViU/s1600/fact_or_opinion.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/_wlEpKpwwGr0/TSnljNE4MAI/AAAAAAAAAOM/OTo35xQIViU/s200/fact_or_opinion.png" width="192" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;Aren't those two identical&lt;/b&gt; &lt;i&gt;(or the subjective part)&lt;/i&gt;?&lt;br /&gt;Both of these practices will lead to the same result in most cases. That is, the goal of both approaches is to give the best user experience no matter what browser might be trying to display the web-application. The difference is the starting point. Where as&amp;nbsp;«progressive enhancement»&amp;nbsp;assumes the lowest common denominator as a starting point, «graceful degradation» assumes the opposite, starting at the newest and adding in support for less capable browsers later.&lt;br /&gt;&lt;br /&gt;It is my opinion that the starting point of the lowest common denominator is a not such a good idea, because this line of thought will slow down the progress of new technology adaptation, especially within large enterprise environments. I don't think people in general will catch up on anything unless there is an incentive to do so. A "degraded" experience is a great incentive. Also, web-developers should in my opinion be allowed to adapt new technology as early as possible. A bunch of pig headed Internet Explorer users should not stand in the way of that. There is also the issue of security, speed and support for assistive devices. I would highly recommend the online book "&lt;a href="http://www.20thingsilearned.com/old-vs-new-browsers/1"&gt;20 things I have learned about browsers and the Internet&lt;/a&gt;" from the Google Chrome team, where you can read about why up to date browsers are important for the Internet itself.&lt;br /&gt;&lt;br /&gt;I know what you are thinking. "Wouldn't both approaches allow for rapid technology adaptation?". The answer is of course yes...and no. You can use&amp;nbsp;«progressive enhancement» and still push the limits of technology, forcing the world forward. However, to put it bluntly, that is not the intention of this approach, it's intention is to first support the slackers, then new technology.&amp;nbsp;«Graceful degradation» aims at first supporting new technology, then give the slackers the content, but with a lesser experience. There's a subtle, but important difference here.&lt;br /&gt;&lt;br /&gt;Note that&amp;nbsp;«graceful degradation» has it's drawbacks as well. It is somewhat more complicated to add in "old technology" to a "new technology" project, rather than building "new technology" on top of "old technology" like&amp;nbsp;«progressive enhancement» does it. But, as time goes by, a&amp;nbsp;«progressive enhancement» approach will have more and more of it's foundation deprecated, while the root building blocks of a&amp;nbsp;«graceful degradation» based project will become more and more relevant.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-1365623171523242633?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/1365623171523242633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=1365623171523242633' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/1365623171523242633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/1365623171523242633'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2011/01/graceful-degradation-vs-progressive.html' title='Graceful degradation vs. Progressive enhancement'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_wlEpKpwwGr0/TSncnwFoE0I/AAAAAAAAAOE/skcONr_jwnI/s72-c/confused-man.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-2398142808221603974</id><published>2010-12-28T22:47:00.001+01:00</published><updated>2011-01-02T14:28:44.500+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='Google'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><category scheme='http://www.blogger.com/atom/ns#' term='Apple'/><title type='text'>Web-apps vs Native-apps</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.nerdstickers.net/wp-content/uploads/2010/08/fight-cartoon.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="188" src="http://www.nerdstickers.net/wp-content/uploads/2010/08/fight-cartoon.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;There is a world, a nerdy world occupied by people living in a private bubble called "IT". In this world "new" things are created, things that "ordinary" people couldn't care less about until they are publicized and popularized. Things like Facebook, Twitter, the iPad, gMail, the AppStore and the Internet are things created by the people in this nerdy world. Right now an imagined war is raging in this world, a war between the "by god we will cram everything into a browser" people and the "browsers are cool but slow" people. I'm of course talking about web-apps vs native-apps, or Google vs Apple as some have come to believe. So, is there a war? And who's winning?&lt;br /&gt;&lt;br /&gt;When contemplating the differences inherently present in the not so wide crevasse between web-apps and native apps there are four main areas I want to examine:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Performance&lt;/li&gt;&lt;li&gt;Accessibility&lt;/li&gt;&lt;li&gt;Data persistence and security&lt;/li&gt;&lt;li&gt;The browser&lt;/li&gt;&lt;/ol&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_wlEpKpwwGr0/TRpHV_dJ01I/AAAAAAAAANg/1MhbT2hb8zs/s1600/dt-improved-performance.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="138" src="http://3.bp.blogspot.com/_wlEpKpwwGr0/TRpHV_dJ01I/AAAAAAAAANg/1MhbT2hb8zs/s200/dt-improved-performance.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Performance&lt;/b&gt;&lt;/div&gt;&lt;div&gt;The first thing that springs to mind when taking the classical approach to this age long tiresome debate is the issue of performance. Native apps perform better than web-apps, hence the end user gets a smoother and better experience when using the app. This is true, in most cases. However, performance is more than just the smoothness of animations and the speed of which data is read. Consider the process of installing Adobe Photoshop on your trusty Windows laptop, then activating it, then figuring out how to navigate the god awful interface just to adjust the contrast of an image. Compare that workflow to opening the image with &lt;a href="http://www.picnik.com/"&gt;Picnik&lt;/a&gt; and the choice is pretty clear. Web-apps rule! But, wait. What if you want to edit the movie you shot during the holiday with your FlipMino HD, can you do that in a web-app? Well, sort of, with services like &lt;a href="http://jaycut.com/"&gt;JayCut&lt;/a&gt; and the likes. However, you will get a much better result using iMovie, which is already on you Mac. What about Skype, code compiling, 3D games and so on..? To make a long story short, native apps will outperform web-apps when it comes to pure performance and as long as web-apps are based on a document oriented language (HTML). It will always be a catchup game for web-apps. But, web-apps have another kind of performance advantage, accessibility.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.ehaus.co.uk/images/accessibility_280.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://www.ehaus.co.uk/images/accessibility_280.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Accessibility&lt;/b&gt;&lt;/div&gt;&lt;div&gt;A web-app is always up to date, most of them are easy to use, requires no installation and can be used from almost any computer. That is, except when you're not connected to a network. A statement with modifications indeed, some web-apps do work when in offline mode as well, however a pure offline web-app would be pretty pointless. Consider Google Docs versus Microsoft Office. If you're an author (a brave one) you might want to use MS Word, or if you need some crazy ass pivot tables or other super advanced stuff you would perhaps also need MS Excel. However if you just want to calculate stuff, create and produce formatted text, spreadsheets and presentations, Google Docs is far superior to MS Office. Oh, have you tried to collaborate in real time on a MS Word document, doesn't work does it?! Also, Google Docs keeps your documents on the server so you can access them from anywhere and they are always backed up. Does it work offline, well, not yet.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_wlEpKpwwGr0/TRpTXfx6XjI/AAAAAAAAAN0/iFocmZJ3MR4/s1600/network-security-lock.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="155" src="http://1.bp.blogspot.com/_wlEpKpwwGr0/TRpTXfx6XjI/AAAAAAAAAN0/iFocmZJ3MR4/s200/network-security-lock.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Data persistence and security&lt;/b&gt;&lt;/div&gt;&lt;div&gt;With a native-app your data is always available to you, online or offline, provided that your computer is with you of course, or that you have synced the data to the cloud. What happens if (God forbid) your house (containing your laptop) is leveled by aliens? Where did all your native-app data go? It's history! Your e-mail and Google Docs data is safe at Google. That is, if you are okay with Google searching through your e-mails and documents in order to give you targeted advertisements? And what happens if, say you have saved all your links and bookmarks at a cloud service (lets call it Delicious) and then out of the blue Yahoo! suddenly decides to fire all the people working at that service and let it die a slow death. What about all those years worth of bookmarks then? This is somewhat complicated isn't it?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_wlEpKpwwGr0/TRpJaB5_rOI/AAAAAAAAANo/ZnF7p60VUS4/s1600/google-chrome-store.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="194" src="http://2.bp.blogspot.com/_wlEpKpwwGr0/TRpJaB5_rOI/AAAAAAAAANo/ZnF7p60VUS4/s200/google-chrome-store.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;The browser&lt;/b&gt;&lt;/div&gt;&lt;div&gt;How awesome do you think it would be to play Halo: Reach in Google Chrome? Not so much? What about programming a movie-editor that has to work within the browser sandbox and is only allowed to cache 10MB of data, how would that go down you think? It wouldn't you say? Last one: Let's say we want to persuade ReSpawn Studios or Epic Games to work with WebGL on an unknown amount of browsers and computers instead of writing their engines based directly on a familiar platform. No dice? This is because the browser isn't a gaming platform, it isn't a good platform for handling a lots of files or large files. But, it does add another layer of security and it make everything accessible everywhere, plus if you're using Facebook and gMail what more do you need.. The average time a user spends in a web-page is about 10 seconds, this makes the "browser experience" kinda ..volatile..and short lived. Native app sessions are more persistent and have a longer lifespan, hence more suitable for playing games, editing movies and so on. The browser can do many things, not everything and yes, native apps will continue to be perform better for some time.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There is no war. The browser with it's web-apps is an awesome platform for some things, just as native apps do better on other things. I for one enjoy both web-apps and native-apps and will continue to do so for a long time I suspect.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-2398142808221603974?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/2398142808221603974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=2398142808221603974' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/2398142808221603974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/2398142808221603974'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2010/12/web-apps-vs-native-apps.html' title='Web-apps vs Native-apps'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_wlEpKpwwGr0/TRpHV_dJ01I/AAAAAAAAANg/1MhbT2hb8zs/s72-c/dt-improved-performance.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-8075934647258805738</id><published>2010-10-11T21:46:00.004+02:00</published><updated>2010-12-17T07:00:52.853+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='touch'/><category scheme='http://www.blogger.com/atom/ns#' term='DashCode'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='iPad'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='DOM'/><title type='text'>Scrolling a div on multitouch devices using JavaScript</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_wlEpKpwwGr0/TLNl9z8_3GI/AAAAAAAAAM0/f_2K7mhyAjQ/s1600/Screen+shot+2010-10-11+at+21.16.51.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/_wlEpKpwwGr0/TLNl9z8_3GI/AAAAAAAAAM0/f_2K7mhyAjQ/s200/Screen+shot+2010-10-11+at+21.16.51.png" width="107" /&gt;&lt;/a&gt;&lt;/div&gt;With the emergence of touch devices and the slow but steady tendency of replacing the mouse as an input device, this leaves us with fingers. Both the iOS platform and the Android platform sports APIs for dealing with touches from fingers, for native apps that is. But what about web-apps? Enter the &lt;a href="http://en.wikipedia.org/wiki/DOM_events#Touch_events"&gt;JavaScript touch DOM events.&lt;/a&gt;&amp;nbsp;In this post I'll discuss how to use the touch events to scroll a container (a div) using a finger, e.g. on an iPhone.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What you'll need&lt;/b&gt;&lt;br /&gt;First of all you need a touch device or a simulator like the iPhone simulator to test your code. The code itself can be written in any text editor, however it is recommended to use an editor with a build in debugger or a test environment that supports debugging JavaScript touch events. You might be thinking that &lt;a href="http://getfirebug.com/"&gt;Firebug&lt;/a&gt; or &lt;a href="http://webkit.org/blog/61/introducing-drosera/"&gt;Drosera&lt;/a&gt; is great for debugging, but how exactly would you trigger the touch events in your desktop browser? Well, you can't. This is why I'm using &lt;a href="http://en.wikipedia.org/wiki/Dashcode"&gt;Dashcode&lt;/a&gt; from the iOS SDK for my JavaScript coding. More on using Dashcode in a later post.&lt;br /&gt;&lt;i&gt;Note that this code is written for WebKit based browsers, but should work in principle on other touch browsers as well.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The HTML&lt;/b&gt;&lt;br /&gt;&lt;div&gt;&lt;code&gt; &amp;lt;div id="holder"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;div class="content"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; your content here&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Notice that the content is inside of a div within the holder div, this is because you can't scroll the div in which the touch event is attached to.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The CSS&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#holder{&lt;br /&gt;&amp;nbsp;&amp;nbsp; width: 300px;&lt;br /&gt;&amp;nbsp;&amp;nbsp; height: 200px;&lt;br /&gt;&amp;nbsp;&amp;nbsp; background-color: blue;&lt;br /&gt;&amp;nbsp;&amp;nbsp; -webkit-box-shadow: 3px 3px 5px #000;&lt;br /&gt;&amp;nbsp;&amp;nbsp; padding: 10px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#holder div{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;width:100%;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;height:100%;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;color: white;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;overflow: auto;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-webkit-user-select: none;&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Not much revolutionary here, but do note that we set the "overflow" property to auto on the content div, not the holder itself. Also, we set the "-webkit-user-select" to "none" on the content div, thereby preventing the user of selecting the content. This is optional.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The JavaScript&lt;/b&gt;&lt;br /&gt;There are three main touch events:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;touchstart - Called when a finger touches the listening container (finger down)&lt;/li&gt;&lt;li&gt;touchmove - Called repeatedly when a finger moves (finger down and moving)&lt;/li&gt;&lt;li&gt;touchend - Called when a finger leaves the listening container (finger up)&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Each of these methods gives us an event with a &lt;u&gt;touches&lt;/u&gt; array. Remember, there might be more than one finger since these APIs are made to handle multitouch devices. To get a hold of the vertical position of one finger you would query the &lt;u&gt;touches&lt;/u&gt; array for one finger and get it's &lt;u&gt;pageY&lt;/u&gt; property, like this:&amp;nbsp;&lt;code&gt;event.touches[0].pageY&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;From this we can calculate and set the scrollTop property of the content container. But, wait! If you try this the rest of the page will also scroll, not what we wanted. The reason why this happens is because the touch event bubbles all the way up to the window, making the browser think it needs to scroll the window because you have dragged your finger on it. We need to tell the event to stop bubbling, we will handle the event ourselves. We do this by calling: &lt;code&gt;event.preventDefault()&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The complete JavaScript code will then look something like this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;var startPos;&lt;br /&gt;function init()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var scrollArea = document.getElementById('holder');&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;scrollArea.addEventListener('touchstart', function(event){&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;touchstartHandler(event);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}, false);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;scrollArea.addEventListener('touchmove', function(event){&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;touchmoveHandler(event);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}, false);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;scrollArea.addEventListener('touchend', function(event){&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;touchendHandler(event);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}, false);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function touchstartHandler(e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;startPos = e.touches[0].pageY;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function touchmoveHandler(e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var touch = e.touches[0];&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var targetBox = e.currentTarget.getElementsByTagName("div")[0];&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;e.preventDefault();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var fingerMoved = startPos - touch.pageY;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;startPos = touch.pageY;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; targetBox.scrollTop = targetBox.scrollTop + fingerMoved;&lt;br /&gt;&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;This is just a simple example, but it's something you'll probably end up using a lot. Speaking of...&lt;br /&gt;&lt;br /&gt;&lt;b&gt;When should you override the default window scroll&lt;/b&gt;&lt;br /&gt;On an iPhone there is not as much need for this method as you'll probably scroll the entire screen in most cases anyway. However, the iPad is a different story. Take a look at the iPad version of gMail created by Google. They are using this method with success, and they have added inertia scrolling as well. This can be accomplished using the last touch event we did not implement,&amp;nbsp;&lt;u&gt;touchend.&lt;/u&gt;&amp;nbsp;Maybe more on this in a later post. Anyway, you should use you own scrolling when it's appropriate to scroll only a part of the app, like a spilt view list or something like that.&lt;br /&gt;&lt;div&gt;&lt;/div&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/7239447129918882627-8075934647258805738?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/8075934647258805738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=8075934647258805738' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8075934647258805738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8075934647258805738'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2010/10/scrolling-div-on-multitouch-devices.html' title='Scrolling a div on multitouch devices using JavaScript'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_wlEpKpwwGr0/TLNl9z8_3GI/AAAAAAAAAM0/f_2K7mhyAjQ/s72-c/Screen+shot+2010-10-11+at+21.16.51.png' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-3232003004791523248</id><published>2010-10-02T15:24:00.000+02:00</published><updated>2010-10-02T15:24:25.388+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Downscaling images in Flash applications</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://upload.wikimedia.org/wikipedia/commons/1/1d/Scaling.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="148" src="http://upload.wikimedia.org/wikipedia/commons/1/1d/Scaling.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;The other day I ended up in an interesting discussion regarding how to downscale a large image in a Flash based application. What we figured out was that even though the FlashPlayer can do &lt;a href="http://en.wikipedia.org/wiki/Bilinear_interpolation"&gt;bilinear&lt;/a&gt; smoothing on scaled images automatically, this will fail when the scaling factor is more than 2 times of the source image. Hence a custom method is needed.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The simple approach (scaling down less than 2 times the size)&lt;/b&gt;&lt;br /&gt;If the loaded image is to be scaled less than 2 times (400 -&amp;gt; 200) simply use the build in "&lt;a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/Bitmap.html#smoothing"&gt;smoothing&lt;/a&gt;" property of the &lt;a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/Bitmap.html"&gt;Bitmap Clas&lt;/a&gt;s. This can be set directly on the Bitmap itself or via different DisplayElements such as the mx:Image in Flex. If you set this property to true the Bitmap will use bilinear scaling, achieving quite good results.&lt;br /&gt;&lt;br /&gt;&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://www.blogger.com/goog_912792194"&gt;&lt;img border="0" height="200" src="http://upload.wikimedia.org/wikipedia/commons/7/79/Bilin2.png" width="199" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;a href="http://en.wikipedia.org/wiki/Bilinear_interpolation"&gt;Grayscale bilinear interpolation&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Now, if you need to do actual resampling of an image, in other words create a new smaller image, then you need to do this manually using the "&lt;a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.html#draw()"&gt;draw()&lt;/a&gt;" method of the &lt;a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.html"&gt;BitmapData Class&lt;/a&gt;. Use the bitmapData.draw() method and set the "smoothing" property to true. This will give you the same result as setting the smoothing property on an Bitmap container, however it uses less memory as only the pixels for the resulting image is stored (if you remember to dispose of the original data!).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Scaling down more than 2 times&lt;/b&gt;&lt;br /&gt;Let's say that you have an image that is quite large and you want to create a thumbnail from it. A thumbnail is often way smaller than 2 times smaller than the original image. It would be quite nice to use the above method to just scale the image, or better resample the image with the "smoothing" property set to true. However, if you try to do this the FlashPlayer will simply fail and default back to using the &lt;a href="http://tech-algorithm.com/articles/nearest-neighbor-image-scaling/"&gt;"nearest neighbor&lt;/a&gt;" algorithm. If you try it you'll soon discover that this will give you a horrible result.&lt;br /&gt;&lt;br /&gt;What you'll need to do in this case is to do an iterative or recursive resampling of the image at hand. In layman terms this means resampling the image several times, each time no more than 2 times downscaling factor. You could call this a multi pass resampler (actually it would be a multi-multi pass resampling as the draw() method is also multi pass). You would still use the build in "BitmapData.draw()" method to accomplish this, you only divide the work into multiple jobs. This will give you a much better result. Note that in my experience, function calls in ActionsScript 3 are quite expensive, hence a iterative approach would maybe be preferable to a recursive one.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;b&gt;Using PixelBender&lt;/b&gt;&lt;br /&gt;If you have decided to go for the manual approach of resampling the picture, you can use a PixelBender shader to do the job. In this case the actual resampling will be a lot faster (as the PB language is based on C), however applying the PB shader and passing the image back and forth takes time. See the speed section..&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;b&gt;Combining the two&lt;/b&gt;&lt;br /&gt;So, what if you have an application and you don't know in advance the downscale factor. Well, then you'll need to use both of the approaches like so:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Calculate the scale factor&lt;/li&gt;&lt;li&gt;If the scale factor is less than 2, set "smoothing" to true on the container or do a singe pass resampling.&lt;/li&gt;&lt;li&gt;If the scale factor is more than two, use the multi pass scaling approach. And set the "smoothing" property of the container to false (else it will be blurry).&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.aykew.com/images/aboutwork/speed.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="144" src="http://www.aykew.com/images/aboutwork/speed.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;What about speed?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Let's say that you have an image that is 1200 x 1200 pixels and you're resampling it to 200 x 200. This is a 6 times resample and will look like ass using only the "smoothing" property, but it is faster.&lt;br /&gt;&lt;br /&gt;Let look at some hard results. In this test we see how much time is used extra compared to no "nearest neighbor" scaling (default in Bitmaps if smoothing is off).&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;Method&lt;/th&gt;&lt;th&gt;Time in ms&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Smoothing property on&lt;/td&gt;&lt;td&gt;&lt;div style="text-align: right;"&gt;0 ms&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Multi pass resample&lt;/td&gt;&lt;td&gt;&lt;div style="text-align: right;"&gt;9 ms&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Multi pass PixelBender&lt;/td&gt;&lt;td&gt;&lt;div style="text-align: right;"&gt;32 ms&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div&gt;Using the smoothing property takes no extra time, because it fails and defaults back to nearest neighbor. The other two are both pretty fast, however even though the PB algorithm is way faster than the others, we see that the applying of the shader eats a lot of time, thereby making the multi pass resampler method the way to go on a large rescaling operation.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-3232003004791523248?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/3232003004791523248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=3232003004791523248' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3232003004791523248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3232003004791523248'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2010/10/downscaling-images-in-flash.html' title='Downscaling images in Flash applications'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-7750283752924702701</id><published>2010-07-05T20:09:00.002+02:00</published><updated>2010-07-05T20:16:58.731+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CSS3'/><category scheme='http://www.blogger.com/atom/ns#' term='iPad'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML5'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><title type='text'>Shifting the attention - facing forward.</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_wlEpKpwwGr0/TDIQBh8Qk-I/AAAAAAAAAME/rCSlQ42omUI/s1600/html5.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_wlEpKpwwGr0/TDIQBh8Qk-I/AAAAAAAAAME/rCSlQ42omUI/s320/html5.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;“&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Innovation is the ability to see change as an opportunity - not a threat&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;”. - &lt;i&gt;Unknown&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is not where I'm going to announce to the world that I'm leaving the FlashPlayer platform behind all together. Nor is this where I'll tell you to forget everything you know, gather you wits about you and start over. No, this is where I'll tell you what I've learned, how I've learned this and why this is.&lt;br /&gt;&lt;br /&gt;Like Borland Delphi back in the days, the Adobe FlashPlayer architecture is dying without itself being aware of it. It's not because Flash content is evil, nor because the FlashPlayer is particularity crappy. Still, many sites, like &lt;a href="http://apiblog.youtube.com/2010/06/flash-and-html5-tag.html"&gt;YouTube are heavily dependent&lt;/a&gt; on the FlashPlayer in order to display their content. This will be true for quite some time. However, at the same time, all these sites still depending on the FlashPlayer do not express enthusiasm for it, it's seen more as a necessary evil in order to get the job done while we are waiting for something better. Well, change has come to the interwebs..and it's called HTML 5.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://dev.w3.org/html5/spec/Overview.html"&gt;HTML 5&lt;/a&gt; is acctually a standard being developed by &lt;a href="http://www.w3.org/"&gt;the World Wide Web Consortium&lt;/a&gt;. Like HTML 4 it's a specification used by browser vendors to integrate the support into their browsers. This by it self means that &amp;nbsp;individual browser vendors are responsible for the performance of HTML content in their browsers, effectively launching a race to be the fastest browser. This is a win for HTML 5 over Flash, seeing as Flash Player has no real competitors, because Adobe is the sole vendor. However, HTML 5 and it's companions CSS 3 and JavaScript cannot accomplish the same as the content you create using Adobe Flash, or so many people think. Actually, it can. Both 2D animations, 3D animations, advanced text layout and so on is readily available using HTML 5. So is advanced interactions. What HTML 5 does not have, that Flash do have, is an advanced authoring tool. Using HTML 5 may require more development skills, longer production time and more work to achieve the same result as using Flash authoring, today. This will change in time as HTML 5 skills grow more common amongst web-developers and the marked for great tools enlarges.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_wlEpKpwwGr0/TDIZIQKdtLI/AAAAAAAAAMM/M3e_DdA71H4/s1600/ipad.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/_wlEpKpwwGr0/TDIZIQKdtLI/AAAAAAAAAMM/M3e_DdA71H4/s200/ipad.png" width="130" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;“Innovation distinguishes between a leader and a follower.” - Steve Jobs&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Let's not forget the devices. The iPad, the iPhone, Android devices and the Google Chrome OS. These are the platforms of the future, the PC is not. Yeah, PCs will still be around, we as developers will still adhere like superglue to our Macs and Chrome computers. But, the normal users, aka. "most people" will not. Flash belongs to the PC era, HTML 5 is build for the touchscreen generation. This is kinda hard to see if you don't look closely, but think about it. How many iPads and iPhones does Apple sell? A lot! How many Android devices are there? A lot! Granted, Android phones do have a FlashPlayer, but have you tried it? Yes, it really sucks. And that is the most devastating blow to the FlashPlayer, the experience on future devices sucks or it simply isn't supported like on iOS devices.&lt;br /&gt;&lt;br /&gt;Change is one of the most difficult things for humans to endure. We don't play well with it at all, but sometimes it's for the better. Remember, there is nothing wrong with plugin based technologies like FlashPlayer or Silverlight, like there was nothing wrong with the horse and carriage. But, now we drive cars, even if they can't do everything horses can do. This does not, however, mean that we hate horses, does it?&lt;br /&gt;&lt;br /&gt;Resulting from my contemplation is an understanding that my attention will focus on the utilization of standard based technologies in the foreseeable future. I believe HTML 5 and all its companions will be the way of future web-based solutions. Flash is not dead, will perhaps never die, but if you're starting out today as a greenhorn developer, go for the future. And if you are a seasoned web-developer like myself, embrace this opportunity to learn new things, to start from "scratch".&lt;br /&gt;&lt;br /&gt;Some great HTML 5 demos can be found here:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://developer.apple.com/safaridemos/"&gt;Safari demos from Apple&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://html5demos.com/"&gt;HTML 5 Demo&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.youtube.com/html5"&gt;YouTube HTML 5 version&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://slides.html5rocks.com/#slide1"&gt;HTML 5 Presentation&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-7750283752924702701?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/7750283752924702701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=7750283752924702701' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7750283752924702701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7750283752924702701'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2010/07/shifting-attention-facing-forward.html' title='Shifting the attention - facing forward.'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_wlEpKpwwGr0/TDIQBh8Qk-I/AAAAAAAAAME/rCSlQ42omUI/s72-c/html5.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-6545079287068292067</id><published>2010-05-31T23:03:00.008+02:00</published><updated>2010-06-08T21:36:57.718+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Screencast'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><title type='text'>Screencast #4 - Parsing XML using the iPhone SDK</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; white-space: pre-wrap;"&gt;In this Screencast I'll show you how to parse a XML Twitter feed using  the NSXMLParser that comes with the iPhone SDK (Cocoa Touch). All of this under 10 minutes, which makes for an attention demanding learning experience.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 12px; white-space: pre-wrap;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;object height="236" width="420"&gt;&lt;param name="movie" value="http://www.youtube.com/v/5iKkbi3d35Y&amp;hl=en_US&amp;fs=1&amp;rel=0"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/5iKkbi3d35Y&amp;hl=en_US&amp;fs=1&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="420" height="236"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://docs.google.com/leaf?id=0B5D35v8KWeRWNGYyZmU5NjMtZDlhMS00ZjE2LWI4ZTAtMTY4OGYxYTRmNWU3&amp;amp;hl=en"&gt;Download source code&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;PS: Even though I forgot to mention it during the screencast, do remember to implement dealloc!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-6545079287068292067?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/6545079287068292067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=6545079287068292067' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/6545079287068292067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/6545079287068292067'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2010/05/screencast-4-parsing-xml-using-iphone.html' title='Screencast #4 - Parsing XML using the iPhone SDK'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-7865260193209757989</id><published>2010-02-21T20:54:00.000+01:00</published><updated>2010-02-21T20:54:59.714+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='iPad'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Do we need Flash anyway? Apple says hell no!</title><content type='html'>Unless you have been living in a box for the last couple of months or so, you're probably noticed that there's somewhat of a controversy dealing in the subject of Adobe Flash and Apple Inc.'s not so new policy to not support this widely used content type in their mobile devices.&lt;br /&gt;In short, Apple cry fault on several things like CPU usage and instability, using these as the foundation for it's "no Flash content on our devices" policy. But, is it really that simple? Here's my take on this soon to be "greek tragedy".&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;What is Flash?&lt;/span&gt;&lt;br /&gt;First of all, Flash is a type of media content, like images, movies and so on. Flash by itself doesn't do diddly-squat, it's just a description and a file format. In order to view Flash content you'll need an interpreter, in others words a player. What Apple is calling "the great evil" is (hopefully) the Adobe FlashPlayer, not the content type which is actually Flash.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Is Flash crashing my browser?&lt;/span&gt;&lt;br /&gt;No! As described above, Flash all by itself can't do anything. If anything related to Flash is crashing your browser, it is the Adobe FlashPlayer. So you may ask, is the FlashPlayer the reason (most of the time) my browser is suddenly crashing? In my opinion it probably is. The Adobe FlashPlayer is quite unstable and buggy and slow. Why? Read on..&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Is the FlashPlayer a "CPU hog"?&lt;/span&gt;&lt;br /&gt;Yes it is. The Adobe FlashPlayer runs a constant loop of so called frames, driving animation, UI and so on. This will create a constant load on the CPU, because the content can change without reloading the webpage holding the Flash content. In contrast, HTML will create a heavy CPU load when initially loading the content and then it becomes static, thereby not using any (almost) CPU cycles. So, what if you where able to create the same content as you can show in the FlashPlayer in say.. HTML and JavaScript. What do you think would happen to the CPU load of that HTML page then? Of course, it would use more CPU cycles.&lt;br /&gt;So, Adobes FlashPlayer is slow, no doubt about it, but this does not make Flash itself a "CPU hog" or anything like that. If Apple wants a faster FlashPlayer.. write one!&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Will Flash die, what might prevent it?&lt;/b&gt;&lt;br /&gt;Flash will die, or evolve into something else, eventually. But, it won't happen tomorrow, or the next day. Event though Apple does not support Flash in the iPhone and the iPad, almost any other device does or will support it. However, if you're a smart developer you'll use this time to widen your skill set beyond the Flash platform.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Development time and cost&lt;/i&gt;&lt;br /&gt;The time spend creating an online application or website will in many cases be the deciding factor in a project, unless you're Google or Apple that is. Using the Flash platform compared to JavaScript/HTML solutions leaves the latter&amp;nbsp;far behind&amp;nbsp;in the dust when it breaks down to actual production time. This factor will no doubt change with the advent of advanced frameworks like JQuery and SproutCore. But still, anything you can do in JS and HTML, Flash can do better and faster from an time and design standpoint... today.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Dropping legacy support is the way of making a more stable player&lt;/i&gt;&lt;br /&gt;One of the biggest problems with the Adobe FlashPlayer as I see it, is it's reluctance to get rid of old and bad ways of creating content. If Adobe where to drop support for the old player model, supporting ActionScript 2 and Flash 8 and older, I'll bet money that Flash content around the web would run faster, smoother and crash way less. If they are willing to do this I do believe Flash content might have a future, if not it will be kept alive by the need for banner ads, for a while.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Why doesn't Apple support Flash content?&lt;/b&gt;&lt;br /&gt;Well, Steve Jobs allegedly stated that Apple wasn't supporting Flash content on the iPhone and the iPad for reasons dealing in instability, performance and generally bad user experience. If that's all, why not support Microsoft Silverlight?&lt;br /&gt;Flash could be a competitor for Apple, both in the apps section of their business model and in the media consumption part (buying videos from the web (e.g. Hulu) and not the iTunes Store).&lt;br /&gt;This is why, in my opinion, Apple will not support Flash content on their mobile devices. And really, if you think of it, is is such a problem? If you depend on Flash driven web content, don't buy Apple hardware. For me, being both an Apple "fan" and a Flash developer, I don't see the need for Flash content on mobile devices. No matter how you word it, the iPhone and the iPad won't give you the entire web..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-7865260193209757989?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/7865260193209757989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=7865260193209757989' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7865260193209757989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7865260193209757989'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2010/02/do-we-need-flash-anyway-apple-says-hell.html' title='Do we need Flash anyway? Apple says hell no!'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-453141536572151846</id><published>2010-02-13T19:00:00.004+01:00</published><updated>2010-06-03T20:29:05.710+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Screencast'/><category scheme='http://www.blogger.com/atom/ns#' term='DashCode'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone Development'/><title type='text'>Screencast # 3 - iPhone web app Twitter viewer</title><content type='html'>In this Screencast I create a really simple iPhone Web Application using DashCode, one of the tools provided trough the &lt;a href="http://developer.apple.com/iphone/"&gt;iPhone Developer Tools&lt;/a&gt;.&lt;br /&gt;I'll show you how to create a simple Twitter viewer, getting started using lists and how to use value transformers in DashCode.&lt;br /&gt;&lt;br /&gt;&lt;object width="420" height="236"&gt;&lt;param name="movie" value="http://www.youtube.com/v/s-vE0pJRYGo&amp;hl=en_US&amp;fs=1&amp;rel=0"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/s-vE0pJRYGo&amp;hl=en_US&amp;fs=1&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="420" height="236"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/leaf?id=0B5D35v8KWeRWYzhkYzMwODYtZjUzYy00OTgxLWE2OTMtZDljYWRhNmJjN2Jm&amp;amp;hl=en"&gt;Download DashCode Project&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-453141536572151846?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/453141536572151846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=453141536572151846' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/453141536572151846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/453141536572151846'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2010/02/screencast-3-iphone-web-app-twitter.html' title='Screencast # 3 - iPhone web app Twitter viewer'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-8149659797801983785</id><published>2010-01-24T20:21:00.003+01:00</published><updated>2010-06-03T20:29:20.959+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Screencast'/><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><title type='text'>Screencast # 2 - Scrolling HBox without scrollbars (Flex 3)</title><content type='html'>In this screencast we'll be looking at how to scroll an HBox in Flex 3, without having the scrollbars present. I'll also show you how to get a nice animation effect when doing the scrolling.&lt;br /&gt;Source code below the video.&lt;br /&gt;&lt;br /&gt;&lt;object height="236" width="420"&gt;&lt;param name="movie" value="http://www.youtube.com/v/accluDCigh0&amp;hl=en_US&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/accluDCigh0&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="420" height="236"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://docs.google.com/leaf?id=0B5D35v8KWeRWZDRkODcxMTktYmExYS00ZmE0LWE4YWMtOWIxMzEwZWMzMTFh&amp;amp;hl=en"&gt;Download source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-8149659797801983785?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/8149659797801983785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=8149659797801983785' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8149659797801983785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8149659797801983785'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2010/01/screencast-2-scrolling-hbox-without.html' title='Screencast # 2 - Scrolling HBox without scrollbars (Flex 3)'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-3017161683886753736</id><published>2010-01-17T23:18:00.013+01:00</published><updated>2010-06-03T20:29:35.226+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Screencast'/><category scheme='http://www.blogger.com/atom/ns#' term='FlashBuilder'/><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><title type='text'>Screencast # 1 - Filtering ArrayCollections</title><content type='html'>In this first screencast I take look at loading XML data into an ArrayCollection, avoiding some common pitfalls and then doing live filtering on the data shown in an DataGrid.&lt;br /&gt;Note that this is my first sceencast and my native language is not english, so this is just me getting my feet wet so to speak.&lt;br /&gt;Source code below the video.&lt;br /&gt;&lt;br /&gt;&lt;object height="236" width="420"&gt;&lt;param name="movie" value="http://www.youtube.com/v/nIO2SHKxZ84&amp;hl=en_US&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/nIO2SHKxZ84&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="420" height="236"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://docs.google.com/leaf?id=0B5D35v8KWeRWZDRkODcxMTktYmExYS00ZmE0LWE4YWMtOWIxMzEwZWMzMTFh&amp;amp;hl=en"&gt;Download source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-3017161683886753736?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/3017161683886753736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=3017161683886753736' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3017161683886753736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3017161683886753736'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2010/01/screencast-1-filtering-arraycollections.html' title='Screencast # 1 - Filtering ArrayCollections'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-1431543086890458552</id><published>2009-10-24T00:00:00.006+02:00</published><updated>2009-10-24T00:32:30.357+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><title type='text'>Quicktip: Searching an ArrayCollection fast and easy</title><content type='html'>Let's say your Flex project needs to maintain a large amount of data, like all the userdata from you big ass site. You can use several datastructures in Flex to store complex userdata, from XML to linked lists. However, perhaps the most useful and easiest structure is the Flex native ArrayCollection. This structure gives you a lot for free, for instance.. searching for stuff.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's say you have all of your users in "usersCollection" which is an ArrayCollection. A user object may contain things like "firstNamename","lastName", "email", "address" and so on. Now, what if you need to find a specific user like "John Rambo". Then you'll need to search both the first and last name fields. You could of course traverse the entire collection using a loop, checking every iteration. Hang on, there is a faster way using a cursor (it's kinda lika a struct pointer if you're a C person).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;First you need to sort the collection&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;var mySort:Sort = new Sort();&lt;/div&gt;&lt;div&gt;mySort.fields = [new SortField('lastname')];&lt;/div&gt;&lt;div&gt;usersCollection.sort = mySort;&lt;/div&gt;&lt;div&gt;usersCollection.refresh();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Then we create the cursor, pointing to the first item in the collection at init.&lt;/div&gt;&lt;div&gt;&lt;code&gt;var cursor:iViewCursor = usersCollection.createCursor;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:monospace, serif;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Now, we need to search both first and last name, so we create a searchobject.&lt;/div&gt;&lt;div&gt;&lt;code&gt;var sObj:Object = {firstname:"John",lastname:"Rambo"};&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:monospace, serif;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;We are now ready to do the actual search by using the findAny method of the cursor.&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;if(cursor.findAny(sObj)){&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;//We found him&lt;/div&gt;&lt;div&gt;}else{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;//John Rambo is lost again&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;In order to get to the user we found we utilize the current property of the cursor.&lt;/div&gt;&lt;div&gt;&lt;code&gt;var foundUser:Object = cursor.current;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:monospace, serif;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Do keep in mind that the cursor is now pointing to the user found, so if we want the next user in the list we can simply go "cursor.moveNext()"&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Why should you use this method? It's more flexible, it's faster and uses less resources than the traditional iterative loop approach.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-1431543086890458552?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/1431543086890458552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=1431543086890458552' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/1431543086890458552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/1431543086890458552'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2009/10/quicktip-searching-arraycollection-fast.html' title='Quicktip: Searching an ArrayCollection fast and easy'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-157029087386576989</id><published>2009-05-17T16:27:00.007+02:00</published><updated>2009-05-17T17:03:56.621+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FlashBuilder'/><category scheme='http://www.blogger.com/atom/ns#' term='Catalyst'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Adobe Flash becoming an "Ad tool" full time?</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_wlEpKpwwGr0/ShAfS8wOSPI/AAAAAAAAAJw/usmedvHVBdc/s1600-h/flash_platform_des_dev.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 89px;" src="http://4.bp.blogspot.com/_wlEpKpwwGr0/ShAfS8wOSPI/AAAAAAAAAJw/usmedvHVBdc/s200/flash_platform_des_dev.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5336799968840534258" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_wlEpKpwwGr0/ShAfLFvaXQI/AAAAAAAAAJo/qBRtrWtVn1I/s1600-h/flash_platform_des_dev.png"&gt;&lt;/a&gt;As &lt;a href="http://blog.digitalbackcountry.com/2009/05/flex-builder-gumbo-is-being-renamed-flash-builder/"&gt;reported&lt;/a&gt; by &lt;a href="http://blog.digitalbackcountry.com/about/"&gt;Ryan Stewart&lt;/a&gt;, Adobe is altering the name of the next version of &lt;a href="http://opensource.adobe.com/wiki/display/flexsdk/Gumbo"&gt;Flex Builder&lt;/a&gt;(code name «&lt;a href="http://opensource.adobe.com/wiki/display/flexsdk/Gumbo"&gt;Gumbo&lt;/a&gt;») to «Flash Builder». Seeing this in correlation with the new «&lt;a href="http://labs.adobe.com/technologies/flashcatalyst/"&gt;Flash Catalyst&lt;/a&gt;», I can't help wonder where this leaves the Flash authoring tool.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.adobe.com/products/flash/"&gt;Adobe Flash&lt;/a&gt; has for some time been struggling with a bad rep for being the tool  "which is used for creating annoying banner ads". This view does hold water in many cases, adding insult to injury the fact that many Flash sites are poorly built and tend to leave users with a crashing web-browser. It seems like Adobe are segmenting out Flash as a cowboy tool, fronting Flash Catalyst and Flash Builder as the tools for creating "real" RIA applications and "robust" rich interactive web sites. On the other hand this may not be their intention at all, however I do believe it will be the result following this strategy.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I base this assumption on two things in large. One is the fact that the Flash authoring tool becomes more or less redundant with the introduction of Flash Catalyst, seeing it from a designer standpoint. As for developers, the Flash authoring tool has never been the first choice to put it in subtle terms. The second argument bases itself in the evolutionary direction in which rich internet applications are heading. Current trends shows that rich web-sites and RIA applications grow ever more complex, at the same time users are demanding a more friendly UI, conformity in the experience and short load times. Flex and Catalyst performs advanced tasks better..&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Adobe Flash authoring is a tool for creating interactive animations, but has been used for everything else in the past years. I do not think the Flash authoring tool will die, but it's role will diminish, leaving Flash Catalyst as the main designer tool for rich content and Flash Builder as the developers choice.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-157029087386576989?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/157029087386576989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=157029087386576989' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/157029087386576989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/157029087386576989'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2009/05/adobe-flash-becoming-ad-tool-full-time.html' title='Adobe Flash becoming an &quot;Ad tool&quot; full time?'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_wlEpKpwwGr0/ShAfS8wOSPI/AAAAAAAAAJw/usmedvHVBdc/s72-c/flash_platform_des_dev.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-5386570928703596949</id><published>2009-05-07T21:44:00.013+02:00</published><updated>2009-05-08T08:42:48.883+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AIR'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='RIA'/><category scheme='http://www.blogger.com/atom/ns#' term='ui'/><category scheme='http://www.blogger.com/atom/ns#' term='Web 2.0'/><title type='text'>Why and when to break out of the browser</title><content type='html'>&lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;"A web app can do what a computer from 15 years ago, without a disk can do" &lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;&lt;a href="http://www.red-sweater.com/blog/"&gt;Daniel Jalkut&lt;/a&gt;&lt;/span&gt;&lt;div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;While Daniel Jalkut was sort of kidding when making this statement on "&lt;/span&gt;&lt;a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?i=54717524&amp;amp;id=281777685"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Core Intuition 17&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;", he wasn't really kidding. The fact remains that desktop applications sport a lot more features, both UI, functionality and user friendly vise compared to Web 2.0 applications. But, when does it make sense to move something onto the desktop, and to what desktop?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;With the advent of the real iPhone SDK and the AppStore, Apple managed to light a spark in the idea of creating applications once again. It's nothing new, this idea of creating applications instead of webpages, however the distribution model(AppStore) is "new". Suddenly everybody, designers, web-developers, marketing people.. the list goes on.. everybody is making iPhone applications. In most cases they are good apps, however in other cases there seem to be a lack of planning/thought ahead of launching xcode.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Why and when should you consider making your project into an application instead of a web-application? I always ask myself the following questions before making such a decision:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Does the application need to access local resources on the users computer?&lt;/li&gt;&lt;li&gt;Does the application need to exist outside the web-browser? Why?&lt;/li&gt;&lt;li&gt;Does the application rely on server storage completely?&lt;/li&gt;&lt;li&gt;Does the functionality ask for a custom UI?&lt;/li&gt;&lt;li&gt;What solution handles the users frustration level in the best way?&lt;/li&gt;&lt;li&gt;Does the IA need a page-based layout?&lt;/li&gt;&lt;li&gt;What's the degree of interaction required?&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;While contemplating these questions you would probably form an idea as to what is needed for your application to succeed.  But, bear in mind that most of the questions above result in solutions that can and will run fine in a browser. Trough RIA tools like &lt;a href="http://www.adobe.com/products/flex/"&gt;Flex&lt;/a&gt; and &lt;a href="http://www.sproutcore.com/"&gt;SproutCore&lt;/a&gt;, the most demanding UI demands can be met. But, if your application needs to do a lot of local file access, or it needs to exist outside a browser session... Imagine a chat client running only in the browser, it would be no good because you'd go offline when you closed the window.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;My advice would be this: Think about it.. are you presenting information that constantly updates, like a news site, why in gods green acres would you do that in an application, it screams web page! Remember that users pick their applications(no matter the platform) with much greater consideration and care than they pick websites to read/use. An application on the computer desktop or on any device needs to satisfy a need or solve a problem, be it something practical or a just game. An application exists forever, because you don't own it like you own your webpage. A webpage can be revoked and it will for all intense and purposes be gone from this world. An application is downloaded and cannot be removed unless the user decides to delete it.&lt;/div&gt;&lt;div&gt;Don't try to emulate a desktop application in a webpage if the application actually needs to exist on the users computer. Try to see if you idea fits into the following boxes, in this order:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Can I solve this using HTML/CSS?&lt;/li&gt;&lt;li&gt;Can I solve this using HTML/CSS and JavaScript&lt;/li&gt;&lt;li&gt;Should I solve this using SproutCore/Flex(or similar)?&lt;/li&gt;&lt;li&gt;Can I solve this without platform specific APIs?&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Here is what I would do:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Create a webpage&lt;/li&gt;&lt;li&gt;Create an advanced webpage&lt;/li&gt;&lt;li&gt;Create a RIA application running in the browser&lt;/li&gt;&lt;li&gt;Create a RIA/RAD application running in a cross platform runtime(AIR or Java)&lt;/li&gt;&lt;li&gt;Create a platform application&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Now, go do some real work, until next time.. cheerio!&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.red-sweater.com/blog/"&gt;&lt;span class="Apple-style-span"  style=" ;font-size:x-small;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-5386570928703596949?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/5386570928703596949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=5386570928703596949' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5386570928703596949'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5386570928703596949'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2009/05/why-and-when-to-break-out-of-browser.html' title='Why and when to break out of the browser'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-4750633842455942211</id><published>2009-04-25T19:11:00.006+02:00</published><updated>2009-04-26T21:49:33.443+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AIR'/><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><title type='text'>Generating a thumbnail and saving it to disk</title><content type='html'>&lt;div&gt;This quicktip will show you how to load an image from wherever and how to generate a thumbnail from that image and save it to the disk. In fact, you can use this method to generate screen dumps from any visual component from within Flex. &lt;/div&gt;&lt;div&gt;There are some considerations, first the actual scaling of an image can be done in several ways, the most used trough a scale Matrix. However, in this example I'll be utilizing the Flex library in order to scale the image using smoothing, thereby accomplishing a better result than with simply a Matrix.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's say I have loaded an image into a Flex Image component(myImg) and wish to generate a widescreen(16/9) thumbnail for it. &lt;/div&gt;&lt;div&gt;Load the image&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;myImg.source = "http://graphics8.nytimes.com/images/2006/12/28/business/28dog.xlarge1.jpg";&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When the image is finished loading(Event.COMPLETE) we generate the thumb at a size of 200x112&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;var orgBitmap:BitmapData = new BitmapData(myImg.contentWidth,myImg.contentHeight);&lt;/div&gt;&lt;div&gt;var thumb:BitmapData = new BitmapData(200,112);&lt;/div&gt;&lt;div&gt;orgBitmap.draw(myImg);//Get the orginal image&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;var scaleImg:Image = new Image();&lt;/div&gt;&lt;div&gt;scaleImg.load(new Bitmap(orgBitmap,"auto",true));//Set smoothing to true&lt;/div&gt;&lt;div&gt;scaleImg.content.width = 200;&lt;/div&gt;&lt;div&gt;scaleImg.content.height = 112;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;thumb.draw(scaleImg);//Here we have the scaled image data&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now we have scaled the image using the Image component in Flex which actually does smoothing on the image when scaled. Now we need to convert the bitmapdata into valid JPEG format.&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;var myjpeg:JPEGEncoder = new JPEGEncoder(80);//Set quality to 80&lt;/div&gt;&lt;div&gt;var thumbdata:ByteArray = myjepeg.encode(thumb);&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now we need to save it to disk(to desktop)&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;var fl:File = File.desktopDirectory.resolvePath("myimage.jpg");&lt;/div&gt;&lt;div&gt;var fls:FileStream = new FileStream();&lt;/div&gt;&lt;div&gt;fls.open(fl,FileMode.WRITE);&lt;/div&gt;&lt;div&gt;fls.writeBytes(thumbdata);&lt;/div&gt;&lt;div&gt;fls.close();&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There you have a smoothed thumbnail waiting for you on the desktop.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-4750633842455942211?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/4750633842455942211/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=4750633842455942211' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4750633842455942211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4750633842455942211'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2009/04/generate-thumbnail-in-air-application.html' title='Generating a thumbnail and saving it to disk'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-5356828793081621139</id><published>2008-12-03T21:57:00.001+01:00</published><updated>2008-12-03T21:59:04.785+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Coding the DocumentClass in Flex Builder</title><content type='html'>Since the dawn of Flash CS3, developers have been given the grace of the &lt;a href="http://www.actionscript.org/resources/articles/683/1/Using-Document-Classes-in-Flash-CS3-Professional/Page1.html"&gt;DocumentClass(explained)&lt;/a&gt;. The DocumentClass effectively replaces the «lets write all our code on frames» approach which, frankly was more of a hackers approach to coding within the Flash IDE. The main advantage of the DocumentClass is it's life outside of the Flash IDE, it's a separate .as file.&lt;br /&gt;However, there are some things to consider when jumping in to a project using the DocumentClass. One of these considerations must be, that the built in code editor in the Flash IDE, well..it's not the best environment in to be writing code. Alternative ActionScript editors exists, like &lt;a href="http://macromates.com/"&gt;TextMate(OS X)&lt;/a&gt; or &lt;a href="http://www.flashdevelop.org"&gt;FlashDevelop(Win)&lt;/a&gt;. But the far superior cross platform alternative in my opinion, is Flex Builder. FB is great for many reasons, mainly because it utilizes the power of the &lt;a href="http://www.eclipse.org/"&gt;Eclipse&lt;/a&gt; platform, an environment well known to Java and CF developers.&lt;br /&gt;In short, Flex Builder is a powerful coding environment. But there are some considerations to take when working with a DocumentClass to be exported trough Flash.. one of them is that Flex cannot see your instance names(objects on the stage) and give you code completion on them..in fact, it will complain and claim it's an error. This can be fixed in a jiffy..&lt;ul&gt;&lt;br /&gt;	&lt;li&gt;In Flash, open the project settings.&lt;/li&gt;&lt;br /&gt;	&lt;li&gt;Click the «Settings» button to the right of the «script» drop down&lt;/li&gt;&lt;br /&gt;	&lt;li&gt;Unckeck «Automatically declare stage instances»&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;Now Flex will let you declare your own instances from within the DocumentClass, like they where properties of the DocumentClass itself(which they are). However, you will need to define the instances as «public» properties/variables, so the Flash compiler can see them. Okay, time for an example.&lt;br /&gt;&lt;br /&gt;Let's say I have a blue movieclip on the stage with an instance name of "cheeseball". Here is how I access this movieclip from within my DocumentClass.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;package{&lt;br /&gt;	import flash.display.Sprite;&lt;br /&gt;	import flash.display.MovieClip;&lt;br /&gt;	&lt;br /&gt;	public class MainClass extends Sprite{&lt;br /&gt;		&lt;br /&gt;		public var cheeseball:MovieClip;//&lt;-----&lt;br /&gt;		&lt;br /&gt;		public function MainClass(){&lt;br /&gt;			trace("The name of the clip is "+cheeseball.name);&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;As you can see, the «cheeseball» movieclip on the stage is now accessed by defining it as a public property, making it visible to both Flash and Flex, giving you code completion, error checking and all kinds of wonderful things. Do this and your day will be shinier!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-5356828793081621139?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/5356828793081621139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=5356828793081621139' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5356828793081621139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5356828793081621139'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/12/coding-documentclass-in-flex-builder.html' title='Coding the DocumentClass in Flex Builder'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-2616517031959459977</id><published>2008-12-02T18:53:00.001+01:00</published><updated>2008-12-02T18:58:09.048+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>QuickTip: MOUSE_OVER vs ROLL_OVER</title><content type='html'>So, what is the difference between the MouseEvents, MOUSE_OVER and ROLL_OVER? The short answer is that MOUSE_OUT triggers when mousing over a child of the listener object, ROLL_OUT only triggers when leaving the listener objects bounding box. Consider the following code:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var sp:Sprite = new Sprite();&lt;br /&gt;sp.graphics.beginFill(0xFF0000);&lt;br /&gt;sp.graphics.drawRect(0,0,200,200);&lt;br /&gt;sp.graphics.endFill();&lt;br /&gt;&lt;br /&gt;var inner:Sprite = new Sprite();&lt;br /&gt;inner.graphics.beginFill(0x00FF00);&lt;br /&gt;inner.graphics.drawRect(0,0,50,50);&lt;br /&gt;inner.x = 75;&lt;br /&gt;inner.y = 75;&lt;br /&gt;sp.addChild(inner);&lt;br /&gt;addChild(sp);&lt;br /&gt;&lt;br /&gt;sp.addEventListener(MouseEvent.MOUSE_OVER, report);&lt;br /&gt;sp.addEventListener(MouseEvent.MOUSE_OUT, report);&lt;br /&gt;sp.addEventListener(MouseEvent.ROLL_OVER, report);&lt;br /&gt;sp.addEventListener(MouseEvent.ROLL_OUT, report);&lt;br /&gt;&lt;br /&gt;function report(evt:MouseEvent):void{&lt;br /&gt;	trace(evt.type);&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The sprite "inner" is a child of "sp". When rolling over "sp", both the MOUSE_OVER and the ROLL_OVER will trigger. However, when rolling over "inner", MOUSE_OUT will trigger, succeeded by MOUSE_OVER again. ROLL_OUT will not trigger when rolling over "inner". Test it out and it will all become clear!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-2616517031959459977?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/2616517031959459977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=2616517031959459977' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/2616517031959459977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/2616517031959459977'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/12/quicktip-mouseover-vs-rollover.html' title='QuickTip: MOUSE_OVER vs ROLL_OVER'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-8960228485228128398</id><published>2008-11-22T16:58:00.002+01:00</published><updated>2008-11-23T16:15:57.251+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='RIA'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Flash and Flex, bridging the gap</title><content type='html'>This post is a followup of my &lt;a href="http://kinderas.blogspot.com/2007/08/flash-vs-flex-what-to-choose-when.html"&gt;previous post&lt;/a&gt; regarding Flex and Flash. Although this is a followup, the focus has changed in parallel with the internal functionality and focus of Flex Builder and Flash. Back in august 2007, Flex and Flash existed in two different worlds, this is still the case, however now there are bridges between the two worlds.&lt;br /&gt;As a developer, Flex (Builder/Eclipse) is a tool far superior to the Flash editor from my point of view. But when it comes to flexible design, Flex Builder still brings little to none to the table. And as far as my understanding of Adobe strategy goes, this is done intentionally. Flash should be an animation and design tool, whereas Flex Builder focuses on the developers. Adobe does intentionally try to separate the two..smart move!&lt;br /&gt;&lt;br /&gt;What Adobe has done to amend for the intentional wedge driven in between Flash and Flex, is to create ways for developers to remain in Flex Builder while "importing" design created from within Flash. This is done trough bridging tools like the &lt;a href="http://help.adobe.com/en_US/Flash/10.0_UsingFlash/WSFD77A256-0DE1-46c7-86FB-CC4A8AE2EAA6.html#WS5F9A13A1-03CB-4a01-B467-0272D23A12D0"&gt;Flex component kit&lt;/a&gt; and the &lt;a href="http://help.adobe.com/en_US/Flash/10.0_UsingFlash/WSFD77A256-0DE1-46c7-86FB-CC4A8AE2EAA6.html#WS5F9A13A1-03CB-4a01-B467-0272D23A12D0"&gt;Flex component templates&lt;/a&gt;. This enables designers to stay in Flash(or any other CS product), using tools familiar to them, creating the design to be implemented via Flex. This approach to creating rich interactive content is much better than the old one involving big ass .fla files and no code help what so ever(almost). The snag is, when Adobe decides to change the approach of the designer developer workflow, change is also forced upon a bunch of Adobe/Macromedia users. To change their entire workflow may seem as a daunting task for many designers and developers. However this change is a change for the better, it's just a matter of dropping the conservative mindset.&lt;br /&gt;&lt;br /&gt;As of now, the Flex Component kit is the best way to prepare for the &lt;em&gt;real transition&lt;/em&gt; in my mind. You can of course go ahed and do lots of CSS styling in Flex builder, not a good idea unless there's only one person working on the project, as Flex builder is needed to see the design as a whole. The real transition is of course the introduction of &lt;a href="http://opensource.adobe.com/wiki/display/flexsdk/FXG+1.0+Specification"&gt;FXG&lt;/a&gt;, the new interchange format making it possible to do full designs in CS products, add interactivity in the upcoming &lt;a href="http://labs.adobe.com/technologies/flashcatalyst/"&gt;Flash Catalyst&lt;/a&gt;, then do the development in Flex Builder. In this way the different tools will keep their strengths and not worry about unrelated functionality, Flash becomes a design/animation tool and Flex a development tool exclusively. Like the current workflow of movie editing suites like FinalCut Studio, you will be able to use the FXG format to pass files back an forth between the designer and the developer, maintaining the focus, never worrying about stuff outside your field of your expertise. This is a long awaited and a big step for Adobe. Along with AIR, this move will in my opinion reinforce the FlashPlayer status as the goto&lt;em&gt;(pun intended)&lt;/em&gt; technology for cross-platform interactive content and development.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-8960228485228128398?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/8960228485228128398/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=8960228485228128398' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8960228485228128398'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8960228485228128398'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/11/flash-and-flex-bridging-gap.html' title='Flash and Flex, bridging the gap'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-1516006577027308923</id><published>2008-11-04T13:31:00.017+01:00</published><updated>2008-12-18T08:21:07.414+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Optimizing Flash performance</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;As Flash designers and developers get a hold of even more advanced tools and scripting languages, the need for performance considerations within flash projects become ever so apparent. Lately I've seen people complaining about flash apps that bug down their CPU and memory when visiting sites containing flash media. I see this problem as two parallel problems.&lt;br /&gt;&lt;br /&gt;1. Sites relying on advertisement (often flash banners) try to cram a gazillion banners and ads into every nook and cranny available on their site. This is simply greed, a condition for which I can offer no cure.&lt;br /&gt;&lt;br /&gt;2. The Flash editor has been an animation tool for quite some time. As a result, things common to other development platforms, like performance optimization, has not been and still isn't a priority in most Flash projects. However, this has started to change, something I will try to contribute into trough this post. So, let's get it on...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;General optimization&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;WMODE&lt;/span&gt;. First of all, if you don't have an amazingly good reason for using it, do not use wmode! In short, wmode is used to make the background of the swf file become transparent. Wmode will render the swf unreadable to screen readers, force the swf to run when on a hidden tab and make the content of your swf to render much more slowly than in normal mode. &lt;a href="http://www.kaourantin.net/2008/09/on-performance.html"&gt;Read more about this&lt;/a&gt; (Tinic Uro).&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Vectors and bitmaps&lt;/span&gt;. If you are animating a complex static vector, that is a vector that does not change it's content, e.g. a rectangle, then use the «cacheAsBitmap» property or simply use a bitmap instead. Let's say you are tweening a vector shape across the stage. The Flash-Player(FP) will have to recalculate all the vectors in the shape for every frame. For complex shapes, this will take up a lot of CPU cycles. With «cacheAsBitmap» turned on, the FP will calculate the vectors once, create a bitmap and re-render the bitmap instead. But do note this!! For vector shapes that are changing, not static, like lines that are constantly moving inside of a movieclip, if so..do not use «cacheAsBitmap». The reason for this is that FP now have to re-render both the changed vector shape AND create a new bitmap for every frame. So «cacheAsBitmap» is only good for static vector shapes.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;MovieClips&lt;/span&gt;. Not every shape needs to be a movieclip. If you need frames, you do need a movieclip, but if not, use a sprite(in ActionScript) or a Shape in the editor. Shapes does not have mouse and keyboard events and leave a much smaller memory imprint than MovieClips.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Alpha&lt;/span&gt;. Crop your artwork instead of using big ass areas of alpha channel. The FP do render the alpha channel areas even if you cannot see them.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Alpha video&lt;/span&gt;. A flv video encoded with an alpha channel using the On2Vp6 codec is about 4 times more complex to decode than one without the alpha channel. FP do not support alpha using H.264. &lt;a href="http://www.kaourantin.net/2005/08/performance-traps-in-flash-player-8.html"&gt;Read more&lt;/a&gt;.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;ActionScript optimization&lt;/span&gt;&lt;br /&gt;This section is on ActionScript 3 only and can get somewhat technical.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Strong typing&lt;/span&gt;. By typing your variables and functions the performance gain is substantial, in general 10 times faster. In AS3 the byte-code produced by the compiler actually changes based on typing. Also, strong typing makes it much easier to debug your app as the compiler will give more accurate debugger results. &lt;a href="http://www.onflex.org/ted/2006/09/max-actionscript-3-performance-tuning.php"&gt;More on this&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Numbers&lt;/span&gt;. Even though strong typing is quite easy to do, it's not always clear as to what type is the most efficient one. For numbers the «int» type is the speediest of the bunch, however «Number» does not lag far behind. However, it's smart to use «int» for iterations and situations where you are working on integers only as this will make debugging more effective. But do avoid «uint», unless you really need it. The «uint» type is a turtle compared to «Number» and «int». &lt;a href="http://www.gskinner.com/blog/archives/2006/06/types_in_as3_in.html"&gt;More on this here&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Local variables&lt;/span&gt;. If you are going to access a variable more than two times, store it in a local variable first. Local variables are faster because they do not require a lookup into objects. E.g:&lt;br /&gt;&lt;code&gt;var fName:String = person.firstname;&lt;br /&gt;if(fName == "jim" || fName == "jill")&lt;/code&gt;&lt;br /&gt;is faster than&lt;br /&gt;&lt;code&gt;if(person.firstname == "jim" || person.firstname == "jill")&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Data binding&lt;/span&gt;. Binding in Flex is a valuable and efficient way of handling data, however bindings do take up memory and they are general type. In other words bindings don't know what part of the data that will change, therefore all the data needs to be watched. If you are going the access the data only once or twice, it's better to do an manual assignment in code.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;That's all folks.. be sure to check out the links as well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-1516006577027308923?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/1516006577027308923/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=1516006577027308923' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/1516006577027308923'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/1516006577027308923'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/11/optimizing-flash-performance.html' title='Optimizing Flash performance'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-4999342933421563002</id><published>2008-08-18T08:25:00.003+02:00</published><updated>2008-08-18T08:39:11.203+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Quicktip:Event handling</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_wlEpKpwwGr0/SKkWYxR3uJI/AAAAAAAAAGs/DqKyv1IeCw8/s1600-h/Bilde+1.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_wlEpKpwwGr0/SKkWYxR3uJI/AAAAAAAAAGs/DqKyv1IeCw8/s320/Bilde+1.png" alt="" id="BLOGGER_PHOTO_ID_5235740656595875986" border="0" /&gt;&lt;/a&gt;I've been seeing a lot of this(image) following the launch of ActionScript 3. For me, having the debugger version of Flash Player installed it manifests as an error dialog box telling me that loading did never complete. If you don't have the debugger version of the Flash Player this will only result in the application stopping without any message.&lt;br /&gt;&lt;br /&gt;What puzzles me a bit is how often I see this error and the share number of professionally build Flash sites where this occurs. Now, this is completely avoidable. It's just a question of handling your events.&lt;br /&gt;&lt;br /&gt;Basically there are &lt;a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/URLLoader.html#eventSummary"&gt;6 event you handle&lt;/a&gt; when loading stuff over http(s). You don't actually need to do anything upon the occurrence of an event(however it is smart to do so), you simply need to handle it in order to avoid FP throwing an error shown above. Do this and your app will feel so much more well made to the end user.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-4999342933421563002?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/4999342933421563002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=4999342933421563002' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4999342933421563002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4999342933421563002'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/08/quicktipevent-handling.html' title='Quicktip:Event handling'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_wlEpKpwwGr0/SKkWYxR3uJI/AAAAAAAAAGs/DqKyv1IeCw8/s72-c/Bilde+1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-8707842580032631890</id><published>2008-06-03T22:00:00.006+02:00</published><updated>2008-06-04T08:27:22.365+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>Sound visualizer using SoundMixer</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_wlEpKpwwGr0/SEY1vkZ2yPI/AAAAAAAAAFs/vO1aKGGVziw/s1600-h/vis.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_wlEpKpwwGr0/SEY1vkZ2yPI/AAAAAAAAAFs/vO1aKGGVziw/s200/vis.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5207909110442805490" /&gt;&lt;/a&gt;&lt;br /&gt;This time you'll get a complete class drawing a visualizer graph for the sound playing(or, actually the bytes in the sound). You can show the graph as a raw sound wave or as grouped by frequency(where a &lt;a href="http://en.wikipedia.org/wiki/Fourier_transform"&gt;fourier&lt;/a&gt; transformation has been applied). This is just a simple demo, but you can separate out different frequencies to get some really cool effects. Play around with it and see what you get. PS: You do need to provide your own sound ;-)&lt;br /&gt;&lt;code&gt;&lt;br /&gt;package  {&lt;br /&gt;import flash.display.GradientType;&lt;br /&gt;import flash.display.MovieClip;&lt;br /&gt;import flash.events.Event;&lt;br /&gt;import flash.media.Sound;&lt;br /&gt;import flash.media.SoundMixer;&lt;br /&gt;import flash.net.URLRequest;&lt;br /&gt;import flash.utils.ByteArray;&lt;br /&gt;&lt;br /&gt;[SWF(width='512',height='300',backgroundColor='0x000000',frameRate='30')]&lt;br /&gt;&lt;br /&gt;public class SpectrumTest extends MovieClip{&lt;br /&gt;&lt;br /&gt;private var _eql:Boolean = true;//Show as grouped by frequenzy&lt;br /&gt;private var _completeGraph:Boolean = false;//Complete graph fill&lt;br /&gt;private var _spikeAmp:uint = 100;//Amplifier for graph peaks&lt;br /&gt;private var _graphFill:Array = new Array(0xFF0000, 0xFFDF21);//Colorfill for graph&lt;br /&gt;&lt;br /&gt;private var _soundBytes:ByteArray;&lt;br /&gt;&lt;br /&gt;public function SpectrumTest(){&lt;br /&gt;var s:Sound = new Sound(new URLRequest("yoursoundfile.mp3"));&lt;br /&gt;s.play(0, 3);&lt;br /&gt;this._soundBytes = new ByteArray();&lt;br /&gt;this.addEventListener(Event.ENTER_FRAME, drawGraphHandler);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private function drawGraphHandler(evt:Event):void{&lt;br /&gt;graphics.clear();&lt;br /&gt;graphics.clear();&lt;br /&gt;graphics.beginGradientFill(GradientType.LINEAR, this._graphFill, [1,1],[0,255]);&lt;br /&gt;graphics.moveTo(-1, 150);&lt;br /&gt;            &lt;br /&gt;                  //Get the bytes&lt;br /&gt;SoundMixer.computeSpectrum(this._soundBytes,this._eql);&lt;br /&gt;&lt;br /&gt;for(var i:uint=0; i&lt;(stage.stageWidth * .5); i++){     &lt;/code&gt;&lt;div&gt;&lt;code&gt;var num:Number = -this._soundBytes.readFloat() * this._spikeAmp + stage.stageHeight * .5;     &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;graphics.lineTo(i*2, num);    &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;}    &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;if(this._completeGraph){     &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;graphics.lineTo(512, 300);     &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;graphics.lineTo(0, 300);     &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;graphics.lineTo(-1, 150);    &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;}   &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;}  &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;}  &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;} &lt;/code&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-8707842580032631890?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/8707842580032631890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=8707842580032631890' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8707842580032631890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8707842580032631890'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/06/sound-visualizer-using-soundmixer.html' title='Sound visualizer using SoundMixer'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_wlEpKpwwGr0/SEY1vkZ2yPI/AAAAAAAAAFs/vO1aKGGVziw/s72-c/vis.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-3879633385936598699</id><published>2008-05-01T19:36:00.003+02:00</published><updated>2008-05-01T19:46:30.699+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Briefly: SWF and FLV formats opens up</title><content type='html'>Adobe has announced the &lt;a href="http://www.adobe.com/openscreenproject/developers/"&gt;Open Screen Project&lt;/a&gt; which will be one big step in the openness direction of the SWF and FLV file formats. In practice this means that you can build your own Flash player, or an FLV flayer. So, iPhone Flash player anyone?&lt;div&gt;&lt;a href="http://blog.digitalbackcountry.com/?p=1404"&gt;Ryan Stewart &lt;/a&gt;has written a more &lt;a href="http://blog.digitalbackcountry.com/?p=1404"&gt;in depth explanation&lt;/a&gt; on what this announcement means.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-3879633385936598699?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/3879633385936598699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=3879633385936598699' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3879633385936598699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3879633385936598699'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/05/briefly-swf-and-flv-formats-goes-open.html' title='Briefly: SWF and FLV formats opens up'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-7436223246283708621</id><published>2008-04-20T21:35:00.005+02:00</published><updated>2011-02-08T22:55:52.098+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Quicktip: Skewing an image using ActionScript 3</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_wlEpKpwwGr0/SAuePpwsg_I/AAAAAAAAAFk/NaVVCnHaevg/s1600-h/Bilde+1.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5191416987219952626" src="http://4.bp.blogspot.com/_wlEpKpwwGr0/SAuePpwsg_I/AAAAAAAAAFk/NaVVCnHaevg/s200/Bilde+1.png" style="cursor: hand; cursor: pointer; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br /&gt;So you want to skew an image, or a MovieClip or perhaps any other DisplayObject. You could do this manually in the Flash editor of course, but what if you need to do it dynamically, or in Flex.. Here is how.&lt;br /&gt;&lt;div&gt;&lt;code&gt;//If you&amp;nbsp;prefer&amp;nbsp;to draw one visually,&amp;nbsp;skip&amp;nbsp;down&lt;br /&gt;/*var target:MovieClip = new MovieClip();&lt;br /&gt;target.graphics.beginFill(0x000000);&lt;br /&gt;target.graphics.lineTo(100,0);&lt;br /&gt;target.graphics.lineTo(100,100);&lt;br /&gt;target.graphics.lineTo(0,100);&lt;br /&gt;target.graphics.lineTo(0,0);&lt;br /&gt;target.graphics.endFill();&lt;br /&gt;//center it on the stage&lt;br /&gt;target.x = stage.stageWidth *.5-50;&lt;br /&gt;target.y = stage.stageHeight *.5-50;&lt;br /&gt;//add the mc to the stage&lt;br /&gt;addChild(target);*/&lt;br /&gt;/*****/&lt;br /&gt;//Set the skewing angle&lt;br /&gt;var degX:Number = 15;&lt;br /&gt;var degY:Number = 15;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;//Get the transform matrix for the object to skew&lt;br /&gt;var m:Matrix = target.transform.matrix;&lt;br /&gt;m.b = Math.tan(degY *(Math.PI/180));&lt;br /&gt;m.c = Math.tan(degX +(Math.PI/180));&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;//Apply the matrix to the&amp;nbsp;transform&amp;nbsp;object&lt;br /&gt;var t:Transform = new Transform(target);&lt;br /&gt;t.matrix = m;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;//Apply the skew&lt;br /&gt;target.transform = t;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;Looks like a lot of code, but remember that the first 10 lines of code(not counting comments) are just to draw a MovieClip onto the center of the stage. The actual skew is&amp;nbsp;achieved&amp;nbsp;in just 8 lines of code.&lt;br /&gt;&lt;div&gt;When applying this to a movieclip it will look something like the image in the top of the post.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-7436223246283708621?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/7436223246283708621/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=7436223246283708621' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7436223246283708621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7436223246283708621'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/04/quicktip-skewing-image-using.html' title='Quicktip: Skewing an image using ActionScript 3'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_wlEpKpwwGr0/SAuePpwsg_I/AAAAAAAAAFk/NaVVCnHaevg/s72-c/Bilde+1.png' height='72' width='72'/><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-5216522301436539065</id><published>2008-03-27T21:42:00.007+01:00</published><updated>2008-03-27T22:07:30.018+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Quicktip: Ducking local security in FlashPlayer</title><content type='html'>Ever needed to test a swf containing networking residing on your local hard drive? Sure, you can choose to export for only network from the publish menu in Adobe Flash. But what if you need to load some movies locally and then make a connection to your remote server at the same time? Well, out of the box, you can't. But wait, there is a simple solution to allow flash player to do both when playing locally. Only tree easy steps..&lt;br /&gt;&lt;br /&gt;1. Open your favorite texteditor(&lt;a href="http://www.barebones.com/products/bbedit/"&gt;BBEdit&lt;/a&gt;, &lt;a href="http://www.panic.com/coda/"&gt;Coda&lt;/a&gt;, &lt;a href="http://macromates.com/"&gt;Textmate&lt;/a&gt;..) and create a new textfile. At the first line, type the path of the folder where your project resides, e.g.&lt;span class="Apple-style-span" style="color: rgb(204, 102, 0);"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;/Users/username/myproject&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;2. Save the file with a .cfg extension to: &lt;span class="Apple-style-span" style="color: rgb(255, 102, 0); font-style: italic; "&gt;/Library/Application Support/Macromedia/FlashPlayerTrust/&lt;/span&gt;&lt;div&gt;&lt;br /&gt;3. There is no step 3&lt;br /&gt;&lt;br /&gt;Note: You &lt;i&gt;can&lt;/i&gt; do this for your entire user account, but I strongly recommend not to do so, cos this will allow not trusted files to run both networking and local command on your computer if you download them. You don't want that.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-5216522301436539065?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/5216522301436539065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=5216522301436539065' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5216522301436539065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5216522301436539065'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/03/quicktip-ducking-local-security-in.html' title='Quicktip: Ducking local security in FlashPlayer'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-5582882162297630370</id><published>2008-03-20T23:36:00.003+01:00</published><updated>2008-03-21T12:18:55.545+01:00</updated><title type='text'>Briefly: New Layout</title><content type='html'>So, I decided to change the layout. More mobile device friendly layout, not more to say on that issue&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-5582882162297630370?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/5582882162297630370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=5582882162297630370' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5582882162297630370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5582882162297630370'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/03/briefly-new-layout.html' title='Briefly: New Layout'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-8942986564107702463</id><published>2008-03-13T23:01:00.006+01:00</published><updated>2008-03-14T00:40:18.548+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Quicktip: Avoiding popup blockers in AS3</title><content type='html'>Adobe/Macromedia did change a couple of things as the release of ActionScript 3 became a reality.&lt;div&gt;For once, it's not as easy as it once was to open an external browser window. There are many solutions to this floating around, many of them involve using the "wmode" parameter in the HTML embed code for the swf. In my opinion this is not a good idea cos it will bring a bunch of new problems with it, like handling textfields and so on. I've written a possible solution for this problem which works using standard embed code in the HTML. It simply tries to use the ExternalInterface, if that fails, it falls back to navigateToURL. Hey, remember to import ExternalInterface, URLRequest and NavigateToURL in order for it to compile properly.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;private function openURL(url:String, window:String = "_blank") : void {&lt;br /&gt;   var WINDOW_OPEN_FUNCTION:String = "window.open";&lt;br /&gt;   if(!ExternalInterface.call(WINDOW_OPEN_FUNCTION, url, window)){&lt;br /&gt;       navigateToURL(new URLRequest(url),window);&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&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/7239447129918882627-8942986564107702463?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/8942986564107702463/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=8942986564107702463' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8942986564107702463'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8942986564107702463'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/03/quicktip-avoiding-popup-blocker-in-as3.html' title='Quicktip: Avoiding popup blockers in AS3'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-7761952218366466513</id><published>2008-02-28T22:36:00.025+01:00</published><updated>2008-04-10T21:35:20.815+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Voyage'/><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>What I've done</title><content type='html'>So.. time to show off some actual results of my work I suppose. The idea is to publish new projects as they emerge. But as some old Chinese dude once said: «Things Takes Time». In layman's terms that about sums to: "I haven't got anything new to show you just yet". In the meantime I'll present thee with some "old" projects in which I have held the part of developer. Note that these projects where not created solely by me, I merely did the development part of it. To read more about some of the people involved in making these projects please visit &lt;a href="http://voyagedigital.com/"&gt;Voyagedigital.com.&lt;/a&gt;&lt;br /&gt;Due credits also to Kjartan over at &lt;a href="http://madebykjartan.no/"&gt;madebykjartan&lt;/a&gt; for his exquisite web-design in the «lenka» project. There are many more I'm sure..please don't sue me or go into a wild rampage if I forgot to mention your name ;-)&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_wlEpKpwwGr0/R8crSU921OI/AAAAAAAAAEY/g-MvOudNMpo/s1600-h/Freia.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://1.bp.blogspot.com/_wlEpKpwwGr0/R8crSU921OI/AAAAAAAAAEY/g-MvOudNMpo/s320/Freia.jpg" alt="" id="BLOGGER_PHOTO_ID_5172150290924098786" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;Freia 2007&lt;/span&gt;&lt;br /&gt;This project was developed by using Flash 8 and ActionScript 2, which where the cutting edge at the time. I know, hard to imagine AS2 cutting anything whatsoever.. Anyway, some of the features included a totally physics driven ragdoll game, where the purpose was to avoid enemies and win the princess. Hey! It's not original, but darn tutting cool.&lt;a href="http://work.voyage.no/2007/freia/"&gt; Click here to watch it live.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_wlEpKpwwGr0/R8crT0921PI/AAAAAAAAAEg/UjKmPIWx-eM/s1600-h/lenka.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://3.bp.blogspot.com/_wlEpKpwwGr0/R8crT0921PI/AAAAAAAAAEg/UjKmPIWx-eM/s320/lenka.jpg" alt="" id="BLOGGER_PHOTO_ID_5172150316693902578" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;Lenka (The Chain)&lt;/span&gt;&lt;br /&gt;A project with a goal of actually helping people, which was a real inspiration. This was my first Actionscript 3 project and therefore one should be kind in evaluating it's effectiveness and robustness!&lt;br /&gt;Thinking back, this project should have been done using Flex, but we ended up doing it in the first release of Flash 9. Smart? Well.. But hey.. it still rocks! (offline)&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_wlEpKpwwGr0/R8crUE921QI/AAAAAAAAAEo/zWrr8sSndDE/s1600-h/steinar2006.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://4.bp.blogspot.com/_wlEpKpwwGr0/R8crUE921QI/AAAAAAAAAEo/zWrr8sSndDE/s320/steinar2006.jpg" alt="" id="BLOGGER_PHOTO_ID_5172150320988869890" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;Menn og kreft 2006 (Men and chancer)&lt;/span&gt;&lt;br /&gt;This was done in Flash 8 and AS2, and boy did this project get fat. Tons of cartoons loading and cellular services adjoined by a fully fledged online video editor with exporting features.  Basically we worked our collective asses of making it, and by golly it's slow to load..but still, it's worth it.. mostly because of Runes (The Art Director) way cool character design. &lt;a href="http://mennogkreft.no/sjekk"&gt;Watch it live here.&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;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_wlEpKpwwGr0/R8crUU921RI/AAAAAAAAAEw/GIiGegVvh9U/s1600-h/steinar2007.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://1.bp.blogspot.com/_wlEpKpwwGr0/R8crUU921RI/AAAAAAAAAEw/GIiGegVvh9U/s320/steinar2007.jpg" alt="" id="BLOGGER_PHOTO_ID_5172150325283837202" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;Menn og kreft 2007(Men and cancer 2007)&lt;/span&gt;&lt;br /&gt;The project was a followup to the project above, only this time Rune had hatched a completely spanking new and exiting idea. «How to live life», as told by a cartoon midget with a sassy attitude. This time done in Flash 9 and Actionscript 3, much more smooth and lightweight that the previous year. And to top it off, the amazing "kick my ass" game. &lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;It's the black button in the middle.&lt;br /&gt;&lt;/span&gt;&lt;a href="http://mennogkreft.no/"&gt;&lt;span style="font-size:100%;"&gt;Click here to watch Steinar go bananas&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;That's some of them. Sorry they're all in norwegian, but still, you don't have to read the text you know. Well, I'll be back with more incredibe nerdy stuff at a later moment in time.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-7761952218366466513?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/7761952218366466513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=7761952218366466513' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7761952218366466513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7761952218366466513'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/02/what-ive-done-some.html' title='What I&apos;ve done'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_wlEpKpwwGr0/R8crSU921OI/AAAAAAAAAEY/g-MvOudNMpo/s72-c/Freia.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-5453221823341741703</id><published>2008-02-28T20:43:00.003+01:00</published><updated>2008-02-28T20:57:31.645+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><title type='text'>Quicktip: Changing the font in Flex 3 editor</title><content type='html'>Have you ever wanted to turn enlarge that font size in the code editor in Flex builder 2/3, but have thrown in the towel after several hours poking around to find this setting? Since Flex is build on Eclipse, this part of the editor is actually identical to the Eclipse interface. To change the font, choose &lt;code&gt;Window -&gt; Preferences -&gt; General -&gt; Appearance -&gt; Colors and fonts.&lt;/code&gt;&lt;div&gt;In that small list of folders, choose &lt;code&gt;Basic -&gt; Text font&lt;/code&gt; and hit the change button. Tada! Kinda a lot of effort, but it will be worth it in assisting your eyes from squinting all day long.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And hey, while we're at it. If you are starting to type something in the code editor, but can't quite remember the whole variable name or whatever... hit ctrl+ spacebar. Flex will then make a suggestion. This is a very handy feature as well..&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/7239447129918882627-5453221823341741703?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/5453221823341741703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=5453221823341741703' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5453221823341741703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/5453221823341741703'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/02/quicktip-changing-font-in-flex-3-editor.html' title='Quicktip: Changing the font in Flex 3 editor'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-7595280199395110043</id><published>2008-01-24T16:07:00.000+01:00</published><updated>2008-01-24T16:28:16.159+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>Quicktip: Actionscript 3 and number bases</title><content type='html'>"Oh my God, he's writing about numbers, how boooring!".. I bet you're thinking something like that right now, but hang on, this isn't really about numbers, it's about colors and all the cool things you can make em do.&lt;div&gt;So what does number bases has to do with colors? Well, in this exact moment you are looking at several colors, and at least two color models. The most commonly used on webpages, hexadecimal colors, like #FFFFFF or 0xffffff (in Flash/flex). In fact, hexadecimal means 16 based, as opposed to decimal or 10 based like we're used to (0-9). This is kinda good to know, because.. let's say you want your flash app to sample some colors from a picture and present the colors to a web-designer in a hexadecimal format.. how would you go about converting the premultiplied color value Flash gives you into an usable hex color?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's say you sample the color white, Flash gives you 16777215, completeley useless for a designer. Let's transform that value into a hex color in one line:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/div&gt;&lt;div&gt;var myWhiteColor:uint = 16777215;&lt;/div&gt;&lt;div&gt;trace(myWhiteColor.toString(16));&lt;/div&gt;&lt;div&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;And there you go, Flash spits out "ffffff". This happes because the toString method takes the radix or number base as a parameter and converts the passed number. To reverse the conversion you'd use &lt;code&gt;parseInt("0xffffff")&lt;/code&gt;, that would give you the original premultiplied color value.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-7595280199395110043?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/7595280199395110043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=7595280199395110043' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7595280199395110043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7595280199395110043'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2008/01/quicktip-actionscript-3-and-number.html' title='Quicktip: Actionscript 3 and number bases'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-4636120650024855199</id><published>2007-12-12T21:01:00.000+01:00</published><updated>2008-01-17T15:45:09.455+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='RIA'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='ui'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Tip: Tracking you Flash/Flex site[UPDATED]</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_wlEpKpwwGr0/R2A-U17pDhI/AAAAAAAAADs/KtyDB9NaxYU/s1600-h/images.jpeg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_wlEpKpwwGr0/R2A-U17pDhI/AAAAAAAAADs/KtyDB9NaxYU/s320/images.jpeg" border="0" alt="" id="BLOGGER_PHOTO_ID_5143179302252645906" /&gt;&lt;/a&gt;There's a lot of fuzz surrounding this topic. So why should we bother with tracking what users do to our applications and games on the web? Well, there's a lot of reasons for doing this, however the main motivation should be to gain knowledge about the user friendliness of you creation. Do the user understand how to use the site/app, or does he give up after a short try? If your in the advertising business there also be alternate motives, but then you'd probably know what you're looking for..so.. I'm just going to outline &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;how&lt;/span&gt; to track you app.&lt;div&gt;The first thing you need to do is to head over to Google Analytics(GA) or a similar service unless you want to develop you own tracking system, something I will not touch with a ten feet fork in this article..&lt;/div&gt;&lt;div&gt;GA is pretty straight forward to set up, and once you have managed to set up tracking on the html page that will host your swf file it's time to get into the clever stuff. The thing is, to track something from ActionScript 1/2 vs AS3 are two different things. In AS2 you would simply use the &lt;code&gt;getURL("javascript:pageTracker._trackPageview('myTrackingPoint');")&lt;/code&gt;. This will then add a tracking point called «myTrackingPoint» to GA, in AS3 it will look like this: &lt;code&gt;ExternalInterface.call("pageTracker._trackPageview","myTrackingPoint")&lt;/code&gt;. This difference can be traced back to that AS3 has a different and much more powerful interface to talk to JavaScript.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To use this in an effective manner I highly suggest using some kind of folder structure when tagging your apps. Like e.g. if you have 5 buttons in your main menu, then track them like so:&lt;/div&gt;&lt;div&gt;&lt;code&gt;ExternalInterface.call("pageTracker._trackPageview","mainmenu/button_home");&lt;/code&gt;&lt;/div&gt;&lt;div&gt;In this case GA will create a folder structure which makes navigating within the GA report much more useful.&lt;/div&gt;&lt;div&gt;Okay.. now your on your own..&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-4636120650024855199?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/4636120650024855199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=4636120650024855199' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4636120650024855199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4636120650024855199'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/12/tip-tracking-you-flashflax-site.html' title='Tip: Tracking you Flash/Flex site[UPDATED]'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_wlEpKpwwGr0/R2A-U17pDhI/AAAAAAAAADs/KtyDB9NaxYU/s72-c/images.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-3320001476631947425</id><published>2007-11-02T23:51:00.000+01:00</published><updated>2007-11-03T20:54:34.080+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='RIA'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='ui'/><title type='text'>User friendliness - a matter of taste?</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_wlEpKpwwGr0/RyzEJiSNRLI/AAAAAAAAADg/BCf5SQRcUx4/s1600-h/fitts-steps.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_wlEpKpwwGr0/RyzEJiSNRLI/AAAAAAAAADg/BCf5SQRcUx4/s200/fitts-steps.jpg" alt="" id="BLOGGER_PHOTO_ID_5128689743769191602" border="0" /&gt;&lt;/a&gt;Sneaking about on the WWW I tend to find all these articles dealing with something the authors call user friendliness in computer programs. Most of the articles deal in the differences between the OS X interface and the Windows interface. But they often tend to generalize, thereby and hence talking about user interface design in general. And that's nice, that people care about how things look, but that's also the problem. 90% of the articles dealing in user interface design focus on visual design. Now, visual design is only a small part of the user interface. Indulge me while I explain why it's important to know this.&lt;br /&gt;&lt;br /&gt;User interface design is not if that button should be red or blue, or it's that too, but not only. The isolation of visual elements is called graphical design, which is something quite different from user interface design. Since my field of interest lie within the world of RIA applications, I'll use this as my point of origin for this statement.&lt;br /&gt;When you sit down on your trusted behind and start thinking about how your RIA application should behave, you need to take into consideration the following elements: IA/SD, UID/HMI and GD. So, that's a lot of nice not disclosing concepts, here's what they mean.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;IA - Information architecture. SD - System design(systemization):&lt;/span&gt;&lt;br /&gt;In RIA development, these two are actually the same thing. In other areas like website development, IA will adhere to a slightly different path than SD, but in most cases, and in this case, they are the same thing.&lt;br /&gt;The science of expressing a model or a concept of an entire system is the shortest possible definition of these concept I cold come up with on the fly. This means using a modeling approach to break down large amounts of data to a more readable format in which logical paths of data can be seen in the development and design of the application. In others words, trying to predict the users movement trough the system. This approach lays the foundation for usability and findability in applications, websites and databases.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;UID - User interface design. HMI - Human machine interaction:&lt;/span&gt;&lt;br /&gt;Like IA and SD, UID and HMI also go hand in hand, the only difference lies in more empirical approach of UID, while HMI is much more theoretical. UID is, as the expression denotes, a collection of rules on how to design the user interface of your application, like buttons and boxes and stuff. The rules that make up UID are derived from HMI principles, like Fitts' law, reaction time and so forth. Let me stress this point, these rules are measurable data, it is not a matter of taste. The HMI principles are built upon years of research into human physiology, psychology and human habits. So when the UID principle state that the OS X menubar on the top of the screen is a better way to go than attaching the menubar to each and every window(Windows), we know this because we can actually prove it trough a HMI principle. And therefor we simply adheres to the UID/HMI principles when designing an interface.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;GD - Graphical design:&lt;/span&gt;&lt;br /&gt;This is not a matter of taste either. Surprised? Well, GD is kinda a matter of taste, but there are lot's of rules in this area too. It's a reason why you are reading this black text on a white background you know. Graphical designers knows that this work, and they stick to it most of the time. In this area you encounter subjects like readability, fonts and so on. But do not get me wrong, graphical designers do not only deal in colors and fonts, they also need to know stuff from the UID area, how else would that know how to design a button that the user actually will understand how to click.. The transition between UID and GD is blurred, and I think it should be. The result of all these fields coming together will result in a efficient, understandable, beautiful and intuitive user interface.&lt;br /&gt;&lt;br /&gt;So here is my point in all of this. You cannot simply look at an application and say that it's ugly and therefore it must it can't be user friendly.. it may very well be extremely user friendly. And then again, a really pretty application with fancy stuff in it may be completely useless. User friendliness is not a matter of taste, it's a matter of skill and knowledge, plus a touch of magic.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-3320001476631947425?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/3320001476631947425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=3320001476631947425' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3320001476631947425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/3320001476631947425'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/11/user-friendliness-matter-of-taste.html' title='User friendliness - a matter of taste?'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_wlEpKpwwGr0/RyzEJiSNRLI/AAAAAAAAADg/BCf5SQRcUx4/s72-c/fitts-steps.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-403250677677223862</id><published>2007-10-31T21:00:00.000+01:00</published><updated>2007-10-31T23:07:24.236+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='os x'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='Apple'/><title type='text'>No way to dodge it - The Leopard review</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_wlEpKpwwGr0/Ryj0w3uVvtI/AAAAAAAAADY/KMm3GaAR6Zc/s1600-h/index_hero20071016.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://3.bp.blogspot.com/_wlEpKpwwGr0/Ryj0w3uVvtI/AAAAAAAAADY/KMm3GaAR6Zc/s200/index_hero20071016.png" alt="" id="BLOGGER_PHOTO_ID_5127617296190521042" border="0" /&gt;&lt;/a&gt;&lt;span style="text-decoration: none;"&gt;So here it is, the worlds most advanced OS, Apples &lt;a href="http://www.apple.com/macosx/"&gt;OS X 10.5&lt;/a&gt; Leopard. By now it has already been written a bunch of reviews into the crooks and crannies of Leo, so this will not be a feature tour of the entire OS, click the link at the top to experience that. Instead I'll take a brief look at what's important to me in this release, and why I plunged straight into it and upgraded both my Macs to run OS X 10.5.&lt;br /&gt;&lt;br /&gt;My main excitement in this release was in the new &lt;a href="http://www.apple.com/macosx/features/mail.html"&gt;Mail&lt;/a&gt; application.. yeah, geeky right? But the ability to take notes, create todos, and have everything beautifully organized and synced with a simple IMAP account was a very appealing idea to me. And boy do I use it, I love the new Mail application, not so much the stationaries perhaps, but everything else comes of as much more efficient and polished compared to earlier releases. So I did expect Mail to be great one might say, but I did not expect &lt;a href="http://www.apple.com/macosx/features/finder.html"&gt;CoverFlow&lt;/a&gt; to be as handy as it turns out to be. This is the ability to see your documents and files as content previews ordered in a sort of shuffle stack mode. Incredibly handy when browsing media files! And it's all powered by &lt;a href="http://www.apple.com/macosx/features/quicklook.html"&gt;QuickLook&lt;/a&gt;, the new brilliant way of presenting the content of any file, anywhere. You no longer get an icon for a document type, you get an actual preview of what's inside of the document instead, and further more.. a touch of the space bar and voila, full screen preview of any file without opening a single program.&lt;br /&gt;&lt;br /&gt;Any bad stuff then? Of course there is, Apple makes mistakes like any other company developing a piece of software spanning millions of lines of code. However, not many mistakes in this release. Some people are arguing that the dock and the menu bar has a weird graphical appearance.. well, the thing is, people always fear change, and this is one such case in my opinion. There is nothing wrong with the new &lt;a href="http://www.apple.com/macosx/features/desktop.html"&gt;desktop&lt;/a&gt;, it's just different.&lt;br /&gt;&lt;br /&gt;If you need one reason besides those already mentioned to upgrade; &lt;a href="http://www.apple.com/macosx/features/300.html#spotlight"&gt;Spotlight&lt;/a&gt;! It's blazingly fast and you can search any shared computer.&lt;br /&gt;&lt;br /&gt;A more in depth review of Leopard can be found at&lt;a href="http://arstechnica.com/reviews/os/mac-os-x-10-5.ars/"&gt; Ars Technica&lt;/a&gt;.&lt;/span&gt;&lt;div&gt;&lt;a href="http://arstechnica.com/reviews/os/mac-os-x-10-5.ars/"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-403250677677223862?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/403250677677223862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=403250677677223862' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/403250677677223862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/403250677677223862'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/10/no-way-to-dodge-it-leopard-review.html' title='No way to dodge it - The Leopard review'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_wlEpKpwwGr0/Ryj0w3uVvtI/AAAAAAAAADY/KMm3GaAR6Zc/s72-c/index_hero20071016.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-2843538443520656727</id><published>2007-09-26T21:37:00.001+02:00</published><updated>2007-09-26T22:08:36.982+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='os x'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='ui'/><title type='text'>Review: Pixelmator</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_wlEpKpwwGr0/Rvq1MJFR3zI/AAAAAAAAADQ/nisWtvBjMh0/s1600-h/Bilde+1.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_wlEpKpwwGr0/Rvq1MJFR3zI/AAAAAAAAADQ/nisWtvBjMh0/s200/Bilde+1.png" alt="" id="BLOGGER_PHOTO_ID_5114599547033739058" border="0" /&gt;&lt;/a&gt;The brand spanking new &lt;a href="http://pixelmator.com/"&gt;Pixelmator&lt;/a&gt; from the &lt;a href="http://pixelmator.com/company/"&gt;Dailide&lt;/a&gt; brothers adds a new member to Delicious generation software pool. So, this is an image editor app for OS X, utilizing Apples core image processing routines. It's not a Photoshop replacement, yet. But it has the potential of becoming one.&lt;br /&gt;&lt;br /&gt;I'm a vigorous Photoshop user, so naturally I'm accustomed to the tools provided to me in that app. Containing in that mode, Pixelmator was a no brainer, the menus and tools where almost exactly where I expected them to be located. There is one huge difference in the UI though.. Pixelmator is far better than Photoshop, not only does it look prettier, it's also more logical, cleaner and does make for a sleeker experience. You won't get scared when being presented with the Pixelmator interface, you'll go "vow, way cool man!". Where when opening Photoshop for the first time you'll go "ehm, do I really need this".&lt;br /&gt;&lt;br /&gt;However.. this is the first release of Pixelmator, and it is slow.. sometimes too slow, even on my iMac Core2Duo. Photoshop is much faster..and that matters. But as a whole I do believe that Pixelmator will become a Photoshop competitor..in time. Check it out at &lt;a href="http://www.pixelmator.com"&gt;www.pixelmator.com&lt;/a&gt;!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-2843538443520656727?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/2843538443520656727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=2843538443520656727' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/2843538443520656727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/2843538443520656727'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/09/review-pixelmator.html' title='Review: Pixelmator'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_wlEpKpwwGr0/Rvq1MJFR3zI/AAAAAAAAADQ/nisWtvBjMh0/s72-c/Bilde+1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-4543697837249120810</id><published>2007-09-22T15:56:00.000+02:00</published><updated>2007-09-22T16:09:37.340+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='os x'/><category scheme='http://www.blogger.com/atom/ns#' term='humor'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><category scheme='http://www.blogger.com/atom/ns#' term='Apple'/><title type='text'>Windows better on Macs? Is Apple getting greedy? And leave Steve Jobs alone!</title><content type='html'>An intriguing &lt;a href="http://stevenf.com/2007/09/macs_really_do_run_windows_better.php"&gt;blog post&lt;/a&gt; by Steven Frank co creator of &lt;a href="http://www.panic.com/"&gt;Panic software&lt;/a&gt;, discussing if Windows runs better on a Mac. He also shares some insight into why OS X is in fact a better OS compared to Windows.&lt;br /&gt;&lt;br /&gt;Also, veteran Will Shipley from &lt;a href="http://delicious-monster.com/"&gt;DeliciousMonster&lt;/a&gt; thinks &lt;a href="http://wilshipley.com/blog/2007/09/iphone-ipod-contain-or-disengage.html"&gt;Apple is getting greedy&lt;/a&gt;, is he right? Lot's of good stuff in his post.&lt;br /&gt;&lt;br /&gt;But of course, our all time favorite Apple fan &lt;a href="http://tastyblogsnack.com/"&gt;Justine&lt;/a&gt;, just wants us to leave Steve Jobs alone.&lt;br /&gt;&lt;script src="http://flash.revver.com/player/1.0/player.js?mediaId:404399;affiliateId:0;height:372;width:460;" type="text/javascript"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-4543697837249120810?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/4543697837249120810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=4543697837249120810' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4543697837249120810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4543697837249120810'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/09/windows-better-on-macs-is-apple-getting.html' title='Windows better on Macs? Is Apple getting greedy? And leave Steve Jobs alone!'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-2534333394010485724</id><published>2007-09-09T12:27:00.000+02:00</published><updated>2007-09-09T12:29:17.409+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='humor'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><title type='text'>Anti piracy</title><content type='html'>&lt;object height="300" width="375"&gt;&lt;param name="movie" value="http://www.youtube.com/v/MTbX1aMajow"&gt;&lt;param name="wmode" value="transparent"&gt;&lt;embed src="http://www.youtube.com/v/MTbX1aMajow" type="application/x-shockwave-flash" wmode="transparent" height="300" width="375"&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/7239447129918882627-2534333394010485724?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/2534333394010485724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=2534333394010485724' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/2534333394010485724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/2534333394010485724'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/09/anti-piracy.html' title='Anti piracy'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-6033018897720756229</id><published>2007-09-02T22:02:00.000+02:00</published><updated>2007-09-02T22:52:48.473+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft'/><title type='text'>Embrace, extend and extinguish</title><content type='html'>The three e's, Embrace, Extend and Extinguish. Not many people besides those already up into their neck in nerdyness knows what this term describes. In short, this is a term used by Microsoft to describe their strategy to do a hostile takeover in areas of the computer industry where standards are widely in use..like the Internet. The term was actually first made public by the &lt;a href="http://en.wikipedia.org/wiki/United_States_Department_of_Justice"&gt;U.S. Department of Justice&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It works like this: You enter a product category, e.g. the www with a browser. Let's call it Internet Explorer. This is the embrace part, when you enter the area, seemingly on fair terms. But then, when your browser has become widespread, then you start to add &lt;a href="http://en.wikipedia.org/wiki/Proprietary_software"&gt;proprietary&lt;/a&gt; abilities to it. Let's call it ActiveX for example. These new features does of course implement functionality not found in competing products, like other browser, and therefore companies will start to use this closed technology, for example for online movie rental. But wait, isn't this a great thing, adding features to browsers.. Sure, except the technology added is closed, so no other browser can ever support it. And then, we enter the final stage. Since the MS browser now has all these features not supported by other browsers and there is a de facto monopoly in some areas of browser technology, like DRM video.. this gives MS the power to extinguish the competition. And this is why IE is the most widespread browser in the world... &lt;a href="http://en.wikipedia.org/wiki/Embrace%2C_extend_and_extinguish"&gt;E.E.E&lt;/a&gt;.&lt;br /&gt;&lt;blockquote&gt;In 2004, to prevent a repeat of the "browser wars," and the resulting morass of conflicting standards, Apple (makers of Safari), Mozilla (makers of Firefox), and Opera (makers of the Opera browser) formed the Web Hypertext Application Technology Working Group to create open standards to complement those of the World Wide Web Consortium. Microsoft has so far refused to join, citing the group's patent policy, which requires that all proposed standards be possible to implement on a royalty-free basis.&lt;/blockquote&gt;&lt;br /&gt;But why do they do this? It's not like they need the money, and IE is a free browser..so no money to make there. The thing is, the business strategy utilized by Microsoft is based on markedshare. Unlike other companies like Apple and Sun, which base their business plan on profit, Microsoft move money around from areas where they make the money to areas where they loose, all to gain markedshare. The idea is to run competitors into the ditch using size and brute force, effectively creating a closed standard like in the case of Microsoft Office. This way Microsoft don't have to worry about the profitability or quality of their product, people have to buy them, cos there is no other alternative.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-6033018897720756229?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/6033018897720756229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=6033018897720756229' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/6033018897720756229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/6033018897720756229'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/09/embrace-extend-and-extinguish.html' title='Embrace, extend and extinguish'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-4508931137767897618</id><published>2007-09-02T15:12:00.000+02:00</published><updated>2007-09-02T15:58:57.459+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='humor'/><title type='text'>Medal of Homer</title><content type='html'>&lt;object width="320" height="280" class="BLOG_video_class" id="BLOG_video-2e43aeb0d5126114" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;&lt;param name="movie" value="http://www.youtube.com/get_player"&gt;&lt;param name="bgcolor" value="#FFFFFF"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="flashvars" value="flvurl=http://v22.nonxt4.googlevideo.com/videoplayback?id%3D2e43aeb0d5126114%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1330269420%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D165D5542F6A8140523C5E7B310E5D168A33FB6EE.3A19B48A52675FBFFEDF8E1CBBFED3D8324AE45B%26key%3Dck1&amp;amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3D2e43aeb0d5126114%26offsetms%3D5000%26itag%3Dw160%26sigh%3DtqxXSifC46QL0Iomm0nnQXG0VKo&amp;amp;autoplay=0&amp;amp;ps=blogger"&gt;&lt;embed src="http://www.youtube.com/get_player" type="application/x-shockwave-flash"width="320" height="280" bgcolor="#FFFFFF"flashvars="flvurl=http://v22.nonxt4.googlevideo.com/videoplayback?id%3D2e43aeb0d5126114%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1330269420%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D165D5542F6A8140523C5E7B310E5D168A33FB6EE.3A19B48A52675FBFFEDF8E1CBBFED3D8324AE45B%26key%3Dck1&amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3D2e43aeb0d5126114%26offsetms%3D5000%26itag%3Dw160%26sigh%3DtqxXSifC46QL0Iomm0nnQXG0VKo&amp;autoplay=0&amp;ps=blogger"allowFullScreen="true" /&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;"The Simpsons game, coming this fall. To every platform ever made!"&lt;/blockquote&gt;&lt;br /&gt;Priceless!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-4508931137767897618?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='enclosure' type='video/mp4' href='http://www.blogger.com/video-play.mp4?contentId=2e43aeb0d5126114&amp;type=video%2Fmp4' length='0'/><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/4508931137767897618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=4508931137767897618' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4508931137767897618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4508931137767897618'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/09/medal-of-homer.html' title='Medal of Homer'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-6471774357017712091</id><published>2007-08-29T21:53:00.000+02:00</published><updated>2007-09-02T22:57:50.853+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Quicktip: Getting the GET params in ActionScript</title><content type='html'>So, you want to get the content of a GET variable, like «http://nytimes.com/?id=dork» the id from the URL of that web page. Using a server side script like PHP in conjunction with ActionScript you can use $_GET['id'] and print that to a FlashVars on the page in which the swf file is embedded. That sounds like a tedious solution, and what if you can't control the server side scripting? Well, good news, using the spanking new ExternalInterface api for ActionScript 3 we can get the id value passing a bit of JavaScript.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var myStr:String = ExternalInterface.call("window.location.search.substring", 1);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Note that this will accually give you the entire string "id=dork", so you will have to split it on the equal sign.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var myParams:Array = myStr.split("=");&lt;br /&gt;var param:String = myParams[1];&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;There you have it.. no server side scripting, only ActionScript and javaScript, all from within the one swf file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-6471774357017712091?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/6471774357017712091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=6471774357017712091' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/6471774357017712091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/6471774357017712091'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/08/quicktip-getting-get-params-in.html' title='Quicktip: Getting the GET params in ActionScript'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-725352036194502106</id><published>2007-08-28T20:03:00.000+02:00</published><updated>2007-08-28T22:27:06.644+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RIA'/><category scheme='http://www.blogger.com/atom/ns#' term='ui'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><title type='text'>Fitts' law and RIA</title><content type='html'>To my amazement, it seems like the usage of &lt;a href="http://ei.cs.vt.edu/%7Ecs5724/g1/"&gt;Fitts' law&lt;/a&gt; in Internet applications and websites is a rather controversial topic these days. There are critics out there claiming that Fitts' law is an old and outdated approach to designing user interface elements.&lt;br /&gt;Well.. the law of gravity is also getting old, but guess what.. it's still relevant. I really don't insinuate that Fitts' law and the law of gravity are the same, but the point being made here is that Fitts' law is just that, a law describing physical movement. This is not an idea made up by a besserwisser trying to revolutionize the UI of computers. I believe that the biggest problem with Fitts' law, is the fact that most people working in UI design, and particularly in RIA and web design, have either little or no knowledge of the actual content of Fitts' law.&lt;br /&gt;&lt;br /&gt;So what is it? In short, Fitts' law is model describing human movement. It was described by Paul Fitts back in 1954. Despite to popular belief, Fitts' law isn't all about making things bigger on screen. As this is a part of the law, the actual formula describes the relationship between distance between the starting point and the target, and the size of the target. And you have something called infinite width, which I will describe in more detail later.&lt;br /&gt;&lt;br /&gt;Mathematically speaking the law states that «Time = a + b log2(D/S+1)». Where D is the distance from where your cursor is currently at to the target, and S is the width of the target. The a and the b are constants. It's not that hard now is it, but yet extremely powerful when taken in to use. So how do we use it? Let's start of with the words of &lt;a href="http://www.asktog.com/basics/firstPrinciples.html#fittsLaw"&gt;Bruce Tognazzini&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-size:85%;"&gt;While at first glance, this law might seem patently obvious, it is one of the most ignored principles in design. Fitts' law (properly, but rarely, spelled "Fitts' Law") dictates the Macintosh pull-down menu acquisition should be approximately five times faster than Windows menu acquisition, and this is proven out.&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;What TOG is talking about here is the infinite width. What that means is that, like in the Macintosh &lt;a href="http://en.wikipedia.org/wiki/Menu_bar"&gt;menubar&lt;/a&gt;, the menu is at the top of the screen, always. This will let the user move his cursor at full speed to the top of the screen, because no matter if the user keeps pushing the mouse upwards, the cursor will stay in the same place, hence making a target of infinite width.&lt;br /&gt;&lt;br /&gt;But let's drop the Os X vs Windows crap. Let's instead concentrate on how to apply the principles of Fitts' law to our RIA apps and web sites. Now note that these are only my suggestions on how to apply Fitts' law, so please do your own research. My opinions are largely based on my studies of &lt;a href="http://en.wikipedia.org/wiki/Human-Computer_Interaction"&gt;HCI&lt;/a&gt; from the &lt;a href="http://www.ntnu.no/portal/page/portal/eksternwebEN/"&gt;university&lt;/a&gt; and later experiences in building applications, &lt;a href="http://lenka.no/"&gt;RIA apps&lt;/a&gt; and web sites.&lt;br /&gt;&lt;br /&gt;1. Contextual menus. If you are going to build a contextual menu, make it a pie menu. I don't really like contextual menus, because they hide the interface from the user, but it seems they're here to stay so let's make the best of it. Well, a pie menu will be faster than a dropdown menu. The reason for this is that you minimize the distance the cursor have to travel by centering the menu under the cursor at creation time. Additionally, pie pieces make for bigger targets than lines of text in a drop down menu.&lt;br /&gt;&lt;br /&gt;2. Buttons. Group your buttons together in that order the user is most likely to use them. Commonly used buttons should be bigger and more accessible that less important and less used functions.&lt;br /&gt;&lt;br /&gt;3. Dialogs. Attach your dialog windows to the window it belongs to. In this way, the user will know where the dialog will appear and the movement can therefor be "trained". Fitts' law doesn't actually describe trained movements at all, but this is important in conjunction with "the easy to hit target", this explains it's relevance in this context.&lt;br /&gt;&lt;br /&gt;4. Edges. If you are in control of the mouse pointer. E.G a full screen app. Then make use of the edges to place important UI elements. Edges are much easier to navigate to because of the infinite width. But don't use both horizontal/vertical edges of the screen so the user need to move the cursor over the entire width..that would be bad. For both right and left handed people, the upper left edge of the screen is the spot most easily navigated to.&lt;br /&gt;&lt;br /&gt;5. Drag and drop. Since the muscle tension increase when doing drag and drop operations(holding mouse button pressed), it's a good idea to minimize the distance the user has to drag something to drop it. You could for example pupup a drop-box next to the item when the drag operation starts, hence minimizing the distance.&lt;br /&gt;&lt;br /&gt;In my opinion, Fitts' law is an easy to implement principle that requires some thought and consideration, but it's worth it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-725352036194502106?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/725352036194502106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=725352036194502106' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/725352036194502106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/725352036194502106'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/08/fitts-law-and-ria.html' title='Fitts&apos; law and RIA'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-8410252594013785667</id><published>2007-08-26T13:59:00.000+02:00</published><updated>2007-08-26T14:00:46.629+02:00</updated><title type='text'>Something different</title><content type='html'>&lt;object width="249" height="203"&gt;&lt;param name="movie" value="http://www.noendinsightmovie.com/trailer.swf"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;embed src="http://www.noendinsightmovie.com/trailer.swf" type="application/x-shockwave-flash" wmode="transparent" width="400" height="240"&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/7239447129918882627-8410252594013785667?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/8410252594013785667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=8410252594013785667' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8410252594013785667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/8410252594013785667'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/08/something-different.html' title='Something different'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-2248995267739391409</id><published>2007-08-21T21:49:00.000+02:00</published><updated>2007-08-23T08:08:55.158+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>Follow up: Flash and H.264[updated]</title><content type='html'>As a follow up to my &lt;a href="http://kinderas.blogspot.com/2007/08/youtubes-secret-move.html"&gt;recent article&lt;/a&gt; concerning my guess that YouTube was moving over to the H.264 codec, leaving the Adobe flv format behind. Well, it looks like it's true, kinda.. only not. Today Adobe announced in a &lt;a href="http://home.businesswire.com/portal/site/google/index.jsp?ndmViewId=news_view&amp;newsId=20070820006124&amp;amp;newsLang=en"&gt;press release&lt;/a&gt; support for the H.264 codec within the Adobe Flash Player version 9.x. Adobe also adds support for HE-AAC which is a part of the MPEG-4 standard like H.264. The press release do not mention in specific words on what wrapper will be supported. Will Flash Player add support for QuickTime directly, or more likely, will the H.264 codec be wrapped by the flv format. [Update: After reviewing and testing the new Flash  player it is now clear that it does indeed support all h.264 formats, m4v, mov and so on. There is no new API to be used, you can use it directly trough the netstream object like you would with any flv file]&lt;br /&gt;&lt;br /&gt;This is really great news for Flash developers as this release laster this fall will make users adapt the updated Flash Player at a faster rate, due to the almost inevitable adoption of this codec by YouTube and other online based video providers. The added support for H.264 will also mean the utilization of HD video from within Flash based apps and presentations.&lt;br /&gt;&lt;br /&gt;A beta will be released today at &lt;a href="http://labs.adobe.com/"&gt;labs.adobe.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-2248995267739391409?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/2248995267739391409/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=2248995267739391409' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/2248995267739391409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/2248995267739391409'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/08/follow-up-flash-and-h264.html' title='Follow up: Flash and H.264[updated]'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-7035239184212080185</id><published>2007-08-15T21:17:00.000+02:00</published><updated>2007-08-15T21:42:55.878+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Quicktips'/><title type='text'>Quicktip: Flipping an image in Actionscript</title><content type='html'>Ever needed to flip a dynamically loaded image in Flash or Flex? Like for making mirror effects and so on..&lt;br /&gt;There is no property in ActionScript 3  called "flipImage", but there is one easy way to do it.&lt;br /&gt;&lt;br /&gt;In AS3, to flip an image horizontally, go like so:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var flipper:MovieClip = new MovieClip();&lt;br /&gt;//Load your image into the flipper MC&lt;br /&gt;flipper.scaleX = -1;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;This works because you're actually resizing the image beyond zero, literately turning it inside out.&lt;br /&gt;PS: This will not work with components, like the UILoader.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-7035239184212080185?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/7035239184212080185/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=7035239184212080185' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7035239184212080185'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7035239184212080185'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/08/quicktip-flipping-image-in-actionscript.html' title='Quicktip: Flipping an image in Actionscript'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-1562296119891130036</id><published>2007-08-15T20:13:00.002+02:00</published><updated>2008-11-18T22:13:34.711+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionScript'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='RIA'/><category scheme='http://www.blogger.com/atom/ns#' term='ui'/><title type='text'>Flash vs Flex, what to choose when</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_wlEpKpwwGr0/RsNDzaHJcOI/AAAAAAAAADE/mSXdW8velPk/s1600-h/flaflex.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 155px; height: 75px;" src="http://4.bp.blogspot.com/_wlEpKpwwGr0/RsNDzaHJcOI/AAAAAAAAADE/mSXdW8velPk/s200/flaflex.jpg" alt="" id="BLOGGER_PHOTO_ID_5098993753575223522" border="0" /&gt;&lt;/a&gt;If you're a &lt;a href="http://kinderas.blogspot.com/2007/08/ria-rich-internet-application.html"&gt;ria&lt;/a&gt; developer like me you've probably encountered this situation at least once. You have this somewhat large project to do, there are lots of interactive elements to it and the target format is swf. If you don't already know this, both &lt;a href="http://www.adobe.com/products/flash/"&gt;Adobe Flash&lt;/a&gt; and &lt;a href="http://www.adobe.com/products/flex/"&gt;Adobe Flex&lt;/a&gt; delivers in the swf format, the same player and all. The only real difference dwells in the approach in which you choose to take developing the finished product. My approach to this would be to first define what kind of project this will be. Will this end up to be a presentation (1), driven by animations and not so much depended on user interaction to work. Or will it become a (2) true ria application, containing lots of interactivity and projecting a user depended interface.&lt;br /&gt;&lt;br /&gt;In the first case, your choice should be Flash, as this tool has a timeline and is in fact intended for online presentations with some interactivity. Flash is great for presenting video, small games and other project that can be clearly defined as more depended on the designer rather than the developer.&lt;br /&gt;&lt;br /&gt;In the second case you could in fact go for Flash as well, which will be slow and horrible, but it will do the job and the end product will most likely end up looking almost identical. However, when doing developer driven project, the tool used should be a developer tool. Enter Adobe Flex. The UI of Flex is dramatically different from Flash, focusing on code to a much larger extend and totally abandoning the timeline. Because Flex is build like any other developer tool, like &lt;a href="http://www.apple.com/macosx/features/xcode/"&gt;xCode&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/vstudio/"&gt;Visual Studio&lt;/a&gt;, most developers will feel much more familiar with the UI of Flex. Another thing to consider is development time. Since Flex features layout elements made especially for making applications, it much easier to set up an UI that will shrink to fit the needs of the user. And Flex has even more trick up it sleeves, it can handle swf's exported from Flash. So really, you can have the designer make custom elements all the way trough and set it up visually in Flex. However, most designers will probably end up using Flex powerful CSS support instead, as it's quicker and makes for a more consistent user interface.&lt;br /&gt;&lt;br /&gt;The difficult thing here isn't really to convince a designer to work in Flex, or a developer to work in Flash.. the hard thing is to define which is the right tool for the project you're currently working on. Well, good luck with that then ;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-1562296119891130036?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/1562296119891130036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=1562296119891130036' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/1562296119891130036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/1562296119891130036'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/08/flash-vs-flex-what-to-choose-when.html' title='Flash vs Flex, what to choose when'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_wlEpKpwwGr0/RsNDzaHJcOI/AAAAAAAAADE/mSXdW8velPk/s72-c/flaflex.jpg' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-6607954208009421622</id><published>2007-08-11T14:30:00.001+02:00</published><updated>2007-08-12T21:28:32.077+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Video'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><title type='text'>YouTubes secret move</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_wlEpKpwwGr0/Rr3-oKHJcLI/AAAAAAAAACs/0q5DLX1BnRg/s1600-h/transition.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://1.bp.blogspot.com/_wlEpKpwwGr0/Rr3-oKHJcLI/AAAAAAAAACs/0q5DLX1BnRg/s320/transition.png" alt="" id="BLOGGER_PHOTO_ID_5097510319115825330" border="0" /&gt;&lt;/a&gt;&lt;a href="http://youtube.com/"&gt;YouTube&lt;/a&gt; is a great service that allows people to both upload and watch videos. The thing which makes YouTube stand out from all other similar services, is the  substantial implementation of so called social tools, like commenting and rating functions. However, even though YouTube is an immensely popular service, it has one problem: Video quality. The videos seen on YouTube are often in bad shape even before they are &lt;a href="http://en.wikipedia.org/wiki/Transcode"&gt;transcoded&lt;/a&gt; into the &lt;a href="http://en.wikipedia.org/wiki/Flv"&gt;Flash video format (flv)&lt;/a&gt;. To encode a video into the flv format, one most commonly would use the &lt;a href="http://en.wikipedia.org/wiki/On2_Technologies"&gt;On2&lt;/a&gt;Vp6 codec, so does YouTube. Even though this codec is substantially better that the &lt;a href="http://en.wikipedia.org/wiki/Sorenson"&gt;Sorenson&lt;/a&gt; Sparc which it replaces, Vp6 do produce grainy and bad picture quality at low bitrates.&lt;br /&gt;&lt;br /&gt;Now something is stirring within YouTube as a response to this quality issue. If you've been following along into the dealings of Apple Inc. lately you'd notice that they have released a score of products closely integrated with YouTube. Both &lt;a href="http://en.wikipedia.org/wiki/Appletv"&gt;AppleTv&lt;/a&gt; and the oh so fantastic &lt;a href="http://en.wikipedia.org/wiki/Iphone"&gt;iPhone&lt;/a&gt; both hold YouTube functionality. But.. none of them have the ability to play back the flash format. Lately, the newly risen &lt;a href="http://en.wikipedia.org/wiki/ILife"&gt;iLife&lt;/a&gt; 08 (&lt;a href="http://en.wikipedia.org/wiki/Imovie"&gt;iMovie&lt;/a&gt;) also include the choice of publishing your movie directly to YouTube. No doubt this functionality is a result of Apple and Google being in cahoots(Google is the owner of YouTube), but the interesting part here is that all Apple products which can upload to and download from YouTube utilizes the &lt;a href="http://en.wikipedia.org/wiki/H264"&gt;H.264&lt;/a&gt; codec from the &lt;a href="http://en.wikipedia.org/wiki/Moving_Picture_Experts_Group"&gt;MPEG&lt;/a&gt; group.&lt;br /&gt;&lt;br /&gt;Since the H.264 codec is far superior to the On2Vp codec and the H.264 is open to everybody, there are now some speculation YouTube is slowly converting it's material to be encoded into H264 instead of Flash. This would mean a significant gain in quality for YouTube material, and could be a necessity if YouTube is to target home entertainment systems with large monitors.&lt;br /&gt;&lt;br /&gt;I think this would be a smart move by YouTube, because let's face it, Flash video isn't exactly impressive in it's quality versus size ratio. But, as YouTube and services like are the driving force behind getting people to upgrade their Flash plugins, this may entail that Flash designers and developers will have to dig into &lt;a href="http://en.wikipedia.org/wiki/Quicktime"&gt;QuickTime&lt;/a&gt; development, as QuickTime is the only real alternative for playing H.264 video online today. Well..let's get to it then..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-6607954208009421622?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/6607954208009421622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=6607954208009421622' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/6607954208009421622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/6607954208009421622'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/08/youtubes-secret-move.html' title='YouTubes secret move'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_wlEpKpwwGr0/Rr3-oKHJcLI/AAAAAAAAACs/0q5DLX1BnRg/s72-c/transition.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-1186927944841323046</id><published>2007-08-09T22:48:00.000+02:00</published><updated>2007-08-12T21:27:23.968+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iLife'/><category scheme='http://www.blogger.com/atom/ns#' term='os x'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='Web 2.0'/><title type='text'>Making all others look like amateurs</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_wlEpKpwwGr0/Rrt_BKHJcHI/AAAAAAAAACM/B0PeofmsLHo/s1600-h/Bilde+1.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_wlEpKpwwGr0/Rrt_BKHJcHI/AAAAAAAAACM/B0PeofmsLHo/s320/Bilde+1.png" alt="" id="BLOGGER_PHOTO_ID_5096807061170778226" border="0" /&gt;&lt;/a&gt;So, once again Apple rocked the community with a full score of new apps, ranging from the most excellent iLife '08 to the gigantic and extremely well written Web 2.0 app called .Mac Web Gallery. Everything appears to been in development for several years, however they did it in one year. And in a couple of months &lt;a href="http://www.apple.com/macosx/leopard/"&gt;Leopard&lt;/a&gt; will arise as well. Compare that to Microsoft's five year Vista "experiment". So how the heck are they able to do this time and time again, staying ahead..&lt;br /&gt;The answer is so simple..&lt;br /&gt;&lt;br /&gt;If you have read or watched Apples "Think different commercial" you already know why Apple stands out to this extent. The people that actually build their software, engineers like &lt;a href="http://en.wikipedia.org/wiki/Scott_Forstall"&gt;Scott Forstall&lt;/a&gt;, designers like &lt;a href="http://en.wikipedia.org/wiki/Mike_Matas"&gt;Mike Matas&lt;/a&gt;, they aren't exactly what you would call an average software developer. The front most profiles, the decision-makers within Apple are front-runners for OpenSource development, they often come from small independent ideological companies like &lt;a href="http://delicious-monster.com/"&gt;Delicious Monster&lt;/a&gt; and &lt;a href="http://www.omnigroup.com/"&gt;OmniGroup&lt;/a&gt;. Not what you would expect from a company making it's living by making software and hardware. Other similar companies keep their cards close, for good reason. If you make an invention you can't simply make it available for all, then it can be copied and suddenly you're out of customers..right? Well, Apple has realized that if you find the best people in the world, and somehow manage to combine their talents, others will find it hard to follow, no matter if their holding the source code.&lt;br /&gt;&lt;br /&gt;"..no respect for the status quo" it says at line 8 of "&lt;a href="http://en.wikipedia.org/wiki/Think_Different"&gt;Think different&lt;/a&gt;". And this is exactly why Apple have so devoted fans, because they really change things. They don't make something that people buy and then sit back and look at the money flooding in, they keep on working, making things better..&lt;br /&gt;&lt;br /&gt;It's very exiting to see Apple moving into the Web development community in full force now. Well, really they where one of the first to make use of the old HTTPRequest extention, now cleverly named AJAX. (&lt;a href="http://gallery.mac.com/emily_parker"&gt;see web gallery&lt;/a&gt;)&lt;br /&gt;.Mac Web Gallery is really a desktop app on a website. It mirrors &lt;a href="http://www.apple.com/ilife/iphoto/"&gt;iPhoto&lt;/a&gt; perfectly, and it can do everything &lt;a href="http://www.flickr.com/"&gt;Flickr&lt;/a&gt; can, and then some. The focus is in great design and great functionality, making things easy to use, removing the typical "website look" and replacing it with a familiar and logical design derived from the desktop apps. And of course, all metaphors that exist in the desktop app, browsing, mosaic and the  new "skimming", they are all reflected onto the web app. This makes for a familiar and consistent user interface. Cos that is what we really want, something we just can use, not learn to use.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-1186927944841323046?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/1186927944841323046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=1186927944841323046' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/1186927944841323046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/1186927944841323046'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/08/making-all-others-look-like-amateurs.html' title='Making all others look like amateurs'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_wlEpKpwwGr0/Rrt_BKHJcHI/AAAAAAAAACM/B0PeofmsLHo/s72-c/Bilde+1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-7277046156880984809</id><published>2007-08-07T00:38:00.000+02:00</published><updated>2007-08-07T00:50:08.473+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='os x'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><title type='text'>The future of the Internet</title><content type='html'>This post is merely to underline on my previous claim that desktop applications are really the future of the internet. As you know, if your read my last posting, I tend to think that the cloud will work more or less like a giant back-end system in the future. That is, you have the experience of an desktop app and the content of the internet, all at once. And yea, here are two dudes whom think so too ;-)&lt;br /&gt;&lt;br /&gt;&lt;embed src="http://services.brightcove.com/services/viewer/federated_f8/452319854" bgcolor="#FFFFFF" flashvars="videoId=958571821&amp;playerId=452319854&amp;amp;viewerSecureGatewayURL=https://services.brightcove.com/services/amfgateway&amp;servicesURL=http://services.brightcove.com/services&amp;amp;cdnURL=http://admin.brightcove.com&amp;domain=embed&amp;amp;autoStart=false&amp;amp;" base="http://admin.brightcove.com" name="flashObj" seamlesstabbing="false" type="application/x-shockwave-flash" swliveconnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" height="380" width="454"&gt;&lt;/embed&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-7277046156880984809?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/7277046156880984809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=7277046156880984809' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7277046156880984809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/7277046156880984809'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/08/future-of-internet.html' title='The future of the Internet'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7239447129918882627.post-4871505494914128045</id><published>2007-08-04T23:56:00.000+02:00</published><updated>2007-08-05T23:44:05.750+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='ui'/><title type='text'>RIA - Rich Internet Application</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_wlEpKpwwGr0/RrZDZqHJcDI/AAAAAAAAABs/OlegK-w7ibc/s1600-h/Bilde+1.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://4.bp.blogspot.com/_wlEpKpwwGr0/RrZDZqHJcDI/AAAAAAAAABs/OlegK-w7ibc/s200/Bilde+1.png" alt="" id="BLOGGER_PHOTO_ID_5095334136496353330" border="0" /&gt;&lt;/a&gt;According to &lt;a href="http://en.wikipedia.org/wiki/Rich_internet_application"&gt;Wikipedia&lt;/a&gt;: "Rich Internet Applications are Web applications that look and behave like desktop applications." I totally agree, and therein lies the conundrum. Web-designers and web-developers alike have their way of doing things, and so has application designers and developers. Even thought they all are in the same business, the application approach to things have a somewhat longer history to rely upon. The web-developer approach really didn't come into play until the middle of the 1990's. By then application developers already had clocked in about 10 years of experience creating software and UI design. But the much anticipated clash of the different groups of developers and designers was never to come, for the simple reason that they where doing different things in different places. That is, until now. These days it's not longer enough to master "tagging" and Photoshop to satisfy the needs of clients wanting to blow away competitors online. And with the introduction of such tools as &lt;a href="http://en.wikipedia.org/wiki/Adobe_Flex"&gt;Adobe Flex&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Microsoft_Expression_Blend"&gt;Microsoft Blend&lt;/a&gt; the www is rapidly heading towards application design and development. I haven't forgotten about Google and their go for JavaScript &lt;a href="http://en.wikipedia.org/wiki/Ajax_%28programming%29"&gt;AJAX&lt;/a&gt; development, however, that's somewhat outside of the scope of this, as it largely remains web-development.&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_wlEpKpwwGr0/RrZDsaHJcEI/AAAAAAAAAB0/QLmDGhtnjhY/s1600-h/xcode.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: right; cursor: pointer;" src="http://3.bp.blogspot.com/_wlEpKpwwGr0/RrZDsaHJcEI/AAAAAAAAAB0/QLmDGhtnjhY/s200/xcode.jpg" alt="" id="BLOGGER_PHOTO_ID_5095334458618900546" border="0" /&gt;&lt;/a&gt;To develop an application for the web versus the development for an OS, are two different worlds by far. There is not only the technical aspect of filesystems, hardware and low level programming versus the high level web development strategy, it's also the heavily fortified rules of user interface design existing in application development. On the other hand, app developers escape the headaches of making sure their app can run alike in all browsers.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;My take on this is to take the best of both sides. UI design guidelines have come a long way on the client side of things. The Apple design manual can by it self carry the entire weight of the user experience. However, the freedom expressed by some web-designers, the ability to throw out old concepts and bring in new ones is something we should have in the mix, as long as these new ideas conform to established truths about what people actually do in front of a screen. Regarding development, I do firmly believe that pure web-developers have a lot to learn from application developers in the fields of efficiency and security.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://4.bp.blogspot.com/_wlEpKpwwGr0/RrY7xqHJcCI/AAAAAAAAABk/XOqktsamQ7o/s200/070531_GatesJobs_wide.hlarge.jpg" alt="" id="BLOGGER_PHOTO_ID_5095325752720191522" border="0" /&gt;&lt;/div&gt;&lt;div&gt;The problem that still remain, is the speed of the evolution in RIA design. Most people do not have enough computing power to run high end RIA applications. The reason for this is the inefficient browser and the plug in architecture. In a recent &lt;a href="http://www.msnbc.msn.com/id/18970439/site/newsweek/"&gt;interview&lt;/a&gt; with Bill Gates and Steve Jobs (yes, together), this question was brought up. Those two disagree on many things, but one thing stood out that they both truly believed in. They argued that in the future the Internet will function more like a giant database, a back end system while the front end part will be handled by client apps running naively on the system of the user. Thereby effectively removing the problem of bad user experience. They make a good point. The thing is, you cannot leap into the future online, cos you can't be sure that people will be able to follow you. And it looks like many developer companies have came to the same realization, just take a look at &lt;a href="http://labs.adobe.com/wiki/index.php/Apollo"&gt;Air (Apollo)&lt;/a&gt;, it's Adobes way of moving application development away from the web and onto the desktop, but at the same time keeping the multi platform Flash development environment.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For the future I predict that the web will keep it's role as a place to get information, to advertise and a place to play. But for bigger more complex things I believe that people, given time, will notice the better user experience and the share speed a desktop app can provide. A good example is Apples Google maps client on the iPhone. It's a client running on a phone that actually outperforms the original Google maps client by a factor of ten. As people become more tech capable, they'll demand more, and then we whom are designers and developers should hear their call.. or crash and burn.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7239447129918882627-4871505494914128045?l=kinderas.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kinderas.blogspot.com/feeds/4871505494914128045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7239447129918882627&amp;postID=4871505494914128045' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4871505494914128045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7239447129918882627/posts/default/4871505494914128045'/><link rel='alternate' type='text/html' href='http://kinderas.blogspot.com/2007/08/ria-rich-internet-application.html' title='RIA - Rich Internet Application'/><author><name>Jørn Kinderås</name><uri>https://profiles.google.com/108096126966139796846</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-iiTh_pJXAL4/AAAAAAAAAAI/AAAAAAAAAAA/trIIv5fUzoI/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_wlEpKpwwGr0/RrZDZqHJcDI/AAAAAAAAABs/OlegK-w7ibc/s72-c/Bilde+1.png' height='72' width='72'/><thr:total>1</thr:total></entry></feed>
