<?xml version="1.0" encoding="iso-8859-1"?><!-- generator="b2evolution/3.3.3" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Richard Leggett on New Media</title>
		<link>http://richardleggett.co.uk/blog/index.php</link>
		<atom:link rel="self" type="application/rss+xml" href="http://richardleggett.co.uk/blog/index.php?tempskin=_rss2" />
		<description>Richard Leggett on New Media</description>
		<language>en-UK</language>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=3.3.3"/>
		<ttl>60</ttl>
				<item>
			<title>The Drinking Game for Android</title>
			<link>http://richardleggett.co.uk/blog/index.php/2010/05/27/the-drinking-game-for-android</link>
			<pubDate>Thu, 27 May 2010 09:36:53 +0000</pubDate>			<dc:creator>Richard Leggett</dc:creator>
			<category domain="main">Android</category>			<guid isPermaLink="false">347@http://richardleggett.co.uk/blog/</guid>
						<description>&lt;p&gt;I&amp;#8217;ve just uploaded a free drinking game for Android 1.6+ devices. Search &amp;#8220;&lt;strong&gt;The Drinking Game&lt;/strong&gt;&amp;#8221; in the Market application, visit &lt;a href=&quot;market://search?q=pname:drinking.game&quot;&gt;this link&lt;/a&gt; on your device, or scan the barcode &lt;a href=&quot;http://www.cyrket.com/p/android/drinking.game/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://richardleggett.co.uk/blog/media/thedrinkinggame.png&quot; alt=&quot;The Drinking Game&quot; title=&quot;The Drinking Game&quot; /&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;If anyone wants to rate and/or comment it would be much appreciated, and tonight I&amp;#8217;ll be presenting at &lt;a href=&quot;http://www.lfpug.com/27th-may-2010-27052010/&quot;&gt;LFPUG&lt;/a&gt; on Android development so if you&amp;#8217;re keen to find out more about getting into native Android development I hope to see you there!&lt;/p&gt;&lt;div class=&quot;sharethis&quot;&gt;
        &lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
          SHARETHIS.addEntry( {
            title : 'The Drinking Game for Android',
              url   : 'http://richardleggett.co.uk/blog/index.php/2010/05/27/the-drinking-game-for-android'}, 
            { popup: true }
          ) ;
        &lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://richardleggett.co.uk/blog/index.php/2010/05/27/the-drinking-game-for-android&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>I&#8217;ve just uploaded a free drinking game for Android 1.6+ devices. Search &#8220;<strong>The Drinking Game</strong>&#8221; in the Market application, visit <a href="market://search?q=pname:drinking.game">this link</a> on your device, or scan the barcode <a href="http://www.cyrket.com/p/android/drinking.game/">here</a>.</p>

<p><img src="http://richardleggett.co.uk/blog/media/thedrinkinggame.png" alt="The Drinking Game" title="The Drinking Game" /><br /></p>

<p>If anyone wants to rate and/or comment it would be much appreciated, and tonight I&#8217;ll be presenting at <a href="http://www.lfpug.com/27th-may-2010-27052010/">LFPUG</a> on Android development so if you&#8217;re keen to find out more about getting into native Android development I hope to see you there!</p><div class="sharethis">
        <script type="text/javascript" language="javascript">
          SHARETHIS.addEntry( {
            title : 'The Drinking Game for Android',
              url   : 'http://richardleggett.co.uk/blog/index.php/2010/05/27/the-drinking-game-for-android'}, 
            { popup: true }
          ) ;
        </script></div><br /><div class="item_footer"><p><small><a href="http://richardleggett.co.uk/blog/index.php/2010/05/27/the-drinking-game-for-android">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://richardleggett.co.uk/blog/index.php/2010/05/27/the-drinking-game-for-android#comments</comments>
			<wfw:commentRss>http://richardleggett.co.uk/blog/index.php?tempskin=_rss2&#38;disp=comments&#38;p=347</wfw:commentRss>
		</item>
				<item>
			<title>Speaking: An Introduction to Android</title>
			<link>http://richardleggett.co.uk/blog/index.php/2010/05/17/speaking-an-introduction-to-android</link>
			<pubDate>Mon, 17 May 2010 10:29:01 +0000</pubDate>			<dc:creator>Richard Leggett</dc:creator>
			<category domain="alt">Announcements [A]</category>
<category domain="alt">3D</category>
<category domain="main">Android</category>			<guid isPermaLink="false">346@http://richardleggett.co.uk/blog/</guid>
						<description>&lt;p&gt;I&amp;#8217;ll be speaking at this month&amp;#8217;s London Flash Platform User Group meeting (27th May) on the subject of native Android application development.&lt;/p&gt;

&lt;p&gt;The presentation will get you up and running from installing the tools to building and skinning applications.&lt;/p&gt;

&lt;p&gt;You can sign up to attend and find out more details &lt;a href=&quot;http://www.lfpug.com/27th-may-2010-27052010/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: Recording &lt;a href=&quot;http://www.lfpug.com/an-introduction-to-android/&quot;&gt;here&lt;/a&gt;. (Volume is very low, so without external speakers you may have trouble hearing).&lt;/p&gt;&lt;div class=&quot;sharethis&quot;&gt;
        &lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
          SHARETHIS.addEntry( {
            title : 'Speaking: An Introduction to Android',
              url   : 'http://richardleggett.co.uk/blog/index.php/2010/05/17/speaking-an-introduction-to-android'}, 
            { popup: true }
          ) ;
        &lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://richardleggett.co.uk/blog/index.php/2010/05/17/speaking-an-introduction-to-android&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>I&#8217;ll be speaking at this month&#8217;s London Flash Platform User Group meeting (27th May) on the subject of native Android application development.</p>

<p>The presentation will get you up and running from installing the tools to building and skinning applications.</p>

<p>You can sign up to attend and find out more details <a href="http://www.lfpug.com/27th-may-2010-27052010/">here</a>.</p>

<p><strong>UPDATE</strong>: Recording <a href="http://www.lfpug.com/an-introduction-to-android/">here</a>. (Volume is very low, so without external speakers you may have trouble hearing).</p><div class="sharethis">
        <script type="text/javascript" language="javascript">
          SHARETHIS.addEntry( {
            title : 'Speaking: An Introduction to Android',
              url   : 'http://richardleggett.co.uk/blog/index.php/2010/05/17/speaking-an-introduction-to-android'}, 
            { popup: true }
          ) ;
        </script></div><br /><div class="item_footer"><p><small><a href="http://richardleggett.co.uk/blog/index.php/2010/05/17/speaking-an-introduction-to-android">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://richardleggett.co.uk/blog/index.php/2010/05/17/speaking-an-introduction-to-android#comments</comments>
			<wfw:commentRss>http://richardleggett.co.uk/blog/index.php?tempskin=_rss2&#38;disp=comments&#38;p=346</wfw:commentRss>
		</item>
				<item>
			<title>FocusPane Remains Rotated When Tabbing Between Components</title>
			<link>http://richardleggett.co.uk/blog/index.php/2010/05/07/focuspane_remains_rotated_when_tabbing</link>
			<pubDate>Fri, 07 May 2010 09:54:09 +0000</pubDate>			<dc:creator>Richard Leggett</dc:creator>
			<category domain="main">Flex</category>			<guid isPermaLink="false">345@http://richardleggett.co.uk/blog/</guid>
						<description>&lt;p&gt;Very short post, I didn&amp;#8217;t find anything when googling for this so I wanted to add back to the pool.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The problem: &lt;/strong&gt;I have an IFocusableComponent which is rotated, in my case some &amp;#8220;transform handles&amp;#8221; being used to manipulate some on screen items. When tabbing to another non-rotated control, the visible focus rectangle remains rotated as it was for the transform handles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; No necessarily the best solution, but in my TransformHandles I override the focusOutHandler to reset the rotation of the focusPane&amp;#8217;s visible border&amp;#8230;&lt;/p&gt;

&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;override protected function focusOutHandler(event:FocusEvent):void&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;{&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;focusManager.focusPane.getChildAt(0).rotation = 0;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;super.focusOutHandler(event);&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I&amp;#8217;ve done some investigation into the real cause for this to no avail. UIComponent sets the rotation of the focusPane&amp;#8217;s child to whatever its rotation is when setFocus() is called, but for some reason this clearly isn&amp;#8217;t happening when tabbing to other standard controls. Potentially this is something unique to my UIComponent class as I&amp;#8217;m using the RotateEffect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keywords:&lt;/strong&gt; focusPane, focusRect, UIComponent, FocusManager, SystemManager.&lt;/p&gt;&lt;div class=&quot;sharethis&quot;&gt;
        &lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
          SHARETHIS.addEntry( {
            title : 'FocusPane Remains Rotated When Tabbing Between Components',
              url   : 'http://richardleggett.co.uk/blog/index.php/2010/05/07/focuspane_remains_rotated_when_tabbing'}, 
            { popup: true }
          ) ;
        &lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://richardleggett.co.uk/blog/index.php/2010/05/07/focuspane_remains_rotated_when_tabbing&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Very short post, I didn&#8217;t find anything when googling for this so I wanted to add back to the pool.</p>

<p><strong>The problem: </strong>I have an IFocusableComponent which is rotated, in my case some &#8220;transform handles&#8221; being used to manipulate some on screen items. When tabbing to another non-rotated control, the visible focus rectangle remains rotated as it was for the transform handles.</p>

<p><strong>Solution:</strong> No necessarily the best solution, but in my TransformHandles I override the focusOutHandler to reset the rotation of the focusPane&#8217;s visible border&#8230;</p>

<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default">override protected function focusOutHandler(event:FocusEvent):void</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code><span class="amc_default">{</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code><span class="amc_default">&#160;&#160;focusManager.focusPane.getChildAt(0).rotation = 0;</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code><span class="amc_default">&#160;&#160;&#160;&#160;</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code><span class="amc_default">&#160;&#160;super.focusOutHandler(event);</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code><span class="amc_default">}</span></code></td></tr>
</table></div>

<p>I&#8217;ve done some investigation into the real cause for this to no avail. UIComponent sets the rotation of the focusPane&#8217;s child to whatever its rotation is when setFocus() is called, but for some reason this clearly isn&#8217;t happening when tabbing to other standard controls. Potentially this is something unique to my UIComponent class as I&#8217;m using the RotateEffect.</p>

<p><strong>Keywords:</strong> focusPane, focusRect, UIComponent, FocusManager, SystemManager.</p><div class="sharethis">
        <script type="text/javascript" language="javascript">
          SHARETHIS.addEntry( {
            title : 'FocusPane Remains Rotated When Tabbing Between Components',
              url   : 'http://richardleggett.co.uk/blog/index.php/2010/05/07/focuspane_remains_rotated_when_tabbing'}, 
            { popup: true }
          ) ;
        </script></div><br /><div class="item_footer"><p><small><a href="http://richardleggett.co.uk/blog/index.php/2010/05/07/focuspane_remains_rotated_when_tabbing">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://richardleggett.co.uk/blog/index.php/2010/05/07/focuspane_remains_rotated_when_tabbing#comments</comments>
			<wfw:commentRss>http://richardleggett.co.uk/blog/index.php?tempskin=_rss2&#38;disp=comments&#38;p=345</wfw:commentRss>
		</item>
				<item>
			<title>jQuery CSS3 3D Animation</title>
			<link>http://richardleggett.co.uk/blog/index.php/2010/05/03/jquery_css3_3d_animation</link>
			<pubDate>Mon, 03 May 2010 20:07:01 +0000</pubDate>			<dc:creator>Richard Leggett</dc:creator>
			<category domain="alt">Flash</category>
<category domain="alt">3D</category>
<category domain="main">DHTML</category>
<category domain="alt">JavaScript</category>			<guid isPermaLink="false">344@http://richardleggett.co.uk/blog/</guid>
						<description>&lt;p&gt;I&amp;#8217;ve just finished a jQuery extension which adds support for modifying and animating &lt;a href=&quot;http://webkit.org/blog/386/3d-transforms/&quot;&gt;CSS3 transformations in 2D and 3D&lt;/a&gt;. This was based on the 2D transform monkey-patch by &lt;a href=&quot;http://www.zachstronaut.com&quot;&gt;Zachary Johnson&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I needed this for a project I&amp;#8217;m working on which specifically targets Webkit (tablet devices), but I&amp;#8217;m releasing the code under the existing MIT license for anyone to use as they wish. I&amp;#8217;ve put together a little demo to show how it can be used. This demo has been tested on Safari and Chrome, in Firefox you&amp;#8217;ll likely only see the 2D transformations, I haven&amp;#8217;t tried IE.&lt;/p&gt;

&lt;h3&gt;DEMO&lt;/h3&gt;

&lt;p&gt;I had very little spare time to put this together so it&amp;#8217;s quite rough around the edges and doesn&amp;#8217;t really show the full potential of this technique. But hopefully you&amp;#8217;ll see that 3D transformations can be used in a subtle manner with your existing JS/CSS, or in a very obvious manner in a game perhaps.&lt;/p&gt;

&lt;p&gt;Click image to &lt;a href=&quot;http://richardleggett.co.uk/sketchbook/CSS3DDemo&quot;&gt;see demo&lt;/a&gt;. Move mouse around to rotate images in 3D, roll-over buttons and click to view transform animations.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://richardleggett.co.uk/sketchbook/CSS3DDemo&quot;&gt;&lt;img src=&quot;http://richardleggett.co.uk/blog/media/css3d.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(images are &lt;a href=&quot;http://creativecommons.org/licenses/by-nc-sa/3.0/&quot;&gt;CC non-commercial share-alike&lt;/a&gt;, &lt;a href=&quot;http://qvectors.net/misc-vectors/cute-animals/&quot;&gt;link&lt;/a&gt;)&lt;/p&gt;

&lt;h3&gt;Notes and Comparisons with Flash&lt;/h3&gt;

&lt;p&gt;There has been quite some discussion regarding the position of &amp;#8220;HTML5&amp;Prime; (usually referring to HTML5, CSS3 and JS), and Flash. Steve Jobs made &lt;a href=&quot;http://www.apple.com/hotnews/thoughts-on-flash/&quot;&gt;his thoughts&lt;/a&gt; clear on the subject, even though that particular letter was full of inaccuracies and errors, in particular with regards to video and &lt;a href=&quot;http://help.adobe.com/en_US/as3/dev/WS1ca064e08d7aa93023c59dfc1257b16a3d6-7ffe.html&quot;&gt;touch events&lt;/a&gt;. Personally I&amp;#8217;ll always use whatever tech works for the job, many of the posts bashing Flash in the last decade have been written by people that haven&amp;#8217;t necessarily tried it. Many refer to Flash from brief experiences they had many years ago, with the timeline, slow performance and pre-AS3 code. So I thought it might be useful to write up some of the notes I made along the way as I weighed up when I might use this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS Animations/Transitions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So far it&amp;#8217;s really only Webkit that supports these. Everything is optimised for fairly non-interactive content, animations are defined ahead of time, not very dynamic. You can do some cool stuff with keyframes (at 10%, 20% etc) but I see way too many holes if you want to use these in RIAs and games.&lt;/p&gt;

&lt;p&gt;Of course using JavaScript you can pretty much animate things as you wish, which is why I wrote the jQuery extension to support the 3D CSS transformations in the animate() function. The downside is performance. Testing on the 1Ghz Nexus One webkit browser shows that JS powered CSS animation will be severely limited on devices, certainly when compared with &lt;a href=&quot;http://phandroid.com/2010/04/01/speed-test-flash-vs-html5-on-the-nexus-one/&quot;&gt;performance tests shown for Flash Player 10.1&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I was unable to find a way to perform a circular path (orbit) animation in CSS, anyone know if this is possible? This is something very common in UI work, rather than sticking to straight lines, transitions can benefit from having a touch of curvature to soften the effect, as well as standard (non-mouse-related) &amp;#8220;hover&amp;#8221; type animation.  So again in this case I had to resort to using JS for this, losing the benefit of CSS animations, if anyone knows how to do this I&amp;#8217;d really appreciate the comment.&lt;br /&gt;
	&lt;br /&gt;
&lt;strong&gt;Filters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I can&amp;#8217;t seem to find anything that works in Webkit or Mozilla, here I&amp;#8217;m talking about the sorts of things you do to highlight something of importance to the user to subtly improve usability; things like glow and &lt;strong&gt;non&lt;/strong&gt;-box-shaped shadows (I&amp;#8217;m aware of text-shadows and box shadows). I would have thought this was a given when the spec was being written, this could make for a pretty dated look and feel. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blend Modes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I really just expected these to be in&amp;#8230; there are a few things in Webkit related to this, but it&amp;#8217;s a worry; blend modes make for an improved look and feel in modern UIs (especially when dragging things around as objects become obscured). Will have to wait and see what happens with this. Of course all of this would be almost moot if the IE 9 team decided Canvas wasn&amp;#8217;t too much of a threat and implemented support. So many great Canvas experiments are essentially in vain as a result, so many apps still only possible using the pixel manipulating features in Flash Player 8+.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CPU usage / Performance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I was using a jQuery plugin for animating elements on a curve/arc to get the circle animation but I found CPU usage went straight to 100% with the four animals, so I presume either my usage was wrong (there wasn&amp;#8217;t much to it) or there&amp;#8217;s something wrong with that plugin.&lt;/p&gt;

&lt;p&gt;Safari uses 100% CPU just to run the setInterval() for the first 30 seconds before dropping down to &amp;lt;5%, Chrome doesn&amp;#8217;t suffer from this. I&amp;#8217;m not sure whether this is a bug in Safari or not, hopefully someone can shed some light on this. Outside of setInterval() there are no built in ways to do real-time games in JS that I am aware of (Flash has setInterval and Timers but i&amp;#8217;s much more efficient to use the ENTER_FRAME event which results in no CPU overhead). &lt;/p&gt;

&lt;p&gt;If you are doing real-time games in JS, I would probably avoid the overhead of jQuery for the most part and keep it as low-level as possible, the DOM with its history of laying out mostly static content doesn&amp;#8217;t lend itself amazingly well to high-performance graphics, this is akin to building a game in the Flex (app) framework, you just wouldn&amp;#8217;t, you&amp;#8217;d use Sprite/MovieClip etc which doesn&amp;#8217;t have the enormous measurement overheads for liquid layout, padding, margins, accessibility and so on. Perhaps Canvas is an option, which unfortunately still means Flash for the next few years (&lt;a href=&quot;flashcanvas.net/&quot;&gt;flashcanvas&lt;/a&gt;) due to IE9 (SVG could take up a large amount of slack, but that&amp;#8217;s about equivalent to FP8 so not particularly exciting).&lt;/p&gt;

&lt;p&gt;The other day I saw &lt;a href=&quot;http://www.tutorialsbyibrent.com/blog/2010/05/03/html5-your-full-web-experience-by-steve-jobs-and-friends/&quot;&gt;this video&lt;/a&gt; which appears to confirm my performance worries with HTML. It&amp;#8217;s very easy to say HTML provides better performance than Flash until you try to do the same sort of things people do with Flash but I imagine the FUD will continue long after people start to question why we aren&amp;#8217;t seeing these cutting edge apps being built with HTML.&lt;br /&gt;
	&lt;br /&gt;
&lt;strong&gt;Cross browser inconsistencies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I mentioned I&amp;#8217;m only targeting Webkit, luckily the two big OSs in tablet devices (Apple iPhone OS and Android) both run Webkit, but I am a little worried by the fact that something as basic as text-stroke only works in Webkit, there&amp;#8217;s nothing very concrete to go on as to who&amp;#8217;s going to support what in the coming years. Even Firefox doesn&amp;#8217;t support it, and that actually has a big impact on design as I&amp;#8217;d also have to remove the (fairly supported) text drop-shadow because without the text stroke it just looks ugly. What a nightmare the next few years will be, with frustration and constant set-backs; I&amp;#8217;ve gotten used to being 100% confident anything I can achieve in Flash will work across all browsers, the thought of hacking and rolling back to simpler times is a pain.&lt;/p&gt;

&lt;h3&gt;Conclusions&lt;/h3&gt;

&lt;p&gt;So this has been a learning experience&amp;#8230; it certainly works for me when targeting mobile devices for fairly simple apps/games, where you don&amp;#8217;t have a lot of heavy graphics or effects to deal with. I can definitely see a huge chunk of current-gen Flash web apps being cut-down a little and written in HTML+CSS+JS in order to support Apple devices and in favour of Web standards, but I fear if Flash becomes too niche we&amp;#8217;re going to take one step forward and two steps back just as web apps and games were really beginning to rival the desktop; leaving us with a rather uninspiring experience based on what you simply can&amp;#8217;t do in HTML5/JS/CSS3. In short it&amp;#8217;s only about 60% of the way to Flash Player 10 in raw technical capabilities and before widespread use we&amp;#8217;ll see Flash Player 11, 12, with who knows what. &lt;/p&gt;

&lt;p&gt;So it&amp;#8217;s not quite as great as I hoped, but I&amp;#8217;m gonna jump on board as best I can and push it as far as I&amp;#8217;m able. Still, what I&amp;#8217;d really love to see is browser vendors pushed in the right direction by us developers demanding some of these things as soon as possible.&lt;/p&gt;&lt;div class=&quot;sharethis&quot;&gt;
        &lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
          SHARETHIS.addEntry( {
            title : 'jQuery CSS3 3D Animation',
              url   : 'http://richardleggett.co.uk/blog/index.php/2010/05/03/jquery_css3_3d_animation'}, 
            { popup: true }
          ) ;
        &lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://richardleggett.co.uk/blog/index.php/2010/05/03/jquery_css3_3d_animation&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>I&#8217;ve just finished a jQuery extension which adds support for modifying and animating <a href="http://webkit.org/blog/386/3d-transforms/">CSS3 transformations in 2D and 3D</a>. This was based on the 2D transform monkey-patch by <a href="http://www.zachstronaut.com">Zachary Johnson</a>.</p>

<p>I needed this for a project I&#8217;m working on which specifically targets Webkit (tablet devices), but I&#8217;m releasing the code under the existing MIT license for anyone to use as they wish. I&#8217;ve put together a little demo to show how it can be used. This demo has been tested on Safari and Chrome, in Firefox you&#8217;ll likely only see the 2D transformations, I haven&#8217;t tried IE.</p>

<h3>DEMO</h3>

<p>I had very little spare time to put this together so it&#8217;s quite rough around the edges and doesn&#8217;t really show the full potential of this technique. But hopefully you&#8217;ll see that 3D transformations can be used in a subtle manner with your existing JS/CSS, or in a very obvious manner in a game perhaps.</p>

<p>Click image to <a href="http://richardleggett.co.uk/sketchbook/CSS3DDemo">see demo</a>. Move mouse around to rotate images in 3D, roll-over buttons and click to view transform animations.</p>

<p><a href="http://richardleggett.co.uk/sketchbook/CSS3DDemo"><img src="http://richardleggett.co.uk/blog/media/css3d.jpg" /></a></p>

<p>(images are <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">CC non-commercial share-alike</a>, <a href="http://qvectors.net/misc-vectors/cute-animals/">link</a>)</p>

<h3>Notes and Comparisons with Flash</h3>

<p>There has been quite some discussion regarding the position of &#8220;HTML5&Prime; (usually referring to HTML5, CSS3 and JS), and Flash. Steve Jobs made <a href="http://www.apple.com/hotnews/thoughts-on-flash/">his thoughts</a> clear on the subject, even though that particular letter was full of inaccuracies and errors, in particular with regards to video and <a href="http://help.adobe.com/en_US/as3/dev/WS1ca064e08d7aa93023c59dfc1257b16a3d6-7ffe.html">touch events</a>. Personally I&#8217;ll always use whatever tech works for the job, many of the posts bashing Flash in the last decade have been written by people that haven&#8217;t necessarily tried it. Many refer to Flash from brief experiences they had many years ago, with the timeline, slow performance and pre-AS3 code. So I thought it might be useful to write up some of the notes I made along the way as I weighed up when I might use this.</p>

<p><strong>CSS Animations/Transitions</strong></p>

<p>So far it&#8217;s really only Webkit that supports these. Everything is optimised for fairly non-interactive content, animations are defined ahead of time, not very dynamic. You can do some cool stuff with keyframes (at 10%, 20% etc) but I see way too many holes if you want to use these in RIAs and games.</p>

<p>Of course using JavaScript you can pretty much animate things as you wish, which is why I wrote the jQuery extension to support the 3D CSS transformations in the animate() function. The downside is performance. Testing on the 1Ghz Nexus One webkit browser shows that JS powered CSS animation will be severely limited on devices, certainly when compared with <a href="http://phandroid.com/2010/04/01/speed-test-flash-vs-html5-on-the-nexus-one/">performance tests shown for Flash Player 10.1</a>.</p>

<p>I was unable to find a way to perform a circular path (orbit) animation in CSS, anyone know if this is possible? This is something very common in UI work, rather than sticking to straight lines, transitions can benefit from having a touch of curvature to soften the effect, as well as standard (non-mouse-related) &#8220;hover&#8221; type animation.  So again in this case I had to resort to using JS for this, losing the benefit of CSS animations, if anyone knows how to do this I&#8217;d really appreciate the comment.<br />
	<br />
<strong>Filters</strong></p>

<p>I can&#8217;t seem to find anything that works in Webkit or Mozilla, here I&#8217;m talking about the sorts of things you do to highlight something of importance to the user to subtly improve usability; things like glow and <strong>non</strong>-box-shaped shadows (I&#8217;m aware of text-shadows and box shadows). I would have thought this was a given when the spec was being written, this could make for a pretty dated look and feel. </p>

<p><strong>Blend Modes</strong></p>

<p>I really just expected these to be in&#8230; there are a few things in Webkit related to this, but it&#8217;s a worry; blend modes make for an improved look and feel in modern UIs (especially when dragging things around as objects become obscured). Will have to wait and see what happens with this. Of course all of this would be almost moot if the IE 9 team decided Canvas wasn&#8217;t too much of a threat and implemented support. So many great Canvas experiments are essentially in vain as a result, so many apps still only possible using the pixel manipulating features in Flash Player 8+.</p>

<p><strong>CPU usage / Performance</strong></p>

<p>I was using a jQuery plugin for animating elements on a curve/arc to get the circle animation but I found CPU usage went straight to 100% with the four animals, so I presume either my usage was wrong (there wasn&#8217;t much to it) or there&#8217;s something wrong with that plugin.</p>

<p>Safari uses 100% CPU just to run the setInterval() for the first 30 seconds before dropping down to &lt;5%, Chrome doesn&#8217;t suffer from this. I&#8217;m not sure whether this is a bug in Safari or not, hopefully someone can shed some light on this. Outside of setInterval() there are no built in ways to do real-time games in JS that I am aware of (Flash has setInterval and Timers but i&#8217;s much more efficient to use the ENTER_FRAME event which results in no CPU overhead). </p>

<p>If you are doing real-time games in JS, I would probably avoid the overhead of jQuery for the most part and keep it as low-level as possible, the DOM with its history of laying out mostly static content doesn&#8217;t lend itself amazingly well to high-performance graphics, this is akin to building a game in the Flex (app) framework, you just wouldn&#8217;t, you&#8217;d use Sprite/MovieClip etc which doesn&#8217;t have the enormous measurement overheads for liquid layout, padding, margins, accessibility and so on. Perhaps Canvas is an option, which unfortunately still means Flash for the next few years (<a href="http://richardleggett.co.ukflashcanvas.net/">flashcanvas</a>) due to IE9 (SVG could take up a large amount of slack, but that&#8217;s about equivalent to FP8 so not particularly exciting).</p>

<p>The other day I saw <a href="http://www.tutorialsbyibrent.com/blog/2010/05/03/html5-your-full-web-experience-by-steve-jobs-and-friends/">this video</a> which appears to confirm my performance worries with HTML. It&#8217;s very easy to say HTML provides better performance than Flash until you try to do the same sort of things people do with Flash but I imagine the FUD will continue long after people start to question why we aren&#8217;t seeing these cutting edge apps being built with HTML.<br />
	<br />
<strong>Cross browser inconsistencies</strong></p>

<p>I mentioned I&#8217;m only targeting Webkit, luckily the two big OSs in tablet devices (Apple iPhone OS and Android) both run Webkit, but I am a little worried by the fact that something as basic as text-stroke only works in Webkit, there&#8217;s nothing very concrete to go on as to who&#8217;s going to support what in the coming years. Even Firefox doesn&#8217;t support it, and that actually has a big impact on design as I&#8217;d also have to remove the (fairly supported) text drop-shadow because without the text stroke it just looks ugly. What a nightmare the next few years will be, with frustration and constant set-backs; I&#8217;ve gotten used to being 100% confident anything I can achieve in Flash will work across all browsers, the thought of hacking and rolling back to simpler times is a pain.</p>

<h3>Conclusions</h3>

<p>So this has been a learning experience&#8230; it certainly works for me when targeting mobile devices for fairly simple apps/games, where you don&#8217;t have a lot of heavy graphics or effects to deal with. I can definitely see a huge chunk of current-gen Flash web apps being cut-down a little and written in HTML+CSS+JS in order to support Apple devices and in favour of Web standards, but I fear if Flash becomes too niche we&#8217;re going to take one step forward and two steps back just as web apps and games were really beginning to rival the desktop; leaving us with a rather uninspiring experience based on what you simply can&#8217;t do in HTML5/JS/CSS3. In short it&#8217;s only about 60% of the way to Flash Player 10 in raw technical capabilities and before widespread use we&#8217;ll see Flash Player 11, 12, with who knows what. </p>

<p>So it&#8217;s not quite as great as I hoped, but I&#8217;m gonna jump on board as best I can and push it as far as I&#8217;m able. Still, what I&#8217;d really love to see is browser vendors pushed in the right direction by us developers demanding some of these things as soon as possible.</p><div class="sharethis">
        <script type="text/javascript" language="javascript">
          SHARETHIS.addEntry( {
            title : 'jQuery CSS3 3D Animation',
              url   : 'http://richardleggett.co.uk/blog/index.php/2010/05/03/jquery_css3_3d_animation'}, 
            { popup: true }
          ) ;
        </script></div><br /><div class="item_footer"><p><small><a href="http://richardleggett.co.uk/blog/index.php/2010/05/03/jquery_css3_3d_animation">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://richardleggett.co.uk/blog/index.php/2010/05/03/jquery_css3_3d_animation#comments</comments>
			<wfw:commentRss>http://richardleggett.co.uk/blog/index.php?tempskin=_rss2&#38;disp=comments&#38;p=344</wfw:commentRss>
		</item>
				<item>
			<title>Implementing SpellCheck (Squiggly) with the Text Layout Framework (TLF)</title>
			<link>http://richardleggett.co.uk/blog/index.php/2010/04/30/squiggly_spellcheck_with_tlf</link>
			<pubDate>Fri, 30 Apr 2010 08:19:26 +0000</pubDate>			<dc:creator>Richard Leggett</dc:creator>
			<category domain="main">Flash</category>			<guid isPermaLink="false">343@http://richardleggett.co.uk/blog/</guid>
						<description>&lt;p&gt;I&amp;#8217;ve just &lt;a href=&quot;http://forums.adobe.com/message/2773334#2773334&quot;&gt;posted over in the Text Layout forums&lt;/a&gt; how I went about implementing Squiggly with &amp;#8220;pure&amp;#8221; Text Layout Framework&amp;#8230; so that&amp;#8217;s not using TLF/FTETextField or the Spark components.&lt;/p&gt;

&lt;p&gt;This is really just an overview which should give plenty to help you figure out the steps. I can&amp;#8217;t paste the exact code because it&amp;#8217;s embedded in a client project, but I do refer to some of the TLF functions throughout that you have to make use of, if anyone can suggest improvements, please drop them in the comments.&lt;/p&gt;

&lt;p&gt;Copied from the forum post&amp;#8230;&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;Find TextRanges for misspelled words:&lt;ul&gt;&lt;li&gt;Get the first Paragraph using textFlow.getFirstLeaf().getParagraph()&lt;/li&gt;&lt;li&gt;Loop through all Paragraphs using para.getNextParagraph()&lt;/li&gt;&lt;li&gt;For each, run a Regex match (/\b\w+\b/) on para.getText()&lt;/li&gt;&lt;li&gt;Spellcheck each result using Squiggly, and for bad words store a TextRange: TextRange(textFlow, para.getAbsoluteStart()+index, para.getAbsoluteStart()+index+word.length-1); where index is incremented to the position proceeding the end of each word (match or no match).&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;min-height: 8pt; height: 8pt; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Spellcheck class:&lt;ul&gt;&lt;li&gt;Created a static SpellCheck class which loads language dictionary (downloaded from OpenOffice website) and a UserDictionary (stored as a simple text file)&lt;/li&gt;&lt;li&gt; Added methods for checkTextFlow(textFlow:TextFlow):Array which returns an array of &amp;#8220;bad&amp;#8221; TextRanges, a method for getSuggestions(word:String):Array and methods for checkWord() and addUserWord().&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;min-height: 8pt; height: 8pt; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Context menu:&lt;ul&gt;&lt;li&gt;Extend ContainerController and override menuSelectHandler()&amp;#8230; use an instance of my CustomContainerController when creating the TextFlow:&lt;/li&gt;&lt;li&gt;&amp;#160; textFlow.flowComposer.addController( new CustomContainerController() );&amp;#160;&amp;#160; &lt;/li&gt;&lt;li&gt;Loop through flowComposer.numLines, obtain each TextFlowLine from flowComposer and therefore each TextLine.&lt;/li&gt;&lt;li&gt;Determine if textLine.getBounds(container).container(container.mouseX, container.mouseY) to find the line they right-clicked.&lt;/li&gt;&lt;li&gt;Get the &amp;#8220;raw text&amp;#8221; for the line: textLine.textBlock.content.rawText.substr(textLine.textBlockBeginIndex);&lt;/li&gt;&lt;li&gt;Find the atom clicked: textLine.getAtomIndexAtPoint(container.stage.mouseX, container.stage.mouseY).&lt;/li&gt;&lt;li&gt;Find the starting atom of the word (reverse lookup for word boundary i.e.. &amp;#8221; &amp;#8221; or first char in raw text).&lt;/li&gt;&lt;li&gt;Determine the word itself by using regex to find the first word from this starting point (/\b\w+\b/).&lt;/li&gt;&lt;li&gt;Add ContextMenuItems for &amp;#8220;add to dictionary&amp;#8221; and suggested words (for the latter also store start/end atoms in ContextMenuItem.data).&lt;/li&gt;&lt;li&gt;When user clicks a suggested word, use (interactionManager as EditManager).selectRange(data.start, data.end); (interactionManager as EditManager).insertText(data.word) where &amp;#8220;data&amp;#8221; is the data property of the clicked ContextMenuItem.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;min-height: 8pt; height: 8pt; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;In my &amp;#8220;EditableTextField&amp;#8221; class, I call my SpellCheck.checkTextFlow() to get the bad TextRanges and&amp;#8230;&lt;ul&gt;&lt;li&gt;&amp;#160; Loop through the badRanges array.&lt;/li&gt;&lt;li&gt;&amp;#160; Loop from range.absoluteStart to range.absoluteEnd for each TextRange.&lt;/li&gt;&lt;li&gt;&amp;#160; Find TextFlowLine for &amp;#8220;i&amp;#8221; in this loop, and therefore the TextLine: containerController.flowComposer.findLineAtPosition(i); textFlowLine.getTextLine();&lt;/li&gt;&lt;li&gt;&amp;#160; Find atom bounds using textLine.getAtomBounds(charIndex); where charIndex is: i - textFlowLine.absoluteStart.&lt;/li&gt;&lt;li&gt;&amp;#160; Underline&amp;#8230; drawRect( bounds.x + textLine.x, bounds.y + textLine.y + bounds.height - textLine.descent - 1, bounds.width, 3)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;min-height: 8pt; height: 8pt; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;min-height: 8pt; height: 8pt; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I&amp;#8217;m sure there is a more elegant way, but this seems to work. I believe I read Adobe are working on Squiggly for pure TLF, if not, I hope this helps somebody get on the right track.&lt;/p&gt;&lt;div class=&quot;sharethis&quot;&gt;
        &lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
          SHARETHIS.addEntry( {
            title : 'Implementing SpellCheck (Squiggly) with the Text Layout Framework (TLF)',
              url   : 'http://www.richardleggett.co.uk/blog/index.php/2010/04/30/squiggly_spellcheck_with_tlf'}, 
            { popup: true }
          ) ;
        &lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://richardleggett.co.uk/blog/index.php/2010/04/30/squiggly_spellcheck_with_tlf&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>I&#8217;ve just <a href="http://forums.adobe.com/message/2773334#2773334">posted over in the Text Layout forums</a> how I went about implementing Squiggly with &#8220;pure&#8221; Text Layout Framework&#8230; so that&#8217;s not using TLF/FTETextField or the Spark components.</p>

<p>This is really just an overview which should give plenty to help you figure out the steps. I can&#8217;t paste the exact code because it&#8217;s embedded in a client project, but I do refer to some of the TLF functions throughout that you have to make use of, if anyone can suggest improvements, please drop them in the comments.</p>

<p>Copied from the forum post&#8230;</p>

<ul><li>Find TextRanges for misspelled words:<ul><li>Get the first Paragraph using textFlow.getFirstLeaf().getParagraph()</li><li>Loop through all Paragraphs using para.getNextParagraph()</li><li>For each, run a Regex match (/\b\w+\b/) on para.getText()</li><li>Spellcheck each result using Squiggly, and for bad words store a TextRange: TextRange(textFlow, para.getAbsoluteStart()+index, para.getAbsoluteStart()+index+word.length-1); where index is incremented to the position proceeding the end of each word (match or no match).</li></ul></li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&nbsp;</p><ul><li>Spellcheck class:<ul><li>Created a static SpellCheck class which loads language dictionary (downloaded from OpenOffice website) and a UserDictionary (stored as a simple text file)</li><li> Added methods for checkTextFlow(textFlow:TextFlow):Array which returns an array of &#8220;bad&#8221; TextRanges, a method for getSuggestions(word:String):Array and methods for checkWord() and addUserWord().</li></ul></li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&nbsp;</p><ul><li>Context menu:<ul><li>Extend ContainerController and override menuSelectHandler()&#8230; use an instance of my CustomContainerController when creating the TextFlow:</li><li>&#160; textFlow.flowComposer.addController( new CustomContainerController() );&#160;&#160; </li><li>Loop through flowComposer.numLines, obtain each TextFlowLine from flowComposer and therefore each TextLine.</li><li>Determine if textLine.getBounds(container).container(container.mouseX, container.mouseY) to find the line they right-clicked.</li><li>Get the &#8220;raw text&#8221; for the line: textLine.textBlock.content.rawText.substr(textLine.textBlockBeginIndex);</li><li>Find the atom clicked: textLine.getAtomIndexAtPoint(container.stage.mouseX, container.stage.mouseY).</li><li>Find the starting atom of the word (reverse lookup for word boundary i.e.. &#8221; &#8221; or first char in raw text).</li><li>Determine the word itself by using regex to find the first word from this starting point (/\b\w+\b/).</li><li>Add ContextMenuItems for &#8220;add to dictionary&#8221; and suggested words (for the latter also store start/end atoms in ContextMenuItem.data).</li><li>When user clicks a suggested word, use (interactionManager as EditManager).selectRange(data.start, data.end); (interactionManager as EditManager).insertText(data.word) where &#8220;data&#8221; is the data property of the clicked ContextMenuItem.</li></ul></li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&nbsp;</p><ul><li>In my &#8220;EditableTextField&#8221; class, I call my SpellCheck.checkTextFlow() to get the bad TextRanges and&#8230;<ul><li>&#160; Loop through the badRanges array.</li><li>&#160; Loop from range.absoluteStart to range.absoluteEnd for each TextRange.</li><li>&#160; Find TextFlowLine for &#8220;i&#8221; in this loop, and therefore the TextLine: containerController.flowComposer.findLineAtPosition(i); textFlowLine.getTextLine();</li><li>&#160; Find atom bounds using textLine.getAtomBounds(charIndex); where charIndex is: i - textFlowLine.absoluteStart.</li><li>&#160; Underline&#8230; drawRect( bounds.x + textLine.x, bounds.y + textLine.y + bounds.height - textLine.descent - 1, bounds.width, 3)</li></ul></li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&nbsp;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&nbsp;</p><p>I&#8217;m sure there is a more elegant way, but this seems to work. I believe I read Adobe are working on Squiggly for pure TLF, if not, I hope this helps somebody get on the right track.</p><div class="sharethis">
        <script type="text/javascript" language="javascript">
          SHARETHIS.addEntry( {
            title : 'Implementing SpellCheck (Squiggly) with the Text Layout Framework (TLF)',
              url   : 'http://richardleggett.co.uk/blog/index.php/2010/04/30/squiggly_spellcheck_with_tlf'}, 
            { popup: true }
          ) ;
        </script></div><br /><div class="item_footer"><p><small><a href="http://richardleggett.co.uk/blog/index.php/2010/04/30/squiggly_spellcheck_with_tlf">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://richardleggett.co.uk/blog/index.php/2010/04/30/squiggly_spellcheck_with_tlf#comments</comments>
			<wfw:commentRss>http://richardleggett.co.uk/blog/index.php?tempskin=_rss2&#38;disp=comments&#38;p=343</wfw:commentRss>
		</item>
				<item>
			<title>Adobe and HTML5</title>
			<link>http://richardleggett.co.uk/blog/index.php/2010/04/21/adobe-and-html5</link>
			<pubDate>Wed, 21 Apr 2010 10:31:05 +0000</pubDate>			<dc:creator>Richard Leggett</dc:creator>
			<category domain="alt">Flash</category>
<category domain="main">Adobe</category>
<category domain="alt">DHTML</category>
<category domain="alt">JavaScript</category>			<guid isPermaLink="false">342@http://richardleggett.co.uk/blog/</guid>
						<description>&lt;p&gt;The recent news is that &lt;a href=&quot;http://www.mikechambers.com/blog/10/04/20/on-adobe-flash-cs5-and-iphone-applications/&quot;&gt;Adobe is going to abandon&lt;/a&gt; the iPhone/iPad export feature in Flash CS5 after Apple revealed the controversial SDK &lt;a href=&quot;http://daringfireball.net/2010/04/iphone_agreement_bans_flash_compiler&quot;&gt;clause 3.3.1&lt;/a&gt; which forbids applications that are not originally written in one of their approved technologies, namely C/Objective-C and HTML/JS.&lt;/p&gt;

&lt;p&gt;So the official line is that Adobe is now focusing on getting the Flash Platform onto Android (along with existing targets, Nokia), and to be fair, even though that sounds like they&amp;#8217;re just making the best of a bad situation, Android is going to be by far the biggest market judging by current growth indicators; the number of manufacturers producing all manner of devices that run it is truly staggering, the quality improving weekly.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://aralbalkan.com/&quot;&gt;Aral&lt;/a&gt; presented on something he called &amp;#8220;Native X&quot;; in a nutshell: why are Adobe obsessed with getting a one-size fits all runtime onto every device, rather than outputting native executables for a given platform? Presumably the argument is that a single runtime produces fewer cross-platform inconsistencies, but in reality this endeavour has proven very difficult to achieve. Flash Lite showed just how hard it can be, which for years consisted of a slower, older runtime running on certain Nokia smartphones, fragmented versions and implementations, the whole thing never really took off in a consistent way outside of Japan, and now Flash Player 10.1 and AIR is finally coming, should they continue down this route? &lt;/p&gt;

&lt;p&gt;Flash CS5 showed an alternative &amp;#8212;perhaps through necessity&amp;#8212; which was outputting native apps for iPhone. By cross-compiling you can provide developers with familiar tools, but still target specific platforms. You do begin to introduce cross platform inconsistencies&amp;#8230; does it have multi-touch or webcam (already a consideration in the FP) for example. Still, the win from being able to write something once and have it run on almost anything without too many changes far outweighs this problem. The alternative is to spend a &lt;strong&gt;lot&lt;/strong&gt; of time and money writing once in Objective-C, again in Flash or Java&amp;#8230; indie developers, thanks but no thanks.&lt;/p&gt;

&lt;p&gt;The downside to this is that you will inevitably produce a one-size fits all set of capabilities, so you may lack access to a hardware feature which you could access in Objective-C. That&amp;#8217;s fine, the point is you have a choice and you should not be forced to use something if your app or game doesn&amp;#8217;t require it.&lt;/p&gt;

&lt;h3&gt;What Can Adobe Do Next?&lt;/h3&gt;


&lt;p&gt;Who could guess Adobe&amp;#8217;s long term strategy? They may have this all figured out and this recent set-back is just a fly in the ointment. In a post &amp;#8220;&lt;a href=&quot;http://www.richardleggett.co.uk/blog/index.php/2010/02/01/the-world-is-moving-to-html5&quot;&gt;The World is Moving to HTML 5 and Other Flights of Fancy&lt;/a&gt;&amp;#8221; I indicated that whilst Adobe have made a huge success out of the &amp;#8220;Flash Platform&quot;, we have to remember the money has traditionally &lt;a href=&quot;http://blogs.adobe.com/jnack/2010/01/sympathy_for_the_devil.html&quot;&gt;come from tools&lt;/a&gt;*. Flash CS5 and Flash Builder are just two tools that target the Flash Player, but there was once Director, and there is still Dreamweaver which has stood the test of time, of course Photoshop is used in pretty much anything you see online and in print. Tools, these are not something easily copied, they demand a premium.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;*More recently we&amp;#8217;ve seen a shift toward providing developer and consumer-facing services such as with Acrobat.com. I believe this to be a forward looking risk-reducing strategy, broadening the portfolio in-case of collapse in the desktop/app market, or perhaps just generating new scalable revenue streams.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So if I were the CEO of Adobe Systems, Shantanu Narayen, what actions would I take over the next 5 years? Partly this is a waiting game, the necessary features of HTML to make some of these leaps are still being ironed out, mainly thanks to IE 9 failing to add Canvas to an otherwise outstanding list of supported features. Instead it looks like SVG will provide the forward momentum for a large percentage of RIAs.&lt;/p&gt;

&lt;p&gt;Either way, here are some things I&amp;#8217;d consider&amp;#8230;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Technical&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Slowly start to migrate focus away from the Flash Platform&lt;/strong&gt; - That&amp;#8217;s the player/runtime end of things. This step has the highest risk associated with it because Flash&amp;#8217;s ability to do so much more than HTML even promises to in the specs has always has been the differentiator and why people use Flash in the first place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Focus on &amp;#8220;Dream Builder&amp;#8221;&lt;/strong&gt; - Continue to develop the Flash IDE but focus on combining Flex Builder and Dreamweaver (ironically Flex Builder used to run in a Dreamweaver-like IDE, I propose the migration of Dreamweaver to Eclipse)&amp;#8230;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Develop the best HTML5/JS Editor&lt;/strong&gt; - None of the hardcore JS people I know use Dreamweaver, which I found suprising until you realise the code completion is pretty worthless for OO code.  If Dreamweaver and Flex Builder were to combine, I would initially introduce &amp;#8220;HTML Project&amp;#8221; as a type in Flex Builder, which uses a Flex SDK targeting JS, including some of the familiar components, effects and so forth.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Open source the Flash Player&lt;/strong&gt; - provide the web with one of the greatest gifts it has ever seen. HTML specs progress slowly,  HTML5 really does just feel like a&lt;a href=&quot;http://diveintohtml5.org/&quot;&gt; slight incremental improvement&lt;/a&gt; over version 4 when you weight it up against the features in Flash Player 10.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Work with the W3C&lt;/strong&gt; - Providing the building blocks for technological innovations is one thing, getting any of it into the spec is another entirely. This probably needs to remain as hands off as possible for political reasons and wide-spread developer relations, whilst still supporting active development as many corporations do.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don&amp;#8217;t stray too far from the underlying web technologies&lt;/strong&gt; - In other words, don&amp;#8217;t do a &lt;a href=&quot;http://code.google.com/webtoolkit/overview.html&quot;&gt;GWT&lt;/a&gt; or face rejection.&lt;/p&gt;

&lt;p&gt;Some of these things are simply unfathomable; &amp;#8220;abandon the Flex SDK and build it again for HTML/JS?&quot;, no, not abandon, but aim to supplant in the very long term, this cannot happen overnight, and that&amp;#8217;s a lot of extra man-power needed, but of course this would have to remain open-source as with Flex, and the developer audience would be enormous.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;People&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is the really tough part, something I simply don&amp;#8217;t have the experience to discuss with any meaning. It&amp;#8217;s all well and good discussing what could be done with the products, with the specs, the technical side of things&amp;#8230; but these are all supported by a hierachy of real people doing their jobs. No matter how slowly you do this people will lose jobs or move to another team.&lt;/p&gt;

&lt;p&gt;Continuing to develop the Flash Player would see the very best developers adding those features that really wow us. The niche for cutting edge will not disappear (just like plug-ins), what I&amp;#8217;m talking about here is the wider-web. The semantic, open web which has to, by its very nature, remain top dog.&lt;/p&gt;

&lt;h3&gt;What Can Developers Do Now?&lt;/h3&gt;


&lt;p&gt;I can only speak for myself. I&amp;#8217;m writing a game which specifically targets tablet and surface computers, so I have to include the iPad in there of course. The news of Flash not being an option has also put me off using OpenPlug&amp;#8217;s Elips Studio until we get confirmation of their situation&amp;#8230; but in doing so I started to think of alternatives. &lt;/p&gt;

&lt;p&gt;It just so happens this particular game does not rely on 3D graphics, complex animations or particularly advanced special FX, so I&amp;#8217;ve decided to write it in Webkit-friendly HTML/JS (that includes things like 3D transformations). That means I can use some of the most advanced HTML5 features, it also means that it will run on a wide variety of devices, such as Android. By using technologies like AIR I can provide a consistent webkit engine to platforms that don&amp;#8217;t inherently run it.&lt;/p&gt;

&lt;p&gt;For the most part I will continue to develop with Flash, but I think this illustrates that you have to weigh up your options and not be afraid of picking up new languages; programming is a cumulative and transferable skill.&lt;/p&gt;&lt;div class=&quot;sharethis&quot;&gt;
        &lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
          SHARETHIS.addEntry( {
            title : 'Adobe and HTML5',
              url   : 'http://www.richardleggett.co.uk/blog/index.php/2010/04/21/adobe-and-html5'}, 
            { popup: true }
          ) ;
        &lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://richardleggett.co.uk/blog/index.php/2010/04/21/adobe-and-html5&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>The recent news is that <a href="http://www.mikechambers.com/blog/10/04/20/on-adobe-flash-cs5-and-iphone-applications/">Adobe is going to abandon</a> the iPhone/iPad export feature in Flash CS5 after Apple revealed the controversial SDK <a href="http://daringfireball.net/2010/04/iphone_agreement_bans_flash_compiler">clause 3.3.1</a> which forbids applications that are not originally written in one of their approved technologies, namely C/Objective-C and HTML/JS.</p>

<p>So the official line is that Adobe is now focusing on getting the Flash Platform onto Android (along with existing targets, Nokia), and to be fair, even though that sounds like they&#8217;re just making the best of a bad situation, Android is going to be by far the biggest market judging by current growth indicators; the number of manufacturers producing all manner of devices that run it is truly staggering, the quality improving weekly.</p>

<p><a href="http://aralbalkan.com/">Aral</a> presented on something he called &#8220;Native X"; in a nutshell: why are Adobe obsessed with getting a one-size fits all runtime onto every device, rather than outputting native executables for a given platform? Presumably the argument is that a single runtime produces fewer cross-platform inconsistencies, but in reality this endeavour has proven very difficult to achieve. Flash Lite showed just how hard it can be, which for years consisted of a slower, older runtime running on certain Nokia smartphones, fragmented versions and implementations, the whole thing never really took off in a consistent way outside of Japan, and now Flash Player 10.1 and AIR is finally coming, should they continue down this route? </p>

<p>Flash CS5 showed an alternative &#8212;perhaps through necessity&#8212; which was outputting native apps for iPhone. By cross-compiling you can provide developers with familiar tools, but still target specific platforms. You do begin to introduce cross platform inconsistencies&#8230; does it have multi-touch or webcam (already a consideration in the FP) for example. Still, the win from being able to write something once and have it run on almost anything without too many changes far outweighs this problem. The alternative is to spend a <strong>lot</strong> of time and money writing once in Objective-C, again in Flash or Java&#8230; indie developers, thanks but no thanks.</p>

<p>The downside to this is that you will inevitably produce a one-size fits all set of capabilities, so you may lack access to a hardware feature which you could access in Objective-C. That&#8217;s fine, the point is you have a choice and you should not be forced to use something if your app or game doesn&#8217;t require it.</p>

<h3>What Can Adobe Do Next?</h3>


<p>Who could guess Adobe&#8217;s long term strategy? They may have this all figured out and this recent set-back is just a fly in the ointment. In a post &#8220;<a href="http://www.richardleggett.co.uk/blog/index.php/2010/02/01/the-world-is-moving-to-html5">The World is Moving to HTML 5 and Other Flights of Fancy</a>&#8221; I indicated that whilst Adobe have made a huge success out of the &#8220;Flash Platform", we have to remember the money has traditionally <a href="http://blogs.adobe.com/jnack/2010/01/sympathy_for_the_devil.html">come from tools</a>*. Flash CS5 and Flash Builder are just two tools that target the Flash Player, but there was once Director, and there is still Dreamweaver which has stood the test of time, of course Photoshop is used in pretty much anything you see online and in print. Tools, these are not something easily copied, they demand a premium.</p>

<p><em>*More recently we&#8217;ve seen a shift toward providing developer and consumer-facing services such as with Acrobat.com. I believe this to be a forward looking risk-reducing strategy, broadening the portfolio in-case of collapse in the desktop/app market, or perhaps just generating new scalable revenue streams.</em></p>

<p>So if I were the CEO of Adobe Systems, Shantanu Narayen, what actions would I take over the next 5 years? Partly this is a waiting game, the necessary features of HTML to make some of these leaps are still being ironed out, mainly thanks to IE 9 failing to add Canvas to an otherwise outstanding list of supported features. Instead it looks like SVG will provide the forward momentum for a large percentage of RIAs.</p>

<p>Either way, here are some things I&#8217;d consider&#8230;</p>

<p><em><strong>Technical</strong></em></p>

<p><strong>Slowly start to migrate focus away from the Flash Platform</strong> - That&#8217;s the player/runtime end of things. This step has the highest risk associated with it because Flash&#8217;s ability to do so much more than HTML even promises to in the specs has always has been the differentiator and why people use Flash in the first place.</p>

<p><strong>Focus on &#8220;Dream Builder&#8221;</strong> - Continue to develop the Flash IDE but focus on combining Flex Builder and Dreamweaver (ironically Flex Builder used to run in a Dreamweaver-like IDE, I propose the migration of Dreamweaver to Eclipse)&#8230;</p>

<p><strong>Develop the best HTML5/JS Editor</strong> - None of the hardcore JS people I know use Dreamweaver, which I found suprising until you realise the code completion is pretty worthless for OO code.  If Dreamweaver and Flex Builder were to combine, I would initially introduce &#8220;HTML Project&#8221; as a type in Flex Builder, which uses a Flex SDK targeting JS, including some of the familiar components, effects and so forth.</p>

<p><strong>Open source the Flash Player</strong> - provide the web with one of the greatest gifts it has ever seen. HTML specs progress slowly,  HTML5 really does just feel like a<a href="http://diveintohtml5.org/"> slight incremental improvement</a> over version 4 when you weight it up against the features in Flash Player 10.</p>

<p><strong>Work with the W3C</strong> - Providing the building blocks for technological innovations is one thing, getting any of it into the spec is another entirely. This probably needs to remain as hands off as possible for political reasons and wide-spread developer relations, whilst still supporting active development as many corporations do.</p>

<p><strong>Don&#8217;t stray too far from the underlying web technologies</strong> - In other words, don&#8217;t do a <a href="http://code.google.com/webtoolkit/overview.html">GWT</a> or face rejection.</p>

<p>Some of these things are simply unfathomable; &#8220;abandon the Flex SDK and build it again for HTML/JS?", no, not abandon, but aim to supplant in the very long term, this cannot happen overnight, and that&#8217;s a lot of extra man-power needed, but of course this would have to remain open-source as with Flex, and the developer audience would be enormous.</p>

<p><em><strong>People</strong></em></p>

<p>This is the really tough part, something I simply don&#8217;t have the experience to discuss with any meaning. It&#8217;s all well and good discussing what could be done with the products, with the specs, the technical side of things&#8230; but these are all supported by a hierachy of real people doing their jobs. No matter how slowly you do this people will lose jobs or move to another team.</p>

<p>Continuing to develop the Flash Player would see the very best developers adding those features that really wow us. The niche for cutting edge will not disappear (just like plug-ins), what I&#8217;m talking about here is the wider-web. The semantic, open web which has to, by its very nature, remain top dog.</p>

<h3>What Can Developers Do Now?</h3>


<p>I can only speak for myself. I&#8217;m writing a game which specifically targets tablet and surface computers, so I have to include the iPad in there of course. The news of Flash not being an option has also put me off using OpenPlug&#8217;s Elips Studio until we get confirmation of their situation&#8230; but in doing so I started to think of alternatives. </p>

<p>It just so happens this particular game does not rely on 3D graphics, complex animations or particularly advanced special FX, so I&#8217;ve decided to write it in Webkit-friendly HTML/JS (that includes things like 3D transformations). That means I can use some of the most advanced HTML5 features, it also means that it will run on a wide variety of devices, such as Android. By using technologies like AIR I can provide a consistent webkit engine to platforms that don&#8217;t inherently run it.</p>

<p>For the most part I will continue to develop with Flash, but I think this illustrates that you have to weigh up your options and not be afraid of picking up new languages; programming is a cumulative and transferable skill.</p><div class="sharethis">
        <script type="text/javascript" language="javascript">
          SHARETHIS.addEntry( {
            title : 'Adobe and HTML5',
              url   : 'http://richardleggett.co.uk/blog/index.php/2010/04/21/adobe-and-html5'}, 
            { popup: true }
          ) ;
        </script></div><br /><div class="item_footer"><p><small><a href="http://richardleggett.co.uk/blog/index.php/2010/04/21/adobe-and-html5">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://richardleggett.co.uk/blog/index.php/2010/04/21/adobe-and-html5#comments</comments>
			<wfw:commentRss>http://richardleggett.co.uk/blog/index.php?tempskin=_rss2&#38;disp=comments&#38;p=342</wfw:commentRss>
		</item>
				<item>
			<title>Flash/Flex Builder  Flash Professional Asset Workflows</title>
			<link>http://richardleggett.co.uk/blog/index.php/2010/03/08/flash_builder_and_flash_pro_asset_workflows</link>
			<pubDate>Mon, 08 Mar 2010 22:35:57 +0000</pubDate>			<dc:creator>Richard Leggett</dc:creator>
			<category domain="main">Flash</category>
<category domain="alt">Flex</category>			<guid isPermaLink="false">340@http://richardleggett.co.uk/blog/</guid>
						<description>&lt;p&gt;This post discusses the various workflows for producing SWFs with the standalone compiler that use graphical assets and animations created in Flash Professional (&quot;Flash Pro&quot;). At time of writing the latest version of Flash Pro is CS4, with CS5 briefly out in beta for a short while. Specifically we look at the methods that involve exporting SWCs and using the [Embed] metatag within class files.&lt;/p&gt;

&lt;p&gt;Recently I posted a &lt;a href=&quot;http://bugs.adobe.com/jira/browse/SDK-25756&quot;&gt;bug report&lt;/a&gt; regarding the [Embed] metatag, which led me to write this post in order to find out whether people are happy with their current workflows and how well others receive projects when it comes to handovers and maintenance.&lt;/p&gt;

&lt;h3&gt;Background&lt;/h3&gt;

&lt;p&gt;So you&amp;#8217;re building an application, a game, or a website. Immediately you have two options when it comes to setting up your Flash project. You can create an FLA file, assign a document class and get coding, or you can fire up Flash(/Flex) Builder/FDT/Flash Develop et al, create a new Flex or AS3 project and compile it using the Flex SDK compiler. Pretty much every time I&amp;#8217;ll opt for the latter because of the increased reliability of the application, and faster compile times.&lt;/p&gt;

&lt;p&gt;Even if you use the first option, compiling in Flash Pro itself, you may be actually editing your code in Flash Builder or some other IDE, but the point is the compiler being used in the former is Flash Pro, and in the latter mxmlc/compc the Flex SDK compilers. For the purpose of this post we&amp;#8217;ll be looking at Flex or AS3 projects using the Flex SDK compiler, and how to get assets from a FLA, into your project.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;ve written the following to the best of my knowledge, but there are always tips and tricks that I may be missing, perhaps an entire workflow. If you spot any inaccuracies or flaws please let me know in the comments and I&amp;#8217;ll change it ASAP.&lt;/p&gt;

&lt;h3&gt;Why an FLA at all?&lt;/h3&gt;

&lt;p&gt;You probably already know you can embed PNGs, SVG and other file types in your classes and never go near an FLA to get graphics into a SWF. When it comes to animations, you may use TweenLite or GTween to perform transitions, but when it comes to frame-based animation, character animation, or simply buttons and panels with hand-made flourishes you may want to use an FLA to create and animate these using the powerful timeline, graphics and animation tools within Flash Pro. &lt;/p&gt;

&lt;p&gt;It&amp;#8217;s at this point you ask yourself, how do I get these assets from a FLA into my project if I&amp;#8217;m not compiling my project in Flash Pro?&lt;/p&gt;

&lt;h3&gt;The Workflows&lt;/h3&gt;

&lt;p&gt;Here are 5 methods for getting assets from an FLA, into a Flex or &amp;#8220;pure AS3&amp;Prime; project. I&amp;#8217;ve excluded those which are MXML-only as this post is not about Flex specifically.&lt;/p&gt;

&lt;h4&gt;1. Publish SWC from FLA&lt;/h4&gt;

&lt;p&gt;This method involves linking library symbols to classes, so instead of &amp;#8220;MySymbol&amp;#8221; in the class field, you have &amp;#8220;com.package.MyClass&amp;#8221; which refers to a class file in one of the FLAs classpaths. You must then turn on SWC export in the FLA Publish Settings panel, and most likely turn off &amp;#8220;Automatically declare stage instances&amp;#8221; in the ActionScript 3 settings panel to avoid errors where your class has defined properties for items on stage. Finally add all of the required classpaths that the linked classes will be using (that could include 3rd party libraries) to avoid any compile-time errors.&lt;/p&gt;

&lt;p&gt;When you publish the SWF it&amp;#8217;ll also publish a SWC in the same folder. You add that SWC to your AS3 project and the classes/symbols compiled into it become available for use in your code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This method keeps any timeline ActionScript, great for complex, nested or multi-state animations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You have to compile the FLA every time you change a class linked to a symbol, in reality that can mean toggling to Flash, exporting the SWC, toggling back to Flash Builder, refreshing the project to re-build the SWC indexes and then recompiling the project here also.&lt;/p&gt;

&lt;p&gt;You have to make sure the classes your symbols are linked to are not in the main project source directory (or any directory the project is set to reference as source code). If you don&amp;#8217;t do this you will likely not see your graphics/animations appear because the Flex linker will find the class definition first, not the definition that is inside the SWC due to the compilation order. &lt;/p&gt;

&lt;p&gt;You have to add all required classpaths to the FLA, possibly every classpath your project is using.&lt;br /&gt;
 &lt;br /&gt;
Flash Builder will not report errors in the code used and you lose the ability to Ctrl/Cmd+Click to go to source.&lt;/p&gt;

&lt;p&gt;You don&amp;#8217;t have access to items on stage immediately, the workaround is pretty painful (&lt;a href=&quot;http://richardleggett.co.uk/blog/index.php/2008/02/18/enabling_access_to_timeline_items_in_as3&quot;&gt;link&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Whilst this is really the only sensible method for keeping timeline code, the cons make it a really un-intuitive and frustrating process. If anyone can suggest a way to improve this I&amp;#8217;ll owe you quite a few beers.&lt;/p&gt;

&lt;h4&gt;2. [Embed] tag above a class declaration&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;package my.package {&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;[Embed(source=&quot;assets/some.swf&quot;, symbol=&quot;SymbolName&quot;)]&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;public class MyClass {&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;// code&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;}&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Here we&amp;#8217;re simply using the SWF produced by an FLA to store our symbols. The FLA does not link any symbols to any classes itself, the library is simply full of vanilla MovieClips. In our class files we add the [Embed] tag and that binds the symbol from the SWF to the class, so that when we create a new instance of that class, we will also get the graphics from the library symbol.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros: &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You don&amp;#8217;t have to re-compile the FLA unless your graphics actually change.&lt;/p&gt;

&lt;p&gt;You can spend more time in your coding environment and not toggle back and forth between it and Flash Pro.&lt;/p&gt;

&lt;p&gt;You get real-time compilation errors in the Problems panel of Eclipse because the code is not coming from a SWC.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It strips ActionScript from the timeline of your symbols. If your symbol is an animation, and you had a few stop frames in there, perhaps one per labelled segment of animation, you&amp;#8217;ll lose these and the animation will just run through on loop. What you see coders do to circumvent this is use addFrameScript(5, stop); for every stop frame, or even using lots of frame labels to act as meta-tags for code replacement (&lt;a href=&quot;http://code.google.com/p/as3-asset-modifier/&quot;&gt;link&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Any children of the symbol lose any typing, so if you&amp;#8217;ve added a couple of MyButton&amp;#8217;s or a MyCustomWidget to your symbol on it&amp;#8217;s timeline, those become plain MovieClips. This is a huge problem which relegates this method to animations only.&lt;/p&gt;

&lt;h4&gt;3. [Embed] tag above a class property declaration&lt;/h4&gt;

&lt;p&gt;This method involves using the [Embed] tag above a class property, for example:&lt;/p&gt;

&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;[Embed(source=&quot;assets/some.swf&quot;, symbol=&quot;MySymbol&quot;)]&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;private var MySymbol:Class;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;// later on in a function...&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;var myInstance:Sprite = new MySymbol();&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So you can probably guess this is more of a composition-based approach, which works well for simple graphics, for multi-frame MovieClips you&amp;#8217;d type myInstance as MovieClip, and tell it to stop().&lt;/p&gt;

&lt;p&gt;With this method you&amp;#8217;re instance will either be a SpriteAsset (extends Sprite) or a MovieClipAsset (extends MovieClip), you cannot cast it to a custom class, so for a symbol that is meant to represent a contact form, with an instance of MyButtonClass or even just some TextFields in it, this will fail.&lt;/p&gt;

&lt;h4&gt;4. Embed metatag to embed a whole SWF&lt;/h4&gt;

&lt;p&gt;There&amp;#8217;s also another attribute available to the Embed metatag, that&amp;#8217;s mimeType. If you remove the symbol attribute and replace it with mimeType=&quot;application/octet-stream&amp;#8221; it will embed the entire SWF and preserve the class associations set up in the library, i.e. you won&amp;#8217;t have to have the instances typed to Sprite(/Asset) or MovieClip(/Asset).&lt;/p&gt;

&lt;p&gt;When you embed a symbol from a SWF in this way, you can then use Loader to get at the classes within:&lt;/p&gt;

&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;[Embed(source=&quot;assets/some.swf&quot;, mimeType=&quot;application/octet-stream&quot;)]&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;private var MySWF:Class;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;// within a method&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;var bytes:ByteArray = (new MySWF() as ByteArray);&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;var loader:Loader = new Loader();&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc7&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;loader.loadBytes(bytes, new LoaderContext(false, ApplicationDomain.currentDomain));&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc8&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc9&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;// wait for loader to dispatch Event.COMPLETE and...&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc0&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;var myClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition(&quot;com.package.MyClass&quot;);&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;var myInstance:DisplayObject = new myClass();&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;// myInstance is now an instance of the class linked to it&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Great way to provide a library symbol a class/some behaviour without having to constantly re-compile the FLA.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I think you&amp;#8217;ll agree that&amp;#8217;s not a great option if you have a lot of symbols or symbols which have others nested within. There are libraries to help with this, but&amp;#8230;&lt;br /&gt;
 &lt;br /&gt;
No strict typing.&lt;/p&gt;

&lt;h4&gt;5. Runtime loading a SWF&lt;/h4&gt;

&lt;p&gt;Perhaps the oldest option here, loading a SWF at runtime allows you to pull out symbols/classes using the applicationDomain.getDefinition() function as described in method 3. If you&amp;#8217;re already familiar with the getDefinitionByName() utility this works pretty much the same, but you are targeting a specific SWF&amp;#8217;s classes. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Great for loading content that rarely changes, such as fonts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Magic strings. Making a string a constant does not make it any less hacky, if you change the string in your FLA, your constant is meaningless, and you&amp;#8217;ll only find out about it at runtime if that piece of code executes.&lt;/p&gt;

&lt;p&gt;You&amp;#8217;ll have to export your SWF from an FLA or using one of the other techniques which means you&amp;#8217;ll also have some of the problems associated with those.&lt;/p&gt;

&lt;h3&gt;Feedback&lt;/h3&gt;

&lt;p&gt;So what route do you take? Please also state the type of project: application, game, website; it&amp;#8217;s quite possible that people building applications simply never encounter these issues due to the primarily scripted animation and simple non-hierarchical graphical assets. &lt;/p&gt;

&lt;p&gt;You may also want to consider how easy it will be to start compiling in Flash Professional in order to take advantage of CS5&amp;#8217;s export to iPhone, this can impact your decision on which method you use.&lt;/p&gt;

&lt;p&gt;Overall I feel that whilst choice is great, each method seems to have pretty serious downsides, and I&amp;#8217;m yet to find one that doesn&amp;#8217;t make for a less than pleasant rinse-and-repeat workflow. It would be nice to be able use Flash Pro to speed up the process of preparing game assets, laying stuff out on stage, animating on the timeline&amp;#8230; but there are too many down-sides associated with this, and too many idiosyncrasies to learn just to get things working, I hope in future the two tools can be brought closer together perhaps through &lt;a href=&quot;http://www.moock.org/blog/archives/000269.html&quot;&gt;the new file format&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As usual, all comments welcome, unless you&amp;#8217;re the bargain-dishwasher spammer.&lt;/p&gt;

&lt;h3&gt;Further reading&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://www.bit-101.com/blog/?p=853&quot;&gt;http://www.bit-101.com/blog/?p=853&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;http://www.bit-101.com/blog/?p=864&quot;&gt;http://www.bit-101.com/blog/?p=864&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;http://gskinner.com/blog/archives/2007/03/using_flash_sym.html&quot;&gt;http://gskinner.com/blog/archives/2007/03/using_flash_sym.html&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.airtightinteractive.com/news/?p=327&quot;&gt;http://www.airtightinteractive.com/news/?p=327&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also the &lt;a href=&quot;http://livedocs.adobe.com/flex/3/html/help.html?content=embed_4.html&quot;&gt;Flex Livedocs&lt;/a&gt;, which certainly don&amp;#8217;t explain all of these methods in nearly enough detail or context, which makes using the Flex SDK a darker art than it could be.&lt;/p&gt;&lt;div class=&quot;sharethis&quot;&gt;
        &lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
          SHARETHIS.addEntry( {
            title : 'Flash/Flex Builder  Flash Professional Asset Workflows',
              url   : 'http://richardleggett.co.uk/blog/index.php/2010/03/08/flash_builder_and_flash_pro_asset_workflows'}, 
            { popup: true }
          ) ;
        &lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://richardleggett.co.uk/blog/index.php/2010/03/08/flash_builder_and_flash_pro_asset_workflows&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>This post discusses the various workflows for producing SWFs with the standalone compiler that use graphical assets and animations created in Flash Professional ("Flash Pro"). At time of writing the latest version of Flash Pro is CS4, with CS5 briefly out in beta for a short while. Specifically we look at the methods that involve exporting SWCs and using the [Embed] metatag within class files.</p>

<p>Recently I posted a <a href="http://bugs.adobe.com/jira/browse/SDK-25756">bug report</a> regarding the [Embed] metatag, which led me to write this post in order to find out whether people are happy with their current workflows and how well others receive projects when it comes to handovers and maintenance.</p>

<h3>Background</h3>

<p>So you&#8217;re building an application, a game, or a website. Immediately you have two options when it comes to setting up your Flash project. You can create an FLA file, assign a document class and get coding, or you can fire up Flash(/Flex) Builder/FDT/Flash Develop et al, create a new Flex or AS3 project and compile it using the Flex SDK compiler. Pretty much every time I&#8217;ll opt for the latter because of the increased reliability of the application, and faster compile times.</p>

<p>Even if you use the first option, compiling in Flash Pro itself, you may be actually editing your code in Flash Builder or some other IDE, but the point is the compiler being used in the former is Flash Pro, and in the latter mxmlc/compc the Flex SDK compilers. For the purpose of this post we&#8217;ll be looking at Flex or AS3 projects using the Flex SDK compiler, and how to get assets from a FLA, into your project.</p>

<p>I&#8217;ve written the following to the best of my knowledge, but there are always tips and tricks that I may be missing, perhaps an entire workflow. If you spot any inaccuracies or flaws please let me know in the comments and I&#8217;ll change it ASAP.</p>

<h3>Why an FLA at all?</h3>

<p>You probably already know you can embed PNGs, SVG and other file types in your classes and never go near an FLA to get graphics into a SWF. When it comes to animations, you may use TweenLite or GTween to perform transitions, but when it comes to frame-based animation, character animation, or simply buttons and panels with hand-made flourishes you may want to use an FLA to create and animate these using the powerful timeline, graphics and animation tools within Flash Pro. </p>

<p>It&#8217;s at this point you ask yourself, how do I get these assets from a FLA into my project if I&#8217;m not compiling my project in Flash Pro?</p>

<h3>The Workflows</h3>

<p>Here are 5 methods for getting assets from an FLA, into a Flex or &#8220;pure AS3&Prime; project. I&#8217;ve excluded those which are MXML-only as this post is not about Flex specifically.</p>

<h4>1. Publish SWC from FLA</h4>

<p>This method involves linking library symbols to classes, so instead of &#8220;MySymbol&#8221; in the class field, you have &#8220;com.package.MyClass&#8221; which refers to a class file in one of the FLAs classpaths. You must then turn on SWC export in the FLA Publish Settings panel, and most likely turn off &#8220;Automatically declare stage instances&#8221; in the ActionScript 3 settings panel to avoid errors where your class has defined properties for items on stage. Finally add all of the required classpaths that the linked classes will be using (that could include 3rd party libraries) to avoid any compile-time errors.</p>

<p>When you publish the SWF it&#8217;ll also publish a SWC in the same folder. You add that SWC to your AS3 project and the classes/symbols compiled into it become available for use in your code.</p>

<p><strong>Pros:</strong></p>

<p>This method keeps any timeline ActionScript, great for complex, nested or multi-state animations.</p>

<p><strong>Cons:</strong></p>

<p>You have to compile the FLA every time you change a class linked to a symbol, in reality that can mean toggling to Flash, exporting the SWC, toggling back to Flash Builder, refreshing the project to re-build the SWC indexes and then recompiling the project here also.</p>

<p>You have to make sure the classes your symbols are linked to are not in the main project source directory (or any directory the project is set to reference as source code). If you don&#8217;t do this you will likely not see your graphics/animations appear because the Flex linker will find the class definition first, not the definition that is inside the SWC due to the compilation order. </p>

<p>You have to add all required classpaths to the FLA, possibly every classpath your project is using.<br />
 <br />
Flash Builder will not report errors in the code used and you lose the ability to Ctrl/Cmd+Click to go to source.</p>

<p>You don&#8217;t have access to items on stage immediately, the workaround is pretty painful (<a href="http://richardleggett.co.uk/blog/index.php/2008/02/18/enabling_access_to_timeline_items_in_as3">link</a>).</p>

<p><strong>Summary:</strong></p>

<p>Whilst this is really the only sensible method for keeping timeline code, the cons make it a really un-intuitive and frustrating process. If anyone can suggest a way to improve this I&#8217;ll owe you quite a few beers.</p>

<h4>2. [Embed] tag above a class declaration</h4>

<p><strong>Example:</strong></p>

<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default">package my.package {</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code><span class="amc_default">&#160;&#160;[Embed(source="assets/some.swf", symbol="SymbolName")]</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code><span class="amc_default">&#160;&#160;public class MyClass {</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code><span class="amc_default">&#160;&#160;// code</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code><span class="amc_default">&#160;&#160;}</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code><span class="amc_default">}</span></code></td></tr>
</table></div>

<p>Here we&#8217;re simply using the SWF produced by an FLA to store our symbols. The FLA does not link any symbols to any classes itself, the library is simply full of vanilla MovieClips. In our class files we add the [Embed] tag and that binds the symbol from the SWF to the class, so that when we create a new instance of that class, we will also get the graphics from the library symbol.</p>

<p><strong>Pros: </strong></p>

<p>You don&#8217;t have to re-compile the FLA unless your graphics actually change.</p>

<p>You can spend more time in your coding environment and not toggle back and forth between it and Flash Pro.</p>

<p>You get real-time compilation errors in the Problems panel of Eclipse because the code is not coming from a SWC.</p>

<p><strong>Cons:</strong></p>

<p>It strips ActionScript from the timeline of your symbols. If your symbol is an animation, and you had a few stop frames in there, perhaps one per labelled segment of animation, you&#8217;ll lose these and the animation will just run through on loop. What you see coders do to circumvent this is use addFrameScript(5, stop); for every stop frame, or even using lots of frame labels to act as meta-tags for code replacement (<a href="http://code.google.com/p/as3-asset-modifier/">link</a>).</p>

<p>Any children of the symbol lose any typing, so if you&#8217;ve added a couple of MyButton&#8217;s or a MyCustomWidget to your symbol on it&#8217;s timeline, those become plain MovieClips. This is a huge problem which relegates this method to animations only.</p>

<h4>3. [Embed] tag above a class property declaration</h4>

<p>This method involves using the [Embed] tag above a class property, for example:</p>

<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default">[Embed(source="assets/some.swf", symbol="MySymbol")]</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code><span class="amc_default">private var MySymbol:Class;</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code>&nbsp;</code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code><span class="amc_default">// later on in a function...</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code>&nbsp;</code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code><span class="amc_default">var myInstance:Sprite = new MySymbol();</span></code></td></tr>
</table></div>

<p>So you can probably guess this is more of a composition-based approach, which works well for simple graphics, for multi-frame MovieClips you&#8217;d type myInstance as MovieClip, and tell it to stop().</p>

<p>With this method you&#8217;re instance will either be a SpriteAsset (extends Sprite) or a MovieClipAsset (extends MovieClip), you cannot cast it to a custom class, so for a symbol that is meant to represent a contact form, with an instance of MyButtonClass or even just some TextFields in it, this will fail.</p>

<h4>4. Embed metatag to embed a whole SWF</h4>

<p>There&#8217;s also another attribute available to the Embed metatag, that&#8217;s mimeType. If you remove the symbol attribute and replace it with mimeType="application/octet-stream&#8221; it will embed the entire SWF and preserve the class associations set up in the library, i.e. you won&#8217;t have to have the instances typed to Sprite(/Asset) or MovieClip(/Asset).</p>

<p>When you embed a symbol from a SWF in this way, you can then use Loader to get at the classes within:</p>

<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default">[Embed(source="assets/some.swf", mimeType="application/octet-stream")]</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code><span class="amc_default">private var MySWF:Class;</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code>&nbsp;</code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code><span class="amc_default">// within a method</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code><span class="amc_default">var bytes:ByteArray = (new MySWF() as ByteArray);</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code><span class="amc_default">var loader:Loader = new Loader();</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc7"></div></td><td><code><span class="amc_default">loader.loadBytes(bytes, new LoaderContext(false, ApplicationDomain.currentDomain));</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc8"></div></td><td><code>&nbsp;</code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc9"></div></td><td><code><span class="amc_default">// wait for loader to dispatch Event.COMPLETE and...</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc1"></div></div></td><td><code><span class="amc_default">var myClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("com.package.MyClass");</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc1"><div class="amc1"></div></div></td><td><code><span class="amc_default">var myInstance:DisplayObject = new myClass();</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc2"><div class="amc1"></div></div></td><td><code><span class="amc_default">// myInstance is now an instance of the class linked to it</span></code></td></tr>
</table></div>

<p><strong>Pros:</strong></p>

<p>Great way to provide a library symbol a class/some behaviour without having to constantly re-compile the FLA.</p>

<p><strong>Cons:</strong></p>

<p>I think you&#8217;ll agree that&#8217;s not a great option if you have a lot of symbols or symbols which have others nested within. There are libraries to help with this, but&#8230;<br />
 <br />
No strict typing.</p>

<h4>5. Runtime loading a SWF</h4>

<p>Perhaps the oldest option here, loading a SWF at runtime allows you to pull out symbols/classes using the applicationDomain.getDefinition() function as described in method 3. If you&#8217;re already familiar with the getDefinitionByName() utility this works pretty much the same, but you are targeting a specific SWF&#8217;s classes. </p>

<p><strong>Pros:</strong></p>

<p>Great for loading content that rarely changes, such as fonts.</p>

<p><strong>Cons:</strong></p>

<p>Magic strings. Making a string a constant does not make it any less hacky, if you change the string in your FLA, your constant is meaningless, and you&#8217;ll only find out about it at runtime if that piece of code executes.</p>

<p>You&#8217;ll have to export your SWF from an FLA or using one of the other techniques which means you&#8217;ll also have some of the problems associated with those.</p>

<h3>Feedback</h3>

<p>So what route do you take? Please also state the type of project: application, game, website; it&#8217;s quite possible that people building applications simply never encounter these issues due to the primarily scripted animation and simple non-hierarchical graphical assets. </p>

<p>You may also want to consider how easy it will be to start compiling in Flash Professional in order to take advantage of CS5&#8217;s export to iPhone, this can impact your decision on which method you use.</p>

<p>Overall I feel that whilst choice is great, each method seems to have pretty serious downsides, and I&#8217;m yet to find one that doesn&#8217;t make for a less than pleasant rinse-and-repeat workflow. It would be nice to be able use Flash Pro to speed up the process of preparing game assets, laying stuff out on stage, animating on the timeline&#8230; but there are too many down-sides associated with this, and too many idiosyncrasies to learn just to get things working, I hope in future the two tools can be brought closer together perhaps through <a href="http://www.moock.org/blog/archives/000269.html">the new file format</a>.</p>

<p>As usual, all comments welcome, unless you&#8217;re the bargain-dishwasher spammer.</p>

<h3>Further reading</h3>

<p><a href="http://www.bit-101.com/blog/?p=853">http://www.bit-101.com/blog/?p=853</a> <br />
<a href="http://www.bit-101.com/blog/?p=864">http://www.bit-101.com/blog/?p=864</a> <br />
<a href="http://gskinner.com/blog/archives/2007/03/using_flash_sym.html">http://gskinner.com/blog/archives/2007/03/using_flash_sym.html</a><br />
<a href="http://www.airtightinteractive.com/news/?p=327">http://www.airtightinteractive.com/news/?p=327</a></p>

<p>Also the <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=embed_4.html">Flex Livedocs</a>, which certainly don&#8217;t explain all of these methods in nearly enough detail or context, which makes using the Flex SDK a darker art than it could be.</p><div class="sharethis">
        <script type="text/javascript" language="javascript">
          SHARETHIS.addEntry( {
            title : 'Flash/Flex Builder  Flash Professional Asset Workflows',
              url   : 'http://richardleggett.co.uk/blog/index.php/2010/03/08/flash_builder_and_flash_pro_asset_workflows'}, 
            { popup: true }
          ) ;
        </script></div><br /><div class="item_footer"><p><small><a href="http://richardleggett.co.uk/blog/index.php/2010/03/08/flash_builder_and_flash_pro_asset_workflows">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://richardleggett.co.uk/blog/index.php/2010/03/08/flash_builder_and_flash_pro_asset_workflows#comments</comments>
			<wfw:commentRss>http://richardleggett.co.uk/blog/index.php?tempskin=_rss2&#38;disp=comments&#38;p=340</wfw:commentRss>
		</item>
				<item>
			<title>"The World is Moving to HTML 5" and Other Flights of Fancy</title>
			<link>http://richardleggett.co.uk/blog/index.php/2010/02/01/the-world-is-moving-to-html5</link>
			<pubDate>Mon, 01 Feb 2010 14:43:38 +0000</pubDate>			<dc:creator>Richard Leggett</dc:creator>
			<category domain="main">Flash</category>
<category domain="alt">General</category>
<category domain="alt">AJAX</category>
<category domain="alt">3D</category>
<category domain="alt">DHTML</category>
<category domain="alt">Development</category>			<guid isPermaLink="false">338@http://richardleggett.co.uk/blog/</guid>
						<description>&lt;p&gt;Disclaimer: This post is not about defending Flash. I couldn&amp;#8217;t care less whether Flash sees another year, nor do I care what language I type into my computer as long as it does the job better than anything else. I would rather just the one option, but more on that later.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&amp;#8220;The World is moving to HTML 5&amp;Prime; &lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This poignant, yet immediately dated and tautological quote is supposedly from Steve Jobs, as reported by &lt;a href=&quot;http://www.wired.com/epicenter/2010/01/googles-dont-be-evil-mantra-is-bullshit-adobe-is-lazy-apples-steve-jobs/&quot;&gt;Wired&lt;/a&gt;. The article speaks of HTML 5 being used to create sophisticated web pages, and I wholeheartedly agree. If you are building web pages, HTML and JavaScript are almost always the right technologies to use, but we went beyond solely building web pages many years ago. Web pages are not the only type of internet destination, even though the ever vocal standardistas seem to think that&amp;#8217;s what everyone wants. I say get your head out of the sand, it&amp;#8217;s nice out. &lt;/p&gt;

&lt;h3&gt;Types of Web Content&lt;/h3&gt;

&lt;p&gt;We can break down web content into four main categories:&lt;/p&gt;

&lt;h4&gt;Pages&lt;/h4&gt;

&lt;p&gt;Pages were once the only type of content to be found in a web browser, primarily there for information display with very little user interaction, they are designed to provide the desired content as fast as possible, as such they tend to use text as the primary method of communication, they work very well with search engines, and they date just as fast as anything else (&lt;a href=&quot;http://www.microsoft.com/misc/features/features_flshbk_hp1.htm&quot;&gt;Microsoft&amp;#8217;s first web presence&lt;/a&gt;).&lt;/p&gt;

&lt;h4&gt;Dynamic Pages&lt;/h4&gt;

&lt;p&gt;We have in this category the semi-interactive stuff that AJAX has found a home with, adding dynamism to an otherwise static page, and it does this stuff very well indeed. In short, it&amp;#8217;s all very direct and to the point, it works outstandingly well. If you had to wait for an intro to play before you found out the price of the avocado you want to buy from your online supermarket you&amp;#8217;d go elsewhere. &lt;/p&gt;

&lt;h4&gt;Experience and Brands&lt;/h4&gt;

&lt;p&gt;Then again, if you&amp;#8217;re a 14 year old boy who loves watching Top Gear and you&amp;#8217;re being delivered a loud, visceral and engaging experience for a super-car brand, this is the 21st century equivalent of that Ferrari F40 poster on your wall, that aspirational experience now even more compelling; one day you&amp;#8217;ll drive that car. It may be interesting to some people to scroll through a highly efficient search engine friendly static page to see this kind of thing, but it&amp;#8217;s really very boring for most people. There is a world of purely enjoyable content out there; don&amp;#8217;t paint it grey. If you&amp;#8217;re trying to build a brand, you have to tell a story.&lt;/p&gt;

&lt;h4&gt;Applications and Games&lt;/h4&gt;

&lt;p&gt;This is really a big part of what the web is today. Web-deployed applications and games have proven their worth. Open to wide audiences across multiple platforms, secure, immediately updateable, cheap to develop, and getting ever more sophisticated. If you look at these examples all done in Flash, I&amp;#8217;d ask you what else you&amp;#8217;d use that ticks all those boxes:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://aviary.com/&quot;&gt;Aviary&lt;/a&gt; - everything from bitmap and vector editors, texture generator to an audio editor, truly incredible.&lt;/li&gt;

  &lt;li&gt;&lt;a href=&quot;http://www.hobnox.com/index.1056.en.html&quot;&gt;Hobnox audio tool&lt;/a&gt; - emulates in real time, hardware instruments for creating electronic music.&lt;/li&gt;

  &lt;li&gt;&lt;a href=&quot;http://www.bbc.co.uk/cbeebies/bigandsmall/#/lb/bigandsmall/bigandsmallhouse&quot;&gt;Big and Small&lt;/a&gt; - Content for kids, it has to be fun and interactive to compete with TV. &lt;/li&gt;

  &lt;li&gt;&lt;a href=&quot;http://www.google.co.uk/help/maps/streetview/&quot;&gt;Google Street View&lt;/a&gt; - The reality is, the transitions and interaction that make it so impressive, require Flash, and we know Google are pretty much the best in the business at AJAX.&lt;/li&gt;

&lt;/ul&gt;
&lt;p&gt;I wouldn&amp;#8217;t underestimate the shift to web-based applications, IMHO &lt;strong&gt;nearly all applications will be web-based in the next 5 years&lt;/strong&gt;; applications that include office suites, image and video editors, casual and hardcore games, music production software, and of course the most ubiquitous, social networking and media sharing. All of these are equally deserving of being available to users of a web browser, all of these requiring the most cutting edge technology available in order to stand out from the crowd and avoid being locked into the glacial flow of web standards progression.&lt;/p&gt;

&lt;h3&gt;Plugins&lt;/h3&gt;

&lt;p&gt;Plugins drive things forward by letting non-techies bolt on new functionality. Director, Flash, Unity all did or still do their part. Zoom forward 5 years and let us visit a perfect world where all the major browser vendors, including the behemoth Microsoft, have agreed on the various parts of &amp;#8220;HTML 5&amp;Prime;. Miraculously IE supports the same Canvas abilities and video codecs as the iPhone, Android and Nokia browsers, Mozilla (Firefox) has conceded to paying h264 royalty fees, sites with video content have conceded to paying &lt;a href=&quot;http://streaminglearningcenter.com/articles/h264-royalties-what-you-need-to-know.html&quot;&gt;h264 broadcast fees&lt;/a&gt;, everything is gonna be allllright. The issue now is that things are looking a bit dated, the browser can now natively do what Flash applications were doing 5 years ago. This is a never ending game of cat and mouse, no-one can argue one is better than the other when nothing is standing still.&lt;/p&gt;

&lt;p&gt;And so what now? What about new technologies, where&amp;#8217;s the now ubiquitous multitouch we&amp;#8217;re used to seeing since Flash 10.1, since iPhone and Android devices dominated the markets. Maybe that&amp;#8217;s in the HTML 6 spec, maybe just in Firefox, how many more years after we start using it does it become standard. Along with multi-touch there will be many more features missing, we will still need plugins. Flash has added a myriad new features that game programmers and web developers are using to create a whole new level of experience that has obliterated the console and desktop software markets. HTML 5 is starting to look a lot like HTML 4 used to. Long in the tooth.&lt;/p&gt;

&lt;h3&gt;HTML 5&lt;/h3&gt;

&lt;p&gt;If we come back to today, I think it&amp;#8217;s important to clear up just what this HTML 5 really means. It&amp;#8217;s more than a spec, in general the term is used to refer to the many  sub-technologies involved, including new HTML markup, the Canvas tag for 2D (and possibly in future 3D) static and dynamically scripted graphics, fast JavaScript VM&amp;#8217;s like Tamarin (donated by Adobe), a video tag for playing back a choice of video files, and possibly WebGL which aims to bring OpenGL 3D graphics to the web on par with Unity3D perhaps. I need to make it clear that I really want this to happen, no matter how open to feedback Adobe are, no matter how open the SWF format is, it does not sit well with me that one vendor controls what will and will not go in to the runtime, and it&amp;#8217;s still a plugin, no matter how easy and fast it installs, something doesn&amp;#8217;t quite feel right about it. &lt;/p&gt;

&lt;p&gt;But I live in the real world, it&amp;#8217;s mainly this technology that I&amp;#8217;ve used to pay my way since I was 16, and that doesn&amp;#8217;t show any signs of slowing. I am 100% willing to use HTML 5 if it suits the job. I&amp;#8217;m not sitting around either, trust me. No flash developers are tied in to using it. But there are too many things stopping me from switching. Let&amp;#8217;s take the hot topic of the day, the &amp;lt;video&amp;gt; tag; it doesn&amp;#8217;t even replace what you could do with Flash 8 or 9 let alone some of the cool things &lt;a href=&quot;http://www.youtube.com/watch?v=2zuOdJQiljw&amp;amp;feature=youtu.be&quot;&gt; you can do *right now*&lt;/a&gt; (no waiting)&amp;#8230;&lt;/p&gt;

&lt;h3&gt;Video&lt;/h3&gt;

&lt;p&gt;Flash is not video. The Flash Player was installed on over 90% of internet connected computers before YouTube, when Flash video was limited to the early Sorenson Spark codec, optimised for small files that performed really badly at anything larger than 320x240, and 8 years ago when performance was so bad with Flash video we were using postage stamp sized video, but it was the immediacy of the playback that made it successful over more powerful plugins like Quicktime, WMV or Real Player. Either way, Flash video clearly changed the web, no more picking a plugin, picking your bandwidth, looking at truly ugly system chrome, so let&amp;#8217;s look at what we need to see from HTML 5 video for it to displace Flash as the most efficient, cost effective and flexible solution:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;DRM - Boo, evil. Whatever your personal view on DRM, broadcast corporations want it.&lt;/li&gt;


  &lt;li&gt;True multi-bitrate streaming - Efficient live feeds across the globe that alters bitrate to suit current bandwidth, multicast (Flash Player 10 also supports a P2P UDP to take pressure off the server, or provide much faster messaging in games).&lt;/li&gt;


  &lt;li&gt;Internet Explorer - The truth of the matter is that it has to work with IE. If you&amp;#8217;re using Flash as a fallback, as suggested by ALL current HTML 5 video player supporters, why are you making more work for yourself? For a simple video player fine, but a lot of video is increasingly interactive. YouTube for example overlay recommendations, annotations, detected music, and even live commenting, you really want to do this twice?&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;If &amp;gt;&lt;a href=&quot;http://jilion.com/sublime/video&quot;&gt;this&lt;/a&gt;&amp;lt; is the cream of the crop right now, and it doesn&amp;#8217;t even work in Firefox or Internet Explorer (percentages?), what is there to shout about?&lt;/p&gt;

&lt;h3&gt;Yeah but Flash eats 100% of my CPU&lt;/h3&gt;

&lt;p&gt;In a sentence: so do the most basic HTML 5 experiments (&lt;a href=&quot;http://9elements.com/io/projects/html5/canvas/&quot;&gt;link&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;An empty SWF consumes ~0% of my CPU, funnily enough the same amount as an empty web page. When something eats 100% of the CPU, it&amp;#8217;s because is is doing something computationally expensive, possibly animating high quality 32-bit images whilst applying real time bitmap effects so that you can see just how that logo will look on this crumpled T-Shirt before you send it off to be printed. The CPU usage is not automatically higher with Flash, it&amp;#8217;s down to the design and programmer to figure out what they want to achieve, and optimise it to whatever they find acceptable for their intended audience. JavaScript can and does use 100% CPU in some of the best apps out there, we just don&amp;#8217;t see many apps that are up to the level of the Flash apps linked to earlier in this post. Video acceleration is a fair point until you consider video is also a display object in the Flash Player that can have these filters, transformations and so on applied in real time, that comes at a cost, however with Flash Player 10.1 hardware acceleration is starting to come into play, a truly impressive feat for such a small cross platform runtime.&lt;/p&gt;

&lt;h3&gt;If we kill Flash, we kill annoying banner ads&lt;/h3&gt;

&lt;p&gt;It&amp;#8217;s also the case that displacing Flash will not get rid of annoying banner ads, agencies will just use &amp;lt;canvas&amp;gt; and &amp;lt;video&amp;gt;, don&amp;#8217;t kid yourself, it&amp;#8217;ll be those same Flash developers making it, they would simply re-tool and utilise their existing experience to produce infuriating ads in whatever makes the biggest impact. The internet is only less annoying with things like FlashBlock because only a tiny drop in the ocean of internet users use Flash block so they scoot under the radar. They are excluding themselves from the mainstream for this small benefit and more power to you for doing that, it&amp;#8217;s up to you. &lt;/p&gt;

&lt;h3&gt;Browser integration&lt;/h3&gt;

&lt;p&gt;This is a major sorepoint for me as my primary job has been developing ever more complex Flash applications that are deployed on the web and on the desktop (indeed to replace existing desktop apps). You can communicate in real time between JavaScript and Flash, passing simple and complex data types between them, but it&amp;#8217;s still a black box on the page. This is a really tough nut to crack, if you spend just 10 minutes asking yourself how you could get a native desktop application that you&amp;#8217;ve embedded in a page to play well with the HTML around it, you&amp;#8217;ll see why it simply doesn&amp;#8217;t make sense, we shouldn&amp;#8217;t try to shoe-horn these things.&lt;/p&gt;

&lt;h3&gt;The Semantic Web and Accessibility&lt;/h3&gt;

&lt;p&gt;Another gotcha. I can absolutely agree these things are so very important, depending on the content. What on earth is the point of making accessible a site where the entire aim is to build a burger out of people dressed up as beef, buns and lettuce, running and jumping on one another in a video montage. You may think the site should not exist anyway, but who are we to dictate what kind of content can be put online. Some idiots love this stuff and clearly so did Burger King! What about a game like &lt;a href=&quot;http://www.dofus.com/en/mmorpg-free/play&quot;&gt;Dofus&lt;/a&gt;? Semantics and accessibility don&amp;#8217;t apply to everything. You can build Flash sites to be accessible, you can &lt;a href=&quot;http://richardleggett.co.uk/blog/index.php/2009/06/23/creating-drupal-sites-with-flash-or-flex&quot;&gt;build them on top of a CMS like Drupal&lt;/a&gt; to make sure you get the best of both worlds. In summary, use the right tool for the job.&lt;/p&gt;

&lt;h3&gt;Mobile&lt;/h3&gt;

&lt;p&gt;This one is very important to me. Hand on heart, devices that we now consider mobile: phones and tablets; these are going to be how 90% of people use computers, period. There&amp;#8217;s simply no need for bulky laptops and desktops for non-professionals. Wireless TV connections let you get that big screen experience when you need it, but the redundancy in devices will be huge. This became clear in my own circle of entirely non-geek friends already, almost exclusively using mobile devices for everything, and this at the very beginning of the full-on shift to web-apps.&lt;/p&gt;

&lt;p&gt;It became quite clear to me in 2007 (&lt;a href=&quot;http://richardleggett.co.uk/blog/index.php/2007/10/22/does_flash_lite_have_a_future&quot;&gt;link&lt;/a&gt;) that Flash was never going to do well on mobile until it was the same runtime as the one we were using on the web, especially when it was licensed per handset. Funnily enough I called that convergent version &amp;#8220;Flash X&quot;, and it turns out &amp;#8220;X&quot;, by pure coincident, was right, in a roman numerals kinda way. Flash 10.1 has been optimised to run on lower powered CPUs like ARM chips found in iPhones and Android devices.&lt;/p&gt;

&lt;h3&gt;Hating Adobe&lt;/h3&gt;

&lt;p&gt;The animosity directed at Adobe is unusual. They simply invest in whatever proves popular in order to generate revenue, and they&amp;#8217;ve had a lot of popular HTML/JS editing tools, even &lt;a href=&quot;http://blogs.adobe.com/jnack/2009/10/sneak_peek_ai_fl_dw_canvas.html&quot;&gt;demoing Canvas support&lt;/a&gt; in the next Dreamweaver IDE. When Director started to die, occasionally being used for the odd online 3D game, and Flash took off, they invested time and money into creating what they like to call the Flash Platform. A range of commercial and open source tools, open-spec file formats for rich media, binary data transfer and a video container, a runtime, and a few free and commercial serverside offerings. They are not forcing anyone to use this stuff, if we stop using it they will move on like they have in the past, investing in whatever it is people &lt;em&gt;do&lt;/em&gt; want to code in. In my opinion, Adobe will be the second big player, after Apple, to fully embrace HTML 5 in their software, with Microsoft lagging behind a very long way.&lt;/p&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;To everyone shouting support for HTML 5 as the flash killer, if that were really possible don&amp;#8217;t you think Flash developers would already be doing it? We are a thriving community positively chomping at the bit to try out new stuff, I&amp;#8217;m presenting on Android at a Flash user group shortly, we don&amp;#8217;t hang around. We weren&amp;#8217;t born knowing ActionScript 1, 2 or 3 and we have to live in the real world, we may even be right next to you &lt;img src=&quot;http://www.richardleggett.co.uk/blog/rsc/smilies/icon_wink.gif&quot; alt=&quot;&amp;#59;&amp;#41;&quot; class=&quot;middle&quot; /&gt; Indeed many Flash developers are also HTML/JS developers and may practice a serverside language in smaller companies. It just leads to frustration when we hear &amp;#8220;use HTML 5&amp;Prime; when it is not supported even across desktop browsers. What version of IE should we be targeting before we can start building the rich compelling experiences we&amp;#8217;re used to.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The world will move to HTML X when Flash X is not needed, it is a non-argument, no amount of insane zealous preaching from within the idealist world of either side will make this happen in the real world. The market will use whatever tools provide the best solutions for the best return on investment. &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I can&amp;#8217;t wait till we get through this next transitionary period, with web designers having to spend twice the effort providing Flash fallbacks to video, companies encoding and hosting their videos twice for Firefox, licenses and royalties for h264, this will be another messy, frustrating time for web users and progress may slow, but I can&amp;#8217;t see a way around it.&lt;/p&gt;&lt;div class=&quot;sharethis&quot;&gt;
        &lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
          SHARETHIS.addEntry( {
            title : '&amp;quot;The World is Moving to HTML 5&amp;quot; and Other Flights of Fancy',
              url   : 'http://www.richardleggett.co.uk/blog/index.php/2010/02/01/the-world-is-moving-to-html5'}, 
            { popup: true }
          ) ;
        &lt;/script&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://richardleggett.co.uk/blog/index.php/2010/02/01/the-world-is-moving-to-html5&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Disclaimer: This post is not about defending Flash. I couldn&#8217;t care less whether Flash sees another year, nor do I care what language I type into my computer as long as it does the job better than anything else. I would rather just the one option, but more on that later.</p>

<p><em>&#8220;The World is moving to HTML 5&Prime; </em></p>

<p>This poignant, yet immediately dated and tautological quote is supposedly from Steve Jobs, as reported by <a href="http://www.wired.com/epicenter/2010/01/googles-dont-be-evil-mantra-is-bullshit-adobe-is-lazy-apples-steve-jobs/">Wired</a>. The article speaks of HTML 5 being used to create sophisticated web pages, and I wholeheartedly agree. If you are building web pages, HTML and JavaScript are almost always the right technologies to use, but we went beyond solely building web pages many years ago. Web pages are not the only type of internet destination, even though the ever vocal standardistas seem to think that&#8217;s what everyone wants. I say get your head out of the sand, it&#8217;s nice out. </p>

<h3>Types of Web Content</h3>

<p>We can break down web content into four main categories:</p>

<h4>Pages</h4>

<p>Pages were once the only type of content to be found in a web browser, primarily there for information display with very little user interaction, they are designed to provide the desired content as fast as possible, as such they tend to use text as the primary method of communication, they work very well with search engines, and they date just as fast as anything else (<a href="http://www.microsoft.com/misc/features/features_flshbk_hp1.htm">Microsoft&#8217;s first web presence</a>).</p>

<h4>Dynamic Pages</h4>

<p>We have in this category the semi-interactive stuff that AJAX has found a home with, adding dynamism to an otherwise static page, and it does this stuff very well indeed. In short, it&#8217;s all very direct and to the point, it works outstandingly well. If you had to wait for an intro to play before you found out the price of the avocado you want to buy from your online supermarket you&#8217;d go elsewhere. </p>

<h4>Experience and Brands</h4>

<p>Then again, if you&#8217;re a 14 year old boy who loves watching Top Gear and you&#8217;re being delivered a loud, visceral and engaging experience for a super-car brand, this is the 21st century equivalent of that Ferrari F40 poster on your wall, that aspirational experience now even more compelling; one day you&#8217;ll drive that car. It may be interesting to some people to scroll through a highly efficient search engine friendly static page to see this kind of thing, but it&#8217;s really very boring for most people. There is a world of purely enjoyable content out there; don&#8217;t paint it grey. If you&#8217;re trying to build a brand, you have to tell a story.</p>

<h4>Applications and Games</h4>

<p>This is really a big part of what the web is today. Web-deployed applications and games have proven their worth. Open to wide audiences across multiple platforms, secure, immediately updateable, cheap to develop, and getting ever more sophisticated. If you look at these examples all done in Flash, I&#8217;d ask you what else you&#8217;d use that ticks all those boxes:</p>

<ul>
  <li><a href="http://aviary.com/">Aviary</a> - everything from bitmap and vector editors, texture generator to an audio editor, truly incredible.</li>

  <li><a href="http://www.hobnox.com/index.1056.en.html">Hobnox audio tool</a> - emulates in real time, hardware instruments for creating electronic music.</li>

  <li><a href="http://www.bbc.co.uk/cbeebies/bigandsmall/#/lb/bigandsmall/bigandsmallhouse">Big and Small</a> - Content for kids, it has to be fun and interactive to compete with TV. </li>

  <li><a href="http://www.google.co.uk/help/maps/streetview/">Google Street View</a> - The reality is, the transitions and interaction that make it so impressive, require Flash, and we know Google are pretty much the best in the business at AJAX.</li>

</ul>
<p>I wouldn&#8217;t underestimate the shift to web-based applications, IMHO <strong>nearly all applications will be web-based in the next 5 years</strong>; applications that include office suites, image and video editors, casual and hardcore games, music production software, and of course the most ubiquitous, social networking and media sharing. All of these are equally deserving of being available to users of a web browser, all of these requiring the most cutting edge technology available in order to stand out from the crowd and avoid being locked into the glacial flow of web standards progression.</p>

<h3>Plugins</h3>

<p>Plugins drive things forward by letting non-techies bolt on new functionality. Director, Flash, Unity all did or still do their part. Zoom forward 5 years and let us visit a perfect world where all the major browser vendors, including the behemoth Microsoft, have agreed on the various parts of &#8220;HTML 5&Prime;. Miraculously IE supports the same Canvas abilities and video codecs as the iPhone, Android and Nokia browsers, Mozilla (Firefox) has conceded to paying h264 royalty fees, sites with video content have conceded to paying <a href="http://streaminglearningcenter.com/articles/h264-royalties-what-you-need-to-know.html">h264 broadcast fees</a>, everything is gonna be allllright. The issue now is that things are looking a bit dated, the browser can now natively do what Flash applications were doing 5 years ago. This is a never ending game of cat and mouse, no-one can argue one is better than the other when nothing is standing still.</p>

<p>And so what now? What about new technologies, where&#8217;s the now ubiquitous multitouch we&#8217;re used to seeing since Flash 10.1, since iPhone and Android devices dominated the markets. Maybe that&#8217;s in the HTML 6 spec, maybe just in Firefox, how many more years after we start using it does it become standard. Along with multi-touch there will be many more features missing, we will still need plugins. Flash has added a myriad new features that game programmers and web developers are using to create a whole new level of experience that has obliterated the console and desktop software markets. HTML 5 is starting to look a lot like HTML 4 used to. Long in the tooth.</p>

<h3>HTML 5</h3>

<p>If we come back to today, I think it&#8217;s important to clear up just what this HTML 5 really means. It&#8217;s more than a spec, in general the term is used to refer to the many  sub-technologies involved, including new HTML markup, the Canvas tag for 2D (and possibly in future 3D) static and dynamically scripted graphics, fast JavaScript VM&#8217;s like Tamarin (donated by Adobe), a video tag for playing back a choice of video files, and possibly WebGL which aims to bring OpenGL 3D graphics to the web on par with Unity3D perhaps. I need to make it clear that I really want this to happen, no matter how open to feedback Adobe are, no matter how open the SWF format is, it does not sit well with me that one vendor controls what will and will not go in to the runtime, and it&#8217;s still a plugin, no matter how easy and fast it installs, something doesn&#8217;t quite feel right about it. </p>

<p>But I live in the real world, it&#8217;s mainly this technology that I&#8217;ve used to pay my way since I was 16, and that doesn&#8217;t show any signs of slowing. I am 100% willing to use HTML 5 if it suits the job. I&#8217;m not sitting around either, trust me. No flash developers are tied in to using it. But there are too many things stopping me from switching. Let&#8217;s take the hot topic of the day, the &lt;video&gt; tag; it doesn&#8217;t even replace what you could do with Flash 8 or 9 let alone some of the cool things <a href="http://www.youtube.com/watch?v=2zuOdJQiljw&amp;feature=youtu.be"> you can do *right now*</a> (no waiting)&#8230;</p>

<h3>Video</h3>

<p>Flash is not video. The Flash Player was installed on over 90% of internet connected computers before YouTube, when Flash video was limited to the early Sorenson Spark codec, optimised for small files that performed really badly at anything larger than 320x240, and 8 years ago when performance was so bad with Flash video we were using postage stamp sized video, but it was the immediacy of the playback that made it successful over more powerful plugins like Quicktime, WMV or Real Player. Either way, Flash video clearly changed the web, no more picking a plugin, picking your bandwidth, looking at truly ugly system chrome, so let&#8217;s look at what we need to see from HTML 5 video for it to displace Flash as the most efficient, cost effective and flexible solution:</p>
<ul>
  <li>DRM - Boo, evil. Whatever your personal view on DRM, broadcast corporations want it.</li>


  <li>True multi-bitrate streaming - Efficient live feeds across the globe that alters bitrate to suit current bandwidth, multicast (Flash Player 10 also supports a P2P UDP to take pressure off the server, or provide much faster messaging in games).</li>


  <li>Internet Explorer - The truth of the matter is that it has to work with IE. If you&#8217;re using Flash as a fallback, as suggested by ALL current HTML 5 video player supporters, why are you making more work for yourself? For a simple video player fine, but a lot of video is increasingly interactive. YouTube for example overlay recommendations, annotations, detected music, and even live commenting, you really want to do this twice?</li>
</ul>



<p>If &gt;<a href="http://jilion.com/sublime/video">this</a>&lt; is the cream of the crop right now, and it doesn&#8217;t even work in Firefox or Internet Explorer (percentages?), what is there to shout about?</p>

<h3>Yeah but Flash eats 100% of my CPU</h3>

<p>In a sentence: so do the most basic HTML 5 experiments (<a href="http://9elements.com/io/projects/html5/canvas/">link</a>).</p>

<p>An empty SWF consumes ~0% of my CPU, funnily enough the same amount as an empty web page. When something eats 100% of the CPU, it&#8217;s because is is doing something computationally expensive, possibly animating high quality 32-bit images whilst applying real time bitmap effects so that you can see just how that logo will look on this crumpled T-Shirt before you send it off to be printed. The CPU usage is not automatically higher with Flash, it&#8217;s down to the design and programmer to figure out what they want to achieve, and optimise it to whatever they find acceptable for their intended audience. JavaScript can and does use 100% CPU in some of the best apps out there, we just don&#8217;t see many apps that are up to the level of the Flash apps linked to earlier in this post. Video acceleration is a fair point until you consider video is also a display object in the Flash Player that can have these filters, transformations and so on applied in real time, that comes at a cost, however with Flash Player 10.1 hardware acceleration is starting to come into play, a truly impressive feat for such a small cross platform runtime.</p>

<h3>If we kill Flash, we kill annoying banner ads</h3>

<p>It&#8217;s also the case that displacing Flash will not get rid of annoying banner ads, agencies will just use &lt;canvas&gt; and &lt;video&gt;, don&#8217;t kid yourself, it&#8217;ll be those same Flash developers making it, they would simply re-tool and utilise their existing experience to produce infuriating ads in whatever makes the biggest impact. The internet is only less annoying with things like FlashBlock because only a tiny drop in the ocean of internet users use Flash block so they scoot under the radar. They are excluding themselves from the mainstream for this small benefit and more power to you for doing that, it&#8217;s up to you. </p>

<h3>Browser integration</h3>

<p>This is a major sorepoint for me as my primary job has been developing ever more complex Flash applications that are deployed on the web and on the desktop (indeed to replace existing desktop apps). You can communicate in real time between JavaScript and Flash, passing simple and complex data types between them, but it&#8217;s still a black box on the page. This is a really tough nut to crack, if you spend just 10 minutes asking yourself how you could get a native desktop application that you&#8217;ve embedded in a page to play well with the HTML around it, you&#8217;ll see why it simply doesn&#8217;t make sense, we shouldn&#8217;t try to shoe-horn these things.</p>

<h3>The Semantic Web and Accessibility</h3>

<p>Another gotcha. I can absolutely agree these things are so very important, depending on the content. What on earth is the point of making accessible a site where the entire aim is to build a burger out of people dressed up as beef, buns and lettuce, running and jumping on one another in a video montage. You may think the site should not exist anyway, but who are we to dictate what kind of content can be put online. Some idiots love this stuff and clearly so did Burger King! What about a game like <a href="http://www.dofus.com/en/mmorpg-free/play">Dofus</a>? Semantics and accessibility don&#8217;t apply to everything. You can build Flash sites to be accessible, you can <a href="http://richardleggett.co.uk/blog/index.php/2009/06/23/creating-drupal-sites-with-flash-or-flex">build them on top of a CMS like Drupal</a> to make sure you get the best of both worlds. In summary, use the right tool for the job.</p>

<h3>Mobile</h3>

<p>This one is very important to me. Hand on heart, devices that we now consider mobile: phones and tablets; these are going to be how 90% of people use computers, period. There&#8217;s simply no need for bulky laptops and desktops for non-professionals. Wireless TV connections let you get that big screen experience when you need it, but the redundancy in devices will be huge. This became clear in my own circle of entirely non-geek friends already, almost exclusively using mobile devices for everything, and this at the very beginning of the full-on shift to web-apps.</p>

<p>It became quite clear to me in 2007 (<a href="http://richardleggett.co.uk/blog/index.php/2007/10/22/does_flash_lite_have_a_future">link</a>) that Flash was never going to do well on mobile until it was the same runtime as the one we were using on the web, especially when it was licensed per handset. Funnily enough I called that convergent version &#8220;Flash X", and it turns out &#8220;X", by pure coincident, was right, in a roman numerals kinda way. Flash 10.1 has been optimised to run on lower powered CPUs like ARM chips found in iPhones and Android devices.</p>

<h3>Hating Adobe</h3>

<p>The animosity directed at Adobe is unusual. They simply invest in whatever proves popular in order to generate revenue, and they&#8217;ve had a lot of popular HTML/JS editing tools, even <a href="http://blogs.adobe.com/jnack/2009/10/sneak_peek_ai_fl_dw_canvas.html">demoing Canvas support</a> in the next Dreamweaver IDE. When Director started to die, occasionally being used for the odd online 3D game, and Flash took off, they invested time and money into creating what they like to call the Flash Platform. A range of commercial and open source tools, open-spec file formats for rich media, binary data transfer and a video container, a runtime, and a few free and commercial serverside offerings. They are not forcing anyone to use this stuff, if we stop using it they will move on like they have in the past, investing in whatever it is people <em>do</em> want to code in. In my opinion, Adobe will be the second big player, after Apple, to fully embrace HTML 5 in their software, with Microsoft lagging behind a very long way.</p>

<h3>Conclusion</h3>

<p>To everyone shouting support for HTML 5 as the flash killer, if that were really possible don&#8217;t you think Flash developers would already be doing it? We are a thriving community positively chomping at the bit to try out new stuff, I&#8217;m presenting on Android at a Flash user group shortly, we don&#8217;t hang around. We weren&#8217;t born knowing ActionScript 1, 2 or 3 and we have to live in the real world, we may even be right next to you <img src="http://richardleggett.co.uk/blog/rsc/smilies/icon_wink.gif" alt="&#59;&#41;" class="middle" /> Indeed many Flash developers are also HTML/JS developers and may practice a serverside language in smaller companies. It just leads to frustration when we hear &#8220;use HTML 5&Prime; when it is not supported even across desktop browsers. What version of IE should we be targeting before we can start building the rich compelling experiences we&#8217;re used to.</p>

<p><strong>The world will move to HTML X when Flash X is not needed, it is a non-argument, no amount of insane zealous preaching from within the idealist world of either side will make this happen in the real world. The market will use whatever tools provide the best solutions for the best return on investment. </strong></p>

<p>I can&#8217;t wait till we get through this next transitionary period, with web designers having to spend twice the effort providing Flash fallbacks to video, companies encoding and hosting their videos twice for Firefox, licenses and royalties for h264, this will be another messy, frustrating time for web users and progress may slow, but I can&#8217;t see a way around it.</p><div class="sharethis">
        <script type="text/javascript" language="javascript">
          SHARETHIS.addEntry( {
            title : '&quot;The World is Moving to HTML 5&quot; and Other Flights of Fancy',
              url   : 'http://richardleggett.co.uk/blog/index.php/2010/02/01/the-world-is-moving-to-html5'}, 
            { popup: true }
          ) ;
        </script></div><br /><div class="item_footer"><p><small><a href="http://richardleggett.co.uk/blog/index.php/2010/02/01/the-world-is-moving-to-html5">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://richardleggett.co.uk/blog/index.php/2010/02/01/the-world-is-moving-to-html5#comments</comments>
			<wfw:commentRss>http://richardleggett.co.uk/blog/index.php?tempskin=_rss2&#38;disp=comments&#38;p=338</wfw:commentRss>
		</item>
			</channel>
</rss>
