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

<channel>
	<title>Words, punctuated &#187; Flash</title>
	<atom:link href="http://probertson.com/articles/category/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://probertson.com</link>
	<description>Thoughts on web development, user-centered design, code, etc. by Paul Robertson</description>
	<lastBuildDate>Tue, 20 Jul 2010 21:29:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Slides, examples, and links: Developing iPhone apps with the Flash Platform</title>
		<link>http://probertson.com/articles/2010/03/16/slides-and-examples-developing-iphone-apps-flash-platform/</link>
		<comments>http://probertson.com/articles/2010/03/16/slides-and-examples-developing-iphone-apps-flash-platform/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 00:57:00 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://probertson.com/?p=417</guid>
		<description><![CDATA[
Last week I gave a presentation at 360&#124;Flex 2010 (San Jose) on &#8220;Developing iPhone apps with the Flash Platform.&#8221; As always, I wanted to make my slides, notes, reference links, and example code available to those who were there and those who couldn&#8217;t make it:
Download slides, links, and example code (3.1 MB .zip)
I&#8217;ve been traveling [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/resources/2010/03/16/iphone_flash_platform_resources.jpg" alt="Flash logo pointing to iPhone with presentation title" /></p>
<p>Last week I gave a presentation at 360|Flex 2010 (San Jose) on &#8220;Developing iPhone apps with the Flash Platform.&#8221; As always, I wanted to make my slides, notes, reference links, and example code available to those who were there and those who couldn&#8217;t make it:</p>
<p><a href="/resources/2010/03/16/iphone_flash_platform_resources.zip">Download slides, links, and example code</a> (3.1 MB .zip)</p>
<p>I&#8217;ve been traveling since the conference so I didn&#8217;t flesh out my notes as thoroughly as I have for past presentations. If you have a question about a slide, feel free to ask in the comments and I&#8217;ll try to explain it better. The 360|Flex folks recorded video of my presentation as well as a screen capture. I believe the plan is to make those recordings available to attendees as well as people who couldn&#8217;t make it (though they may charge a fee if you didn&#8217;t attend the conference).</p>
<h2>Acknowledgments</h2>
<p>This is in the slides, but I wanted to once again thank all the people who helped me prepare this presentation (some knowingly, others just by virtue of content they&#8217;ve shared):</p>
<ul>
<li><a href="http://flashrealtime.com/">Tom Krcha</a></li>
<li><a href="http://renaun.com/">Renaun Erickson</a></li>
<li><a href="http://www.linkedin.com/pub/jeff-swartz/1/52/b84">Jeff Swartz</a></li>
<li><a href="http://adityabansod.net/">Aditya Bansod</a></li>
<li><a href="http://www.onflash.org/">Ted Patrick</a></li>
<li><a href="http://www.mikechambers.com/">Mike Chambers</a></li>
<li><a href="http://theflashblog.com/">Lee Brimelow</a></li>
<li><a href="http://www.linkedin.com/in/chiedozi">Chiedo Acholonu</a></li>
<li><a href="http://twitter.com/gburch">Greg Burch</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2010/03/16/slides-and-examples-developing-iphone-apps-flash-platform/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adobe opens door for creating alternative SWF players</title>
		<link>http://probertson.com/articles/2008/04/30/adobe-opens-door-fo-alternative-swf-players/</link>
		<comments>http://probertson.com/articles/2008/04/30/adobe-opens-door-fo-alternative-swf-players/#comments</comments>
		<pubDate>Thu, 01 May 2008 05:33:51 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[Articles by Paul]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Opinions]]></category>

		<guid isPermaLink="false">http://probertson.com/?p=171</guid>
		<description><![CDATA[Adobe just announced a new project called the Open Screen Project. There&#8217;s a lot going on with the project, so I won&#8217;t try to summarize all the different points and partners. If you read through the material, you&#8217;ll see that a lot of it talks about opening the door for improving access and presentation/experience for [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe just announced a new project called the <a href="http://www.adobe.com/openscreenproject/">Open Screen Project</a>. There&#8217;s a lot going on with the project, so I won&#8217;t try to summarize all the different points and partners. If you read through the material, you&#8217;ll see that a lot of it talks about opening the door for improving access and presentation/experience for mobiles and other devices (the page describes it as &#8220;driving consistent rich Internet experiences across televisions, personal computers, mobile devices, and consumer electronics&#8221;).</p>
<p>In one sense, it&#8217;s a big bunch of companies partnering with Adobe to make it so that interactive content can be accessed on mobile phones (using Flash Player and eventually Adobe AIR, surprise, surprise). And the content isn&#8217;t supposed to be just available, but fully available, using the full capabilities of Flash Player. What? Full Flash Player running on a mobile device? <a href="http://www.engadgetmobile.com/2008/03/06/flash-on-the-iphone-apple-has-goldilocks-syndrome/">Nobody&#8217;s ever complained about that</a>, right? =)</p>
<p>But this isn&#8217;t <em>just</em> an announcement of a partnership to think about what may come someday in the future. As part of all of this, Adobe is doing some concrete things <em>today</em>. There are a few things that Adobe&#8217;s releasing/changing. The most notable of these to me is that Adobe&#8217;s changing the license restrictions on the SWF format (as well as FLV and to allow it to be used not only for creating authoring tools, but players as well. From <a href="http://www.adobe.com/openscreenproject/faq/">the FAQ page</a> (emphasis mine):</p>
<blockquote><p>Publication of an unrestricted SWF file format has long been requested by the Adobe Flash developer community. The longstanding publication of the SWF specification has fostered a vibrant ecosystem of companies and developers who create experiences with Adobe Flash technology and by removing the SWF licensing restrictions we are allowing that growing ecosystem to use the file format for any purpose, <em>including the ability to playback SWF content</em>.</p>
</blockquote>
<p>As you may know, for years Adobe (and Macromedia before them) published the SWF format specification, allowing other companies to create tools that generate SWF files. That&#8217;s why there are all those &#8220;build Flash for free online&#8221; sites and packages that hosting companies offer. That&#8217;s why <a href="http://ncannasse.free.fr/">Nicholas</a> <a href="http://blog.haxe.org/">Cannasse</a> was able to create the awesome <a href="http://www.mtasc.org/">MTASC ActionScript 2.0 compiler</a> back when the only way to compile ActionScript was through the Flash authoring tool. Heck, even Adobe used to try to compete with Flash authoring with their <a href="http://en.wikipedia.org/wiki/Adobe_LiveMotion">LiveMotion</a> <a href="http://www.adobe.com/products/livemotion/">product</a>. (<em>Try</em> being the operative word. After all, Macromedia wasn&#8217;t dumb. They&#8217;d develop Flash version X and Flash Player version X simultaneously, release them both, and only then &#8212; a few months later, really &#8212; publish the SWF spec. At that point competitors could <em>start</em> working on a competing authoring tool. For people who were targeting a very different market that was okay, but for anyone trying to go head-to-head with Flash? No chance.)</p>
<p>Anyway, the license allowed all of that without any royalties or anything. <em>However</em>, there was a big restriction on the license &#8212; if you ever looked at the SWF spec, you could not create an alternative SWF player (i.e. a Flash Player competitor). There&#8217;s a compelling reason for this &#8212; even though the player has always been free for desktop computers and hence not a direct source of revenue, Macromedia knew that it&#8217;s greatest strength was in its &#8220;write once, run anywhere&#8221; capability. Every web designer knows how horrible it is to try and design a page to look even mostly similar in all browsers &#8212; let alone exactly the same. By restricting the creation of alternative SWF players, there is much less chance of alternative &#8220;mostly but not completely&#8221; compliant players showing up on users&#8217; computers.</p>
<p>Of course, that&#8217;s in the past now. As of today the license restriction has been removed, and anyone who wants to can look at <a href="http://www.adobe.com/devnet/swf/">the SWF spec</a> and, if they choose, use that knowledge to create an alternative SWF player. (<a href="http://www.gnashdev.org/">Gnash</a> team I&#8217;m looking at you!) In my opinion, for those groups this is the next best thing to Flash Player itself being open-sourced (and maybe better, since that would put them out of a project). While this does have exactly the negative potential I mentioned above, it&#8217;s a big deal for device manufacturers. If they bet their future on Flash Player, they don&#8217;t want to be stuck if Adobe goes out of business or decides to throw away Flash to focus more on their PostScript printer driver business =) It&#8217;s a risk, and I&#8217;m crossing my fingers that we don&#8217;t get splintered Flash Players all over the place. As <a href="/articles/2007/04/11/thinking-on-open-source-flash-player/">others have said</a>, there are some benefits that hopefully outweigh the risks. Fortunately, Flash is a pretty big brand, and Adobe&#8217;s definitely <em>not</em> releasing their trademarks on Flash, Flash Player, etc. So anyone who makes an alternative SWF player will not be able to call it Flash anything. (Unless Adobe decides to create a certification program for alternative players or something like that &#8212; something which I didn&#8217;t see mentioned at all in the project pages.)</p>
<p>For Flash/Flex/AIR developers, honestly I don&#8217;t think this project opens any doors immediately, but I think it does have a lot of promise for the future. Currently, it&#8217;s pretty hard to create Flash content for a mobile device. You basically have to create a separate version for every device. Many of the devices have Flash Player burned on the ROM, so that player can never be upgraded. If you want to target one of those devices you&#8217;re stuck on Flash 4 (tell target lives forever!) When a new version of Flash Lite is released, it takes months before it is added to devices and those devices get into stores and users&#8217; hands.</p>
<p>So a lot of this is about Adobe and other companies working together to make it so that you can use the same code, targeting a player with the same capabilities, no matter whether you&#8217;re creating content for a PC or a mobile device. For example, part of the plan is to create a set of &#8220;device porting layer APIs for Adobe Flash Player.&#8221; In the words of the FAQ, these are &#8220;device-specific abstractions of Adobe Flash Player that enable it to work on different operating systems and devices.&#8221; Another notable part of the plan is to make it so that the player can be updated just like it can on a PC. Goodness knows I often wish I could update the Flash Player on my Wii!</p>
<p>Plus, the fact that Adobe&#8217;s no longer restricting who can create SWF players, and no longer charging royalties to device manufacturers who include Flash Player in their devices, means it will be cheaper, easier, and safer for companies to include Flash Player on their devices, meaning a larger market for content.</p>
<p>Anyway, I was pretty surprised by all of this, and happy for the potential future growth that this could lead to. Adobe&#8217;s once again making a big bet, and the payoff will be great for all of us if it works out.</p>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2008/04/30/adobe-opens-door-fo-alternative-swf-players/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Release day for Flash Player, AIR, and &#8230;</title>
		<link>http://probertson.com/articles/2008/04/08/release-day-for-adobe-flash-platform/</link>
		<comments>http://probertson.com/articles/2008/04/08/release-day-for-adobe-flash-platform/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 23:56:22 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Articles to remember]]></category>
		<category><![CDATA[Elsewhere on the web]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://probertson.com/?p=167</guid>
		<description><![CDATA[Lots of big releases for Adobe AIR and Flash Player today. In no particular order:

Security update for Flash Player (&#8220;9.4&#8221;) (also see the DevNet article)
Security update for Adobe AIR (&#8220;1.0.1&#8221;)
New public Flash Player bugbase (also see the DevNet article)
Adobe Media Player 1.0 (with a lot more content now that it&#8217;s final &#8212; if you&#8217;ve tried [...]]]></description>
			<content:encoded><![CDATA[<p>Lots of big releases for Adobe AIR and Flash Player today. In no particular order:</p>
<ul>
<li><a href="http://www.adobe.com/products/flashplayer/">Security update for Flash Player (&#8220;9.4&#8221;)</a> (also see <a href="http://www.adobe.com/devnet/flashplayer/articles/flash_player9_security_update.html">the DevNet article</a>)</li>
<li><a href="http://www.adobe.com/products/air/">Security update for Adobe AIR (&#8220;1.0.1&#8221;)</a></li>
<li>New <a href="">public Flash Player bugbase</a> (also see <a href="http://www.adobe.com/devnet/logged_in/tmccauley_fplayer_bugbase.html">the DevNet article</a>)</li>
<li><a href="http://www.adobe.com/go/getmp">Adobe Media Player 1.0</a> (with a <em>lot</em> more content now that it&#8217;s final &#8212; if you&#8217;ve tried it before but didn&#8217;t bother with it because of lack of content, it&#8217;s worth another look)</li>
</ul>
<p class="editornote">Note: I added AMP after this post was already published, since it wasn&#8217;t yet public at the time.</p>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2008/04/08/release-day-for-adobe-flash-platform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Adobe Dev Center articles (Flash deep-linking and Flash CS3 DataGrid)</title>
		<link>http://probertson.com/articles/2007/11/13/two-developer-center-articles/</link>
		<comments>http://probertson.com/articles/2007/11/13/two-developer-center-articles/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 18:14:06 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Articles by Paul]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Writing]]></category>

		<guid isPermaLink="false">http://probertson.com/articles/2007/11/13/two-developer-center-articles/</guid>
		<description><![CDATA[Several months ago I was asked to re-purpose two of my previous articles from this site for publication on the Adobe Developer Center (now renamed as the &#8220;Adobe Developer Connection&#8221;). The first one was published in September 2007, and the second was just published yesterday. So in a way this is sort of a revisiting [...]]]></description>
			<content:encoded><![CDATA[<p>Several months ago I was asked to re-purpose two of my previous articles from this site for publication on the Adobe Developer Center (now renamed as the &#8220;Adobe Developer Connection&#8221;). The first one was published in September 2007, and the second was just published yesterday. So in a way this is sort of a revisiting of previous topics, but if you missed them before here they are in their new-and-improved form (or if you&#8217;re just really curious about me, you can see what I look like in my author photo on the articles =):</p>
<ul>
<li><a href="http://www.adobe.com/devnet/flash/articles/deep_linking.html">Deep-linking to frames in Flash websites</a> (Sept. 10, 2007) - for this article I took just one of the techniques I described in <a href="/articles/2006/12/14/deep-linking-flash-application-states/">the original article</a> and added more background information and better explanations. (I&#8217;m sometimes amazed by how much detail I leave out when I&#8217;m writing posts on this site!)</li>
<li><a href="http://www.adobe.com/devnet/flash/articles/detecting_datagrid_edits.html">Detecting when data is edited in the DataGrid component</a> (Nov. 12, 2007) - this article was revised much less from <a href="/articles/2007/05/01/flash-cs3-datagrid-detecting-data-change/">the original</a> than the other one. Basically I took the text and found places where I thought it needed more/better/clearer explanation, and added a sentence or revised the text. I definitely think the new version is better, but there isn&#8217;t any new information to be had if you read the original.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2007/11/13/two-developer-center-articles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash Player Astro&#8217;s identity crisis (or &#8220;What will ActionScript be like when it &#8216;grows up&#8217;?&#8221;)</title>
		<link>http://probertson.com/articles/2007/10/15/future-actionscript-apis-high-level-or-low-level/</link>
		<comments>http://probertson.com/articles/2007/10/15/future-actionscript-apis-high-level-or-low-level/#comments</comments>
		<pubDate>Mon, 15 Oct 2007 20:09:19 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Articles by Paul]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Opinions]]></category>

		<guid isPermaLink="false">http://probertson.com/articles/2007/10/15/future-actionscript-apis-high-level-or-low-level/</guid>
		<description><![CDATA[Note: On Nov. 1, 2007 I made a small change to the title of this article. The original title was &#8220;Flash Player Astro&#8217;s personality conflict&#8230;&#8221; (substituting &#8220;identity crisis&#8221; in the current title with &#8220;personality conflict&#8221;). However, I realized that &#8220;personality conflict&#8221; wasn&#8217;t the most accurate term for what I was trying to communicate, and &#8220;identity [...]]]></description>
			<content:encoded><![CDATA[<p class="editornote">Note: On Nov. 1, 2007 I made a small change to the title of this article. The original title was &#8220;Flash Player Astro&#8217;s personality conflict&#8230;&#8221; (substituting &#8220;identity crisis&#8221; in the current title with &#8220;personality conflict&#8221;). However, I realized that &#8220;personality conflict&#8221; wasn&#8217;t the most accurate term for what I was trying to communicate, and &#8220;identity crisis&#8221; seemed like a better fit.</p>
<p>If you attended the North America MAX 2007 conference or tried to keep up with the news that was pouring out, you probably know that <a href="http://aralbalkan.com/1048">in the day 1 keynote address Emmy Huang and Justin Everett-Church demoed three new features of &#8220;Astro&#8221;</a> (the &#8220;next version&#8221; of Flash Player):</p>
<ul>
<li>An improved text engine, allowing new capabilities like bi-directional text, re-flowing column text fields, and more.</li>
<li>The ability to create custom graphic filters, rather than being limited to the built-in set  in ActionScript.</li>
<li>&#8220;Postcards in space&#8221; 3D transformations that can be applied to display objects to position/rotate them in 3D space.</li>
</ul>
<p>I think there&#8217;s something funny about these three features and the way they&#8217;ve chosen to implement them. I didn&#8217;t really notice it when I first watched the demo video (no, I wasn&#8217;t at MAX), but later it jumped out at me as I was reading some of the responses to the demo in the PaperVision 3D email list, and even more so as I listened to <a href="http://theflashblog.com/?p=287">the video interview that Lee Brimelow did with Justin Everett-Church later during MAX</a>, in which Justin clarifies and expands on the three Flash Player features that were described. If you don&#8217;t want to jump away to watch the video (although it&#8217;s really good for understanding the new features) here&#8217;s a transcript of the most important statements Justin makes relating to my idea:</p>
<blockquote><p>
(:29) Justin: &#8220;[Astro&#8217;s &#8216;3D effects&#8217; and PaperVision 3D] are kind of <strong>fairly different from each other</strong>&#8230;<strong>3D effects is kind of &#8216;3D for the rest of us&#8217;</strong>. If you wanted to try and use the 3D effects to do more complicated things there may be some APIs that might help you but you know PaperVision&#8217;s an excellent solution, you&#8217;re just not going to replace one with the other, they&#8217;re going after different objectives.&#8221;
</p></blockquote>
<blockquote><p>
(2:40) Lee: &#8220;There was a lot [of buzz] around filters and the ability to create your own filters, and we heard &#8216;Hydra&#8217; mentioned. So what exactly is it? Is it a new programming language?&#8221;</p>
<p>Justin: &#8220;So Hydra is a new language, it&#8217;s a pixel shader language. The Hydra language itself is <strong>very consistent with other pixel shader languages&#8230;the port between [Hydra and other pixel shader languages] is really easy</strong>.&#8221;
</p></blockquote>
<blockquote><p>(4:10) Justin: &#8220;So our new text layout engine is <strong>really a group of hooks in the Flash Player</strong> that are <strong>lower level than we&#8217;ve ever had before</strong>. On top of that we&#8217;re building a series of components so they will do things like multi-column flow, inline HTML, bidirectional text, ligatures, lots of complex [?] sorts of things. But <strong>those components are developed in ActionScript 3.0</strong> and will be deployed as part of your application. <strong>The hooks that are there are going to be exposed to developers</strong> so if you want to build your own component, if what we do isn&#8217;t exactly suiting your needs then you&#8217;ll be able to build a first-class text control.&#8221;
</p></blockquote>
<p>Notice that, based on the way Justin describes it, the idea for the improved text engine is that the actual functionality provided by Flash Player/ActionScript is very low-level, and Adobe provides components that give the higher level functionality we expect from a standard text field object (as well as additional enhanced versions).</p>
<p>Think about that for a moment.</p>
<p>Imagine if the flash.text.TextField class, the display object that&#8217;s used any time text is displayed in an ActionScript app, were actually a component on top of some lower-level API &#8212; and non-Adobe developers could freely write their own version of the TextField class, using those same low-level APIs.</p>
<p>By the same token, imagine if the built-in filters (the flash.filters.* classes) were actually &#8220;components&#8221; or library classes written on top of some lower-level API. (In fact, I think that&#8217;s how lots of developers see them, especially since they all derive from the flash.filters.BitmapFilter base class &#8212; with the notable issue that developers can&#8217;t create their own BitmapFilter subclasses and use them in ActionScript.) So imagine if you <strong>were</strong> allowed to create your own BitmapFilter subclass, and Flash Player would use it along with any of the Adobe-provided filters.</p>
<p class="editornote">Yes, obviously the low-level aspect of the filters involves writing them in Hydra, not in ActionScript, and I really don&#8217;t have any idea how that&#8217;s all going to get hooked together. Just bear with me &#8212; I&#8217;m trying to describe big concepts here, not small details =)</p>
<p>Can you see what I&#8217;m getting at? That&#8217;s exactly what&#8217;s happening with two of the three new Flash Player features that were presented at MAX &#8212; Adobe is providing a low-level API, much lower than what most developers are going to need to use, and then they&#8217;re also providing components or libraries that will be the standard tool that most people will actually use. I think that&#8217;s an interesting approach, and one that the advanced developer community is going to really latch on to even while it doesn&#8217;t cause any pain or extra work for the typical developer.</p>
<p>However, compare that to the 3D (or 2.5D, as it&#8217;s often called) functionality that was shown at MAX. As Justin says, it&#8217;s intentionally a high-level API &#8212; 3D &#8220;for the rest of us&#8221; &#8212; compared to projects like PaperVision 3D that are working to provide full-fledged 3D modeling, textures, virtual world capabilities, etc. The PaperVision community <a href="http://osflash.org/pipermail/papervision3d_osflash.org/2007-October/011495.html">isn&#8217;t</a> <a href="http://osflash.org/pipermail/papervision3d_osflash.org/2007-October/011567.html">so</a> <a href="http://osflash.org/pipermail/papervision3d_osflash.org/2007-October/011568.html">thrilled</a> about this. Naturally they don&#8217;t think the player needs a high-level 3D API &#8212; they see PaperVision as providing the high-level API, and <a href="http://osflash.org/pipermail/papervision3d_osflash.org/2007-October/011581.html">they&#8217;d much rather see the player provide new low-level APIs and/or improved processing power that allows them to do more, better</a> with their higher-level APIs. (I&#8217;m paraphrasing and probably mis-describing this to some extent, since by I am by no means a 3D expert or even intermediate-level developer.)</p>
<p class="editornote">As another aside, it occurs to me that the idea that Flash Player APIs are &#8220;high level functionality provided by the Flash Player team written in ActionScript&#8221; isn&#8217;t actually new. It&#8217;s a well-known fact that a notable amount of the Flash Player functionality is actually written in ActionScript and not in C++ or C or assembler code. In those cases the only difference between the built-in functionality and an external ActionScript library that you or I write is that the ActionScript code comes pre-installed in Flash Player and doesn&#8217;t have to be part of a SWF file download. An interesting historical note related to this is the history of the XML class (the old-school one that lives on as flash.xml.XMLDocument). The XML class was introduced in Flash Player 5, and in that release it was written entirely in ActionScript and consequently suffered from some speed issues in how it parsed XML. The ActionScript developer community (<a href="http://www.waxpraxis.org/">Branden Hall</a>, I believe) wrote an alternative implementation known as XMLNitro that was faster than the built-in one. Back then in ActionScript 1, it was fairly straightforward to &#8220;redefine&#8221; methods of the built-in classes so that the player used your own ActionScript code instead, so that&#8217;s what many people did to get faster XML parsing. Funny, isn&#8217;t it, that with the newer constructs added in ActionScript 2.0 and ActionScript 3.0, we&#8217;ve also lost some functionality &#8212; namely the ability to overwrite built-in functionality with our own code. That was <em>definitely</em> a low-level capability that was previously available in Flash Player.</p>
<p>Interestingly, even in modern (i.e. post Adobe-Macromedia merger) history this idea of &#8220;low level APIs with higher-level components on top for normal use&#8221; isn&#8217;t completely new in &#8220;Astro&#8221;. One obvious precedent is the Flex framework; however, the example I&#8217;m thinking of is part of the Flash authoring tool. Historically Flash authoring was released simultaneously with new versions of Flash Player, and consequently there were always new authoring tool features that corresponded to new player features (obvious example: the filters and blend modes that were added in Flash 8 to Flash authoring as visual tools and to Flash Player as ActionScript APIs). Interestingly, however, in Flash CS3 there were some authoring tool features that were added that didn&#8217;t have a corresponding player API. Specifically I&#8217;m referring to the &#8220;copy motion as ActionScript&#8221; feature that allows you to select a tween sequence on the timeline and copy it &#8220;as ActionScript&#8221; &#8212; the animation becomes ActionScript code that you can paste somewhere and use to re-create the animation programmatically. What I think is notable about that authoring tool functionality is that the pasted code doesn&#8217;t work as-is via a player API &#8212; rather, it requires some external ActionScript libraries that were included with Flash CS3 (the fl.motion.* and fl.transitions.* packages). So the functionality underlying that feature of Flash CS3, one of the headline features of the product (created by none other than <a href="http://www.robertpenner.com/">Robert Penner</a>), was completely independent of the core Flash Player APIs and was instead provided by an external library.</p>
<p>Think about it this way: the Flash authoring tool team wanted to include functionality that wasn&#8217;t provided in core Flash Player ActionScript. It was specifically a &#8220;high level&#8221; type of functionality &#8212; simple scripted animation. Other people have written their own APIs to do the same thing, using the ActionScript &#8220;low level&#8221; APIs (display object properties, enterFrame events, etc.) and the Flash authoring &#8220;high level&#8221; approach does the same thing &#8212; it provides a library of code to simplify a certain task, so that users can easily create the effects they want, within the limitations of the high level library. I see this as another existing example of this idea of core ActionScript providing low-level functionality, with third parties <strong>and also Adobe</strong> providing high-level functionality in the form of ActionScript libraries that build on top of that low-level functionality.</p>
<p>Now, going into the future, there is a new Flash Player feature that allows the player to cache certain Adobe-approved code libraries, so the user downloads them once and then they&#8217;ve got them for every future site they visit that uses the same library. We&#8217;ve heard that the Flex framework is going to be the first such &#8220;cacheable&#8221; library. However, if this feature had existed earlier it could obviously have been used for the ActionScript classes that are used to support the Flash CS3 simplified animation (&#8220;copy motion&#8221;) functionality. For that matter, the Flash CS3 UI components could be given the same treatment and be available as a cacheable library, although that might be less necessary by virtue of their &#8220;intentionally lightweight&#8221; design.</p>
<p>While I really can&#8217;t say for sure, it seems like it&#8217;s not a stretch that the new text components would be distributed this way, especially since, as Justin points out, &#8220;those components are developed in ActionScript 3.0 and will be deployed as part of your application.&#8221;</p>
<p>I think that, going into the future, this is a potential direction I can see Flash Player and ActionScript moving in:</p>
<ul>
<li>Flash Player/core ActionScript provides low-level APIs</li>
<li>Adobe provides components or libraries written in ActionScript that provide high-level-enough (&#8220;medium-level&#8221;?) functionality such that most common use cases and functionality are provided for. Probably these components/libraries are external, player-cacheable code libraries rather than part of Flash Player itself.</li>
<li>Third-party developers can likewise create their own components and libraries that either build on the Adobe-provided components/libraries or provide alternate implementations.</li>
</ul>
<p>Of course, the obvious exception to this way of working is the new 3D effects, which are very high level and are essentially the end user functionality, rather than providing low-level building blocks on which Adobe and/or third party developers can build more robust libraries.</p>
<p>What do you think of this future? Does it sound good, or scary? I&#8217;d love to hear your thoughts on this one&#8230;</p>
<p class="editornote">Disclaimer: While I am an Adobe employee, I actually had very little knowledge of these &#8220;Astro&#8221; features until watching the MAX keynote presentation. I had heard general descriptions of some of them, but certainly nothing like the level of detail that was given by Emmy and Justin in the keynote and follow-up interview. Likewise, since then I haven&#8217;t gotten any additional &#8220;insider&#8221; information about these or other future Flash Player features. Obviously some of what I say in this post is speculation about the future, and I readily admit that it is indeed speculation and nothing more &#8212; I don&#8217;t have insider knowledge on this, and I might be completely wrong about all of it. =)</p>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2007/10/15/future-actionscript-apis-high-level-or-low-level/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Learn ActionScript from Colin Moock for free!</title>
		<link>http://probertson.com/articles/2007/09/11/learn-actionscript-from-colin-moock-for-free/</link>
		<comments>http://probertson.com/articles/2007/09/11/learn-actionscript-from-colin-moock-for-free/#comments</comments>
		<pubDate>Tue, 11 Sep 2007 17:29:51 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Elsewhere on the web]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://probertson.com/articles/2007/09/11/learn-actionscript-from-colin-moock-for-free/</guid>
		<description><![CDATA[Tours are starting to be all the rage with Adobe (and others). With the launch of CS3 Adobe did a conference tour, and of course there&#8217;s the onAIR bus tour that&#8217;s making it&#8217;s way around the country promoting AIR.
Now, if you or someone you know is a Flash designer with almost-none-to-basic ActionScript experience, and you [...]]]></description>
			<content:encoded><![CDATA[<p>Tours are starting to be all the rage with Adobe (and others). With the launch of CS3 Adobe did a conference tour, and of course there&#8217;s the <a href="http://onair.adobe.com/">onAIR bus tour</a> that&#8217;s making it&#8217;s way around the country promoting <a href="http://www.adobe.com/go/air/">AIR</a>.</p>
<p>Now, if you or someone you know is a Flash designer with almost-none-to-basic ActionScript experience, and you want to learn ActionScript from <a href="http://moock.org/">the established master</a>, you can do it for free. Adobe is sponsoring a <a href="http://www.adobeas3tour.com/">free, one-day ActionScript training course given by Colin Moock</a> that&#8217;s traveling around the U.S. (and eventually the world) starting in October 2007.</p>
<p>They&#8217;re calling it &#8220;<a href="http://www.adobeas3tour.com/">Colin Moock&#8217;s ActionScript 3.0: From the Ground Up Tour</a>.&#8221; And you shouldn&#8217;t feel intimidated if you are just getting started with ActionScript &#8212; the site explicitly says it&#8217;s not for advanced developers, so if you&#8217;re just getting going (i.e. you&#8217;ve done some frame scripts but not anything with classes) you should be in your element.</p>
<p>Currently it looks like there are stops scheduled in San Francisco, Los Angeles, and New York City. Even if you don&#8217;t live in one of those areas, think of it this way &#8212; for only the price of travel you&#8217;re getting an awesome training experience.</p>
<p>(via <a href="http://www.stefanmedia.com/">Stefan Gruenwedel</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2007/09/11/learn-actionscript-from-colin-moock-for-free/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to: determining when data is edited using the Flash CS3 DataGrid component</title>
		<link>http://probertson.com/articles/2007/05/01/flash-cs3-datagrid-detecting-data-change/</link>
		<comments>http://probertson.com/articles/2007/05/01/flash-cs3-datagrid-detecting-data-change/#comments</comments>
		<pubDate>Tue, 01 May 2007 18:06:43 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Articles by Paul]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://probertson.com/articles/2007/05/01/flash-cs3-datagrid-detecting-data-change/</guid>
		<description><![CDATA[Note: a version of this article was posted on the Adobe Developer Center in November 2007. That article is based heavily on this one &#8212; essentially I took the text here, and revised a few sentences and word choices for clarity. However, if you&#8217;re interested in the &#8220;latest&#8221; version, you can find it here: &#8220;Detecting [...]]]></description>
			<content:encoded><![CDATA[<p class="editornote">Note: a version of this article was posted on the Adobe Developer Center in November 2007. That article is based heavily on this one &#8212; essentially I took the text here, and revised a few sentences and word choices for clarity. However, if you&#8217;re interested in the &#8220;latest&#8221; version, you can find it here: &#8220;<a href="http://www.adobe.com/devnet/flash/articles/detecting_datagrid_edits.html">Detecting when data is edited in the DataGrid component</a>.&#8221;</p>
<p>Suppose you&#8217;re creating a user interface with Flash CS3, using the new lightweight ActionScript 3.0 components. You&#8217;re using the DataGrid component to display &#8212; what else &#8212; a table of data. You want users to be able to edit the data, and <em>you want to know when the user changes the data so that you can update the application</em>.</p>
<p>For example, suppose you&#8217;re building something like this simple spreadsheet application:</p>
<p>
	<script type="text/javascript">
	// <!CDATA[[
	var demoSpreadsheet = new FlashObject("/resources/2007/05/01/detecting_datagrid_edits_0.swf", "spreadsheet0", "300", "175", 9, "#336699");
	demoSpreadsheet.write();
	// ]]&gt;
	</script>
</p>
<p>Naturally, when the user edits a value in the &#8220;quantity&#8221; column, you&#8217;d expect the &#8220;Total&#8221; value to automatically update.</p>
<p>This sounds like something that should be built in to the DataGrid component, doesn&#8217;t it? Alas when I started down the road of trying to figure out how to make it work, while building the <a href="http://livedocs.adobe.com/flash/9.0/main/00000208.html">Filter Workbench example</a> for <a href="http://livedocs.adobe.com/flash/9.0/main/Part1_Programming_AS3_1.html">Programming ActionScript 3.0</a>, I discovered that it&#8217;s not quite as straightforward as I had hoped.</p>
<p>In this article I&#8217;ll start with some discussion of what I tried that didn&#8217;t work, then follow up with two different approaches that do work (each of which has tradeoffs):</p>
<ul>
<li><a href="#dataprovider">What doesn&#8217;t work &#8212; using DataProvider events</a></li>
<li>
<p><a href="#datagrid">What does work (with help) &#8212; using DataGrid events</a></p>
<ul>
<li><a href="#twolisteners">Using two different event listener functions</a> (less convoluted)</li>
<li><a href="#onelistener">Using one event listener function</a> (more convoluted)</li>
</ul>
</li>
</ul>
<h2 id="dataprovider">What doesn&#8217;t work &#8212; using the DataProvider&#8217;s events</h2>
<p>I started digging through the documentation, and I noticed that the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/data/DataProvider.html">fl.data.DataProvider class</a> (which I was using as the data source for my DataGrid) has some interesting looking events, <code>dataChange</code> and <code>preDataChange</code>. &#8220;Ah-ha!&#8221; I thought. I can just add a listener for those events, and when the DataGrid changes the underlying data in the DataProvider, it will dispatch those events and (if I need it, which I didn&#8217;t) I can grab a snapshot of the old data in <code>preDataChange</code> and get the new data in <code>dataChange</code>. (In fact, in my case I didn&#8217;t even need to know which data had changed &#8212; it was sufficient for my purposes to know that some data had changed, and then I just recalculated filter values using all the data in the DataGrid.)</p>
<p>Unfortunately, that&#8217;s not how the DataProvider works. In fact, its events are designed to handle the opposite use case &#8212; i.e. if something other than the DataGrid changes the data in the DataProvider, then the DataProvider notifies the DataGrid so that it can update itself, but if the DataGrid changes the DataProvider, the DataProvider assumes that the DataGrid already knows about the change (and nobody else would want to) so it doesn&#8217;t dispatch its events in that case.</p>
<p>So, strike 1 for trying to use the DataProvider&#8217;s events.</p>
<h2 id="datagrid">What does work (with help) &#8212; using the DataGrid&#8217;s events</h2>
<p>Since the DataProvider was out, I had no choice but to look at the DataGrid&#8217;s events.</p>
<p>The DataGrid exposes one event, <code>itemEditEnd</code>, that looks like it might be useful. However, there are a couple of problems:</p>
<ol>
<li>The <code>itemEditEnd</code> event is dispatched <strong>every time cell editing ends</strong> &#8212; not just when the cell&#8217;s data changes. So the fact that the event is dispatched doesn&#8217;t automatically tell us that the data has changed.</li>
<li>Unlike the DataGrid&#8217;s <code>itemEditBegin</code> event, which has a corresponding <code>itemEditBeginning</code> event, the <code>itemEditEnd</code> event doesn&#8217;t have a corresponding event that you can use to get the value before it is edited (in fact <code>itemEditEnd</code>, in most cases, gives you the value before it is changed, whether or not it actually changes).</li>
<li>The event object dispatched by the <code>itemEditEnd</code> event is a fl.events.DataGridEvent. That class doesn&#8217;t have any property such as <code>dataChanged</code> or <code>oldValue</code> and <code>newValue</code>, so I didn&#8217;t see any obvious way to identify whether the data had changed. (The DataGridEvent class does have some properties that end up being useful &#8212; but nothing that can be used without some work.)</li>
</ol>
<p>Eventually, however, after stepping through the source code of the DataGrid several times as it processed editing events, I was able to figure out a couple of ways that you can identify when an edited item&#8217;s value has changed in an editable DataGrid.</p>
<p>The premise behind both of these approaches is this: Normally when you register a listener for the DataGrid&#8217;s <code>itemEditEnd</code> event, the underlying data in the DataProvider still contains the old values, and hasn&#8217;t been updated by the DataGrid. In fact, the DataGrid itself updates the DataProvider by registering for its own <code>itemEditEnd</code> event, then checking whether the original value is different than the new value, and updating the DataProvider it that&#8217;s the case. The question is, if the DataGrid is updating the underlying data as part of handling the <code>itemEditEnd</code> event, how can we get the value both before and after it changes, so we can compare them and see if it&#8217;s changed?</p>
<h3 id="twolisteners">Using two event listener functions</h3>
<p>This is the approach I recommend, although it does require more code (because you have to write two event listener functions). The trick behind this approach is the concept of event priority.</p>
<p>As I mentioned above, the DataGrid itself uses its own <code>itemEditEnd</code> event to update its DataProvider. If you consider the <a href="http://livedocs.adobe.com/flash/9.0/main/00000022.html">conceptual model of how events work in ActionScript 3.0</a>, basically when a user ends the item editing process (probably by clicking or tabbing away from a particular cell), the DataGrid loops through the list of objects that have registered as listeners for the <code>itemEditEnd</code> event, calling each function in turn. Since the DataGrid uses <code>itemEditEnd</code> to update its DataProvider, that could theoretically lead to inconsistent results. Depending on whether your particular listener function is called before or after the DataGrid&#8217;s internal <code>itemEditEnd</code> listener function, the value in the DataProvider may or may not be updated with the new value.</p>
<p>In order to prevent this potential problem, the DataGrid uses event priority to specify that it should be called <em>after</em> most of its event listeners &#8212; which is the reason why (in the normal case) the DataProvider contains the pre-edit data rather than the new value (if any). Specifically, when the DataGrid registers as a listener of its own <code>itemEditEnd</code> event, it does so using a priority of -50. Here is the actual code, from line 679 of the DataGrid class&#8217;s source code:</p>
<pre><code>addEventListener(DataGridEvent.ITEM_EDIT_END, itemEditorItemEditEndHandler, false, -50);</code></pre>
<p>When you register an event listener in ActionScript, you can optionally specify a priority for your listener (the default, which most listeners use, is 0). Listeners with a higher priority get called first, and listeners with a lower priority get called later. Since the default priority, that&#8217;s rarely changed, is 0, any listeners that are registered using the default will get called before the DataGrid&#8217;s internal <code>itemEditEnd</code> listener &#8212; so they&#8217;ll get access to the pre-change value.</p>
<p>However, there&#8217;s no reason that your event listener can&#8217;t register with a different priority. For that matter, you can register two different listener functions for the same event, with different priorities, which is exactly how this approach works.</p>
<p>You register two functions as listeners for the DataGrid&#8217;s <code>itemEditEnd</code> event. The first one should be called <em>before</em> the DataGrid updates the DataProvider, so it must be registered with a priority greater than -50 (I use 100 here):</p>
<pre><code>// This variable will store a temporary value
// to check if the DataGrid's edited item changes
var tempValue:Number;

// register itemEditEnd listener that will be called before an item's value is updated
myGrid.addEventListener(DataGridEvent.ITEM_EDIT_END, itemEditPreEnd, false, 100);

function itemEditPreEnd(event:DataGridEvent):void
{
   // get a reference to the datagrid
   var grid:DataGrid = event.target as DataGrid;
   // get a reference to the name of the property in the
   // underlying object corresponding to the cell that's being edited
   var field:String = event.dataField;
   // get a reference to the row number (the index in the
   // dataprovider of the row that's being edited
   var row:Number = Number(event.rowIndex);

   if (grid != null)
   {
      // gets the value (pre-edit) from the grid's dataprovider
      tempValue = grid.dataProvider.getItemAt(row)[field];
      // you could also use this line to get the value
      // directly from the cellrenderer that's showing the value
      // in the datagrid -- it's the same value.
      // That way you wouldn't need a reference to the DataGrid.
      //tempValue = event.itemRenderer.data[field];
   }
}</code></pre>
<p>The second listener should be called <em>after</em> the DataGrid updates its DataProvider, so it must be registered with a priority less than -50 (I use -100 here):</p>
<pre><code>// register itemEditEnd listener that will be called after an item's value is updated
myGrid.addEventListener(DataGridEvent.ITEM_EDIT_END, itemEditPostEnd, false, -100);

function itemEditPostEnd(event:DataGridEvent):void
{
   var grid:DataGrid = event.target as DataGrid;
   var field:String = event.dataField;
   var row:Number = Number(event.rowIndex);
   if (grid != null)
   {
      // gets the value (post-edit) from the grid's dataprovider
      var newValue:Number = grid.dataProvider.getItemAt(row)[field];
      // you could also use this line to get the value
      // directly from the cellrenderer that's showing the value
      // in the datagrid -- it's the same value.
      // That way you wouldn't need a reference to the DataGrid.
      //var newValue = event.itemRenderer.data[field];

      // check if the value has changed
      if (newValue != tempValue)
      {
          // do actions that should happen when the data changes
      }
   }
}</code></pre>
<p>Notice that in the first listener function (<code>itemEditPreEnd</code>) the function stores the current value in a persistent variable (a variable which is declared outside the function scope). In the second listener function (<code>itemEditPostEnd</code>) that stored value is compared to the final value, and if they&#8217;re different we know that the value of the edited item actually changed.</p>
<p>Here&#8217;s a working example of this approach:</p>
<p>
	<script type="text/javascript">
	// <!CDATA[[
	var flashTwoListeners = new FlashObject("/resources/2007/05/01/detecting_datagrid_edits_2listeners.swf", "twolisteners", "300", "175", 9, "#336699");
	flashTwoListeners.write();
	// ]]&gt;
	</script>
</p>
<h3 id="onelistener">Using one event listener function</h3>
<p>Although I recommend the other approach, if you don&#8217;t like the idea of using two listeners for some reason, or if you&#8217;re concerned about using the semi-hack of using two different priorities, there is an alternative approach that uses only one event listener.</p>
<p>In this approach, you create a single listener function, and register it with a priority greater than -50 (the default 0 is fine). I repeat, your listener <strong>must</strong> be triggered before the DataGrid updates the DataProvider, or else you&#8217;ll get a runtime error.</p>
<p>This approach works by pulling values from two different places. For the pre-change value, it looks in the DataProvider (or optionally in the cellrenderer for the cell, as shown above). For the post-change value, it actually looks at the DataGrid&#8217;s <code>itemEditorInstance</code> property, which is the actual display object that&#8217;s used for the editing field, and pulls the raw data from there (basically, it reads the <code>text</code> property of the TextField that&#8217;s used in the default item editor). Where it gets complicated is that it has to dynamically determine the name of the property that&#8217;s used by the item editor. That way, if you create a DataGrid that uses a custom item editor (e.g. if you have numeric data in a column and use a NumericStepper whenever that column is being edited, rather than the default text field) then you&#8217;ll need to know the name of that item editor&#8217;s property from which you should get the edited value.</p>
<p>Here&#8217;s what the code looks like:</p>
<pre><code>// register itemEditEnd listener to determine when an item is changed
myGrid.addEventListener(DataGridEvent.ITEM_EDIT_END, itemEditEndHandler);

function itemEditEndHandler(event:DataGridEvent):void
{
   // get a reference to the datagrid
   var grid:DataGrid = event.target as DataGrid;
   // get a reference to the name of the property in the
   // underlying object corresponding to the cell that's being edited
   var field:String = event.dataField;
   // get a reference to the row number (the index in the
   // dataprovider of the row that's being edited
   var row:Number = Number(event.rowIndex);
   // get a reference to the column number of
   // the cell that's being edited
   var col:int = event.columnIndex;

   if (grid != null)
   {
      // gets the value (pre-edit) from the grid's dataprovider
      var oldValue:Number = Number(grid.dataProvider.getItemAt(row)[field]);
      // you could also use this line to get the value
      // directly from the cellrenderer that's showing the value
      // in the datagrid -- it's the same value.
      // That way you wouldn't need a reference to the DataGrid.
      //var oldValue = event.itemRenderer.data[field];

      // get the value (post-edit) from the item editor
      var newValue:Number = Number(grid.itemEditorInstance[grid.columns[col].editorDataField]);

      // check if the value has changed
      if (newValue != oldValue)
      {
         // do actions that should happen when the data changes

         // Note that in this case, the dataprovider
         // hasn't been updated yet, so you can't do any
         // actions that require the dataprovider to have
         // the new data
      }
   }
}</code></pre>
<p>In fact, if you already know for certain what type of object is being used as the item editor, you don&#8217;t need to use such convoluted code. For example, with the default item editor, <code>grid.columns[col].editorDataField</code> will always be &#8220;text&#8221; (the <code>.text</code> property) so you can just use code like this to get the post-edit value:</p>
<pre><code>var newValue:Number = Number(grid.itemEditorInstance.text);</code></pre>
<p>And of course, if you&#8217;re using some custom item editor, you can just hard-code the appropriate property name. For example, if you&#8217;re using a NumericStepper instead of the default item editor, you can use &#8220;value&#8221; instead of &#8220;text&#8221;:</p>
<pre><code>var newValue:Number = grid.itemEditorInstance.value;</code></pre>
<p>Note the biggest drawback to this approach, as explained in the comments: the DataProvider hasn&#8217;t been updated by the DataGrid yet, so if you want to do anything using the DataProvider this approach won&#8217;t work (unless you use some technique to delay your actions until after the DataGrid has updated its DataProvider). As stated previously, you can&#8217;t use this technique after the DataGrid has updated the DataProvider; if you try to, you will not be able to get the pre-edit value (because the DataProvider will have already changed) and you&#8217;ll get a runtime exception (because the item editor will have already been destroyed, so you won&#8217;t be able to access it anymore to get the new value).</p>
<p>Here&#8217;s a working example of this approach (it looks the same as the previous one, of course):</p>
<p>
	<script type="text/javascript">
	// <!CDATA[[
	var flashOneListener = new FlashObject("/resources/2007/05/01/detecting_datagrid_edits_1listener.swf", "onelistener", "300", "175", 9, "#336699");
	flashOneListener.write();
	// ]]&gt;
	</script>
</p>
<h2>Extra</h2>
<p><a href="/resources/2007/05/01/detecting_datagrid_edits_examples.zip">Download the examples from this article</a> (1.1MB .zip &#8212; as usual, a FLA with components is BIG).</p>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2007/05/01/flash-cs3-datagrid-detecting-data-change/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Recent thinking on open source Flash Player</title>
		<link>http://probertson.com/articles/2007/04/11/thinking-on-open-source-flash-player/</link>
		<comments>http://probertson.com/articles/2007/04/11/thinking-on-open-source-flash-player/#comments</comments>
		<pubDate>Wed, 11 Apr 2007 21:07:25 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[Articles to remember]]></category>
		<category><![CDATA[Elsewhere on the web]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://probertson.com/articles/2007/04/11/thinking-on-open-source-flash-player/</guid>
		<description><![CDATA[The arguments are being made, and not just by the stereotypical open source advocates: some big-name industry analysts are suggesting that Flash Player should go open source, and that it won&#8217;t have the negative impacts that I and many others worry about:

Anne Zelenka: &#8220;Why Open is Good and How Open Could Be Good for Flash&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>The arguments are being made, and not just by the stereotypical open source advocates: some big-name industry analysts are suggesting that Flash Player should go open source, and that it won&#8217;t have the negative impacts that I and many others worry about:</p>
<ul>
<li>Anne Zelenka: &#8220;<a href="http://redmonk.com/anne/2007/01/08/why-open-is-good/">Why Open is Good and How Open Could Be Good for Flash</a>&#8221; (and it&#8217;s predecessor, linked to from that article).</li>
<li>Ted Leung: &#8220;<a href="http://www.sauria.com/blog/2007/03/01/adobe-wants-to-be-the-microsoft-of-the-web/">Adobe wants to be the Microsoft of the Web</a>&#8221; (and its followup article, linked at the bottom)</li>
<li>Ryan Stewart: &#8220;<a href="http://blogs.zdnet.com/Stewart/?p=340">How Adobe can overcome the issues around open sourcing the Flash Player</a>&#8221; (he <a href="http://blogs.zdnet.com/Stewart/?p=298">previously stated that Adobe shouldn&#8217;t open source Flash Player</a>, so this is an interesting article with some new ideas I hadn&#8217;t seen before.)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2007/04/11/thinking-on-open-source-flash-player/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Introduction to ActionScript 3.0&#8221;: slides, files, and recording</title>
		<link>http://probertson.com/articles/2007/03/15/actionscript-3-introduction-files/</link>
		<comments>http://probertson.com/articles/2007/03/15/actionscript-3-introduction-files/#comments</comments>
		<pubDate>Thu, 15 Mar 2007 13:47:10 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Articles by Paul]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Opinions]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://probertson.com/articles/2007/03/15/actionscript-3-introduction-files/</guid>
		<description><![CDATA[A few weeks back (February 21, 2007) I gave a presentation titled &#8220;Introduction to ActionScript 3.0&#8221; to the Indiana University Flash Users&#8217; Group. The bulk of the presentation was a comparison between previous ActionScript versions and ActionScript 3.0, looking at syntax, the object model, event handling, how code runs in Flash Player, and more. I [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks back (February 21, 2007) I gave a presentation titled &#8220;Introduction to ActionScript 3.0&#8221; to the <a href="http://www.indiana.edu/~iufug/">Indiana University Flash Users&#8217; Group</a>. The bulk of the presentation was a comparison between previous ActionScript versions and ActionScript 3.0, looking at syntax, the object model, event handling, how code runs in Flash Player, and more. I also discussed the underlying standards that ActionScript 3.0 is based on and gave some thoughts on why you would (or wouldn&#8217;t) want to use ActionScript 3.0 rather than ActionScript 2.0.</p>
<p>Anyway, if you&#8217;re interested in this topic, the following links may be useful to you:</p>
<ul>
<li>A <a href="/resources/2007/03/15/ActionScript3Intro_IUFUG_2007-02-21.zip">Slides (with lots of notes!) and example files/code</a> (271 KB .zip)</li>
<li>A <a title="Recording of my Feb. 21 2007 Introduction to ActionScript 3.0 presentation" href="http://adobechats.adobe.acrobat.com/p80054401/">recording of the presentation</a>, in case you want to actually hear what I had to say =)</li>
</ul>
<p>As always, feel free to <a href="#respond">add a comment</a> or <a href="/about/contact/">contact me</a> if you have any questions or thoughts.</p>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2007/03/15/actionscript-3-introduction-files/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Loading a cfform SWF into another SWF</title>
		<link>http://probertson.com/articles/2007/03/06/loading-cfform-into-swf/</link>
		<comments>http://probertson.com/articles/2007/03/06/loading-cfform-into-swf/#comments</comments>
		<pubDate>Tue, 06 Mar 2007 17:27:30 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Articles by Paul]]></category>
		<category><![CDATA[ColdFusion Flash Forms]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://probertson.com/articles/2007/03/06/loading-cfform-into-swf/</guid>
		<description><![CDATA[I haven&#8217;t written about ColdFusion Flash Forms in a while (I&#8217;m a Flex user now that you no longer need a server to create the content). However, this morning I got an interesting question from &#8220;trifide&#8221; that I hadn&#8217;t considered before, so I&#8217;m making a brief return into cfform land:
There are many attempts to loading [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t written about ColdFusion Flash Forms in a while (I&#8217;m a Flex user now that you no longer need a server to create the content). However, this morning I got an <a href="/articles/2005/10/03/dynamic-cfinput-label-2/#comment-12470">interesting question</a> from &#8220;trifide&#8221; that I hadn&#8217;t considered before, so I&#8217;m making a brief return into cfform land:</p>
<blockquote><p>There are many attempts to loading external swf into cfform… But what about the contrary? Do you know a way to embed cfform into a flash movie? i.e. call a cfform in a movieclip without getURL and external pop-up ..</p>
</blockquote>
<p>I started writing a comment response, but naturally it was getting pretty long-winded so I decided it deserved its own posting.</p>
<p>When you use cfform in a coldfusion page, the server generates a SWF file, with its own URL. (I don&#8217;t know whether it actually writes it to the disk, or whether it just keeps it in it&#8217;s memory &#8212; but from the end-user perspective that doesn&#8217;t really matter.) More specifically, it generates a SWF, then sends the appropriate HTML to the browser including the URL of the SWF. From the browser&#8217;s perspective the SWF is a completely separate item at a different URL &#8212; the browser doesn&#8217;t know that the programmer wrote it all in a single document. You can see the generated SWF&#8217;s URL by looking at the HTML source code of the CFM page.</p>
<p>For example, consider the page at the following URL (an example accompanying an article by the folks at <a href="http://asfusion.com/">ASFusion</a>):</p>
<p><a href="http://www.asfusion.com/blog/examples/cfdj/">http://www.asfusion.com/blog/examples/cfdj/</a></p>
<p>If you view the source, you&#8217;ll see that the page includes some JavaScript that is used to write the appropriate object and embed tags into the browser page. Right in the middle of that you&#8217;ll see this line (today at least; the file name may change in the future, as explained below):</p>
<pre><code>document.write("   src='/blog/examples/cfdj/859792312.mxml.cfswf' ");</code></pre>
<p>That&#8217;s the line of JavaScript that&#8217;s writing the SWF&#8217;s generated URL into the page. So we know that there is a URL that the web server will recognize and, when a computer requests that URL, the server will return the appropriate SWF.</p>
<p>You can try it out if you&#8217;d like &#8212; try requesting the SWF&#8217;s URL directly (i.e. http://www.asfusion.com/blog/examples/cfdj/859792312.mxml.cfswf) and you&#8217;ll see the same SWF, without the HTML page wrapper.</p>
<p>So, knowing the URL of the generated SWF, you can use it in the same way you&#8217;d use any SWF. As I mentioned, you can type the URL in the browser to request it directly, or you could alternatively load it into another SWF using <code>MovieClip.loadMovie()</code> or any other MovieClip loading technique (e.g. the Loader class in ActionScript 3.0).</p>
<h2>Potential issues</h2>
<p>There are, of course, a couple of gotchas that you&#8217;ll want to keep in mind.</p>
<ol>
<li>
<p>First of all, notice that the generated SWF&#8217;s URL is really just a number with a couple of file extensions. The reason for that is because this generated URL represents a single version of your cfform SWF. If you change the source code of the cfform in such a way that it needs to recompile the SWF, then the server will generate a new SWF with a new URL.  So any time you change your cfform, the URL will change too (and, obviously, you&#8217;ll need to change the URL that&#8217;s called by the other SWF doing the loading).  The reason the URL changes is to prevent the browser from using the cached (old) SWF &#8212; with a new URL, the browser loads a new SWF.</p>
<p>An obvious workaround is to just make a copy of the generated SWF and put it at a permanent URL. Like I said, I&#8217;m not sure if ColdFusion actually writes the generated SWF to the server&#8217;s hard drive, or whether it just keeps it in memory. If it does write it to disk it should be easy to get a copy from the server. If not, you can just load the SWF directly in a browser and then choose &#8220;Save As&#8230;&#8221; (or whatever) from your browser to save a copy of the SWF locally. BUT, by using a single URL, you lose the automatic versioning that prevents the browser from caching the SWF. You can find one idea to work around that issue (i.e. to do your own SWF versioning) in my article &#8220;<a href="/articles/2005/02/14/flash-databases-urlvars-flashvars/">Using URL Variables and FlashVars</a>&#8221; (specifically the URL Variables part of the article).</p>
</li>
<li>Second (and this is a big one): From my rudimentary tests, it looks like any queries in the CF page that the cfform uses are not available when you load the SWF separate from the CFM page.  I&#8217;m not sure why &#8212; I&#8217;d have to look more at the generated MXML to try to figure it out &#8212; but my guess is that the SWF makes use of the URL of its container HTML page to figure out where to communicate to get its data (rather than having the CFM page&#8217;s URL hard-coded into the SWF). Depending on what you want to use the cfform for, that probably throws a big wrench into things.</li>
<li>If you&#8217;re actually using the cfform for its intended purpose &#8212; that is, as a form to submit data &#8212; you&#8217;re going to have some issues with loading it into another SWF. When you submit a cf flash form, it navigates away from the current URL to the cfform tag&#8217;s &#8220;target&#8221; URL (essentially using <code>LoadVars.send()</code>, so clicking that button on a cfform SWF loaded into another SWF would navigate away from the container SWF as well.</li>
</ol>
<p>Finally, I can&#8217;t help but mention that loading a cfform SWF into another SWF may be a case of over-complicating something that can be done better in other ways. The obvious alternative is to just use Flex directly to create the form SWF, then loading the Flex SWF into the other SWF. Naturally, that means you&#8217;ll need to learn Flex&#8230;but if you&#8217;ve used cf flash forms then you&#8217;re already well on your way into that territory &#8212; just write out the generated mxml and take a look at what it consists of; then change a few things in the cfform and see how that changes the generated mxml&#8230;and so on. Don&#8217;t get me wrong &#8212; I&#8217;m sure there are legitimate reasons for using cfform rather than Flex in this situation, and I obviously can&#8217;t predict all the use cases. But over the long run I think you&#8217;ll find it&#8217;s a lot easier, without any of the issues or side effects, to use Flex.</p>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2007/03/06/loading-cfform-into-swf/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>XML-RPC client updated</title>
		<link>http://probertson.com/articles/2007/01/10/xml-rpc-client-updated/</link>
		<comments>http://probertson.com/articles/2007/01/10/xml-rpc-client-updated/#comments</comments>
		<pubDate>Wed, 10 Jan 2007 17:12:05 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Articles by Paul]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://probertson.com/articles/2007/01/10/xml-rpc-client-updated/</guid>
		<description><![CDATA[In case anybody follows my site just to get updates on my XML-RPC client library&#8230; I&#8217;ve just released an updated version of my XML-RPC client library project.
The library is still in ActionScript 2.0&#8212;I haven&#8217;t finished porting it to ActionScript 3.0 yet, although I&#8217;ve started.
This release (.3 beta) contains a single bug fix. In anticipation of [...]]]></description>
			<content:encoded><![CDATA[<p>In case anybody follows my site just to get updates on my XML-RPC client library&#8230; I&#8217;ve just released an updated version of my <a href="/projects/xmlrpc/">XML-RPC client library project</a>.</p>
<p>The library is still in ActionScript 2.0&#8212;I haven&#8217;t finished porting it to ActionScript 3.0 yet, although I&#8217;ve started.</p>
<p>This release (.3 beta) contains a single bug fix. In anticipation of porting the library over to ActionScript 3.0, I wrote a series of unit tests, and&#8212;what do you know&#8212;I found a bug in the code that parses date values returned from an XML-RPC service call. I guess <a href="/articles/2005/11/08/actionscript-3-unit-testing-recommended/">unit tests really are useful for ActionScript</a> =).</p>
<p>I also added a new <a href="/resources/projects/xmlrpc/docs/history.html">project history page</a> and a new <a href="/resources/projects/xmlrpc/docs/examples.html#stepbystep">step-by-step example of how to make an XML-RPC call</a>, in response to some user feedback and questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2007/01/10/xml-rpc-client-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Deep-linking&#8221; to different frames/states in a Flash application</title>
		<link>http://probertson.com/articles/2006/12/14/deep-linking-flash-application-states/</link>
		<comments>http://probertson.com/articles/2006/12/14/deep-linking-flash-application-states/#comments</comments>
		<pubDate>Thu, 14 Dec 2006 15:52:29 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Articles by Paul]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[User-centered design]]></category>

		<guid isPermaLink="false">http://probertson.com/articles/2006/12/14/deep-linking-flash-application-states/</guid>
		<description><![CDATA[Note: a new article based on this one was published on the Adobe Developer Center in September 2007. The article (&#8220;Deep-linking to frames in Flash websites&#8221;) includes more background and detail of the first technique (the no-code approach) described in this article, but doesn&#8217;t discuss any of the other approaches.
I got an email from &#8220;Brent&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p class="editornote">Note: a new article based on this one was published on the Adobe Developer Center in September 2007. The article (&#8220;<a href="http://www.adobe.com/devnet/flash/articles/deep_linking.html">Deep-linking to frames in Flash websites</a>&#8221;) includes more background and detail of the first technique (the no-code approach) described in this article, but doesn&#8217;t discuss any of the other approaches.</p>
<p>I got an email from &#8220;Brent&#8221; asking me if it&#8217;s possible to give someone a url that links directly to a particular keyframe of a Flash application:</p>
<blockquote><p>Maybe you can tell me if this is possible or not, I have a feeling it&#8217;s not cause i&#8217;ve been searching through google and not finding anything written about it.  Can you target a specific keyframe in a flash movie through an HTML page link (possibly using PHP? or javascript to feed the info to flash?)  The reason for doing this would be if, for instance you had a flash site with different sections and wanted to give someone a link to your contact section without having them navigate to it&#8230;</p>
<p>is this possible?</p></blockquote>
<p>Indeed, it is possible.</p>
<p>There are a few ways to accomplish what Brent was asking about. In fancy buzzword circles they might call it &#8220;using REST with Flash&#8221; or &#8220;creating RESTful urls that work with Flash&#8221;, or something like that (the key term being &#8220;REST&#8221;, which means having distinct urls for direct-linking to different states of a web-based application).</p>
<h2>I. Using Flash&#8217;s frame anchors</h2>
<p>The first way is one you can do within Flash itself, without needing any ActionScript. You can assign &#8220;anchors&#8221; to keyframes on the timeline. If you&#8217;re familiar with adding frame labels to frames, it works pretty much the same way:</p>
<ol>
<li>Select the keyframe you want to be able to target</li>
<li>In the Property inspector enter the anchor text (the text that will be added to the url to link to the particular frame) in the &#8220;&lt;Frame Label&gt;&#8221; field</li>
<li>In the &#8220;Label type&#8221; drop-down choose &#8220;Anchor&#8221;</li>
<li>Finally, to make it work you have to open File > Publish Settings, and in the HTML tab, in the Template field, choose &#8220;Flash with Named Anchors&#8221;</li>
</ol>
<p>To link directly to a particular keyframe, just use this format: &#8220;html_page_name.html#anchor_name&#8221; (replacing &#8220;anchor_name&#8221; with whatever name you gave the keyframe in step 2 above).</p>
<p>Admittedly I&#8217;ve never used this in production. I did a quick test and it seemed to work fine in Firefox 2.0 and Internet Explorer 6; but I couldn&#8217;t say if it will work in other browsers.</p>
<p>Also note that if you want to use frame labels (e.g. for ActionScript navigation) and anchors on the same frame #, you need to create them separately. In other words, you need a keyframe on one layer at that frame with the frame label, and another keyframe on another layer of the same frame with the anchor.</p>
<h2 id="flashvars">II. Using FlashVars and server-side code (url variables)</h2>
<p>For a more involved (but well-tested) approach, you could use FlashVars with PHP to pass in the url.  Basically you would make your html page url look something like this:</p>
<pre><code>html_page.php?section=profile</code></pre>
<p>The value that you pass in to the &#8220;section&#8221; variable could be a frame label, or just a value that you&#8217;re going to use in ActionScript somehow.</p>
<p>Then in the actual php source, in the part of the HTML that embeds Flash Player, you&#8217;d put something like this in:</p>
<pre><code>&lt;object ...&gt;
&lt;param name="FlashVars" value="section=&lt;?php echo($_GET['section']) ?&gt;" /&gt;
...
&lt;embed ... flashvars="section=&lt;?php echo($_GET['section']) ?&gt;" /&gt;
&lt;/object&gt;</code></pre>
<p class="editornote">(Note, I&#8217;m just writing this php from memory, and it&#8217;s been a while since I did php, so I may be putting the wrong thing there &#8212; but hopefully you get the idea).</p>
<p>If you&#8217;re using one of the JavaScript libraries for embedding the SWF, such as SWFObject or Adobe&#8217;s Active Content technique, those libraries already have built-in functionality for FlashVars, so you should be able to find examples of how you&#8217;d add the FlashVars with those libraries.</p>
<p>Anyway, that&#8217;s the HTML/PHP side of things.  Back in Flash, on Frame 1 of the main timeline you&#8217;d add code like this:</p>
<pre><code>this.gotoAndStop(section);</code></pre>
<p>The variable named <code>section</code> is &#8216;magically&#8217; created by Flash Player, as a result of the FlashVars code that was written into the html by php.</p>
<p>For more on FlashVars, you can see this post I wrote a while ago:</p>
<p><a href="http://probertson.com/articles/2005/02/14/flash-databases-urlvars-flashvars/">Using URL Variables and FlashVars</a></p>
<p>And you can see these slides/notes from a presentation I gave to an Adobe users&#8217; group covering FlashVars and related techniques:</p>
<p><a href="http://probertson.com/articles/2006/05/31/flash-data-presentation-files/">Slides and notes from &#8220;Flash to external data communication&#8221;</a></p>
<h2>III. Using Kevin Lynch&#8217;s technique for making linkable Flash applications</h2>
<p>Finally, there&#8217;s an even more complex but fancy and re-usable approach that was shared by Kevin Lynch, formerly of Macromedia and now Chief Software Architect for Adobe. It&#8217;s more involved code-wise, but it&#8217;s pretty slick:</p>
<p><a href="http://www.klynch.com/archives/000076.html">Making Rich Internet Apps Web-Friendly</a></p>
<p>This technique (like the first one) doesn&#8217;t require anything special on the server &#8212; it uses JavaScript and ActionScript to do all the work. The advantage it has is that it updates the url in the browser window as you navigate around in the Flash SWF &#8212; so that not only can you have urls that link to different application states, but it&#8217;s easy and obvious to discover what those urls are.</p>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2006/12/14/deep-linking-flash-application-states/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Flash 8 Advanced: Another sample chapter (Video)</title>
		<link>http://probertson.com/articles/2006/10/30/flash-8-advanced-sample-chapter-video/</link>
		<comments>http://probertson.com/articles/2006/10/30/flash-8-advanced-sample-chapter-video/#comments</comments>
		<pubDate>Mon, 30 Oct 2006 20:40:38 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Articles by Paul]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Writing]]></category>

		<guid isPermaLink="false">http://probertson.com/articles/2006/10/30/flash-8-advanced-sample-chapter-video/</guid>
		<description><![CDATA[I just discovered that another sample chapter of my book, this time the chapter on Flash Video, has been made available by the publisher.
The book is &#8220;Macromedia Flash 8 Advanced: Visual QuickPro Guide&#8221; (Peachpit Press), by Russell Chun and me.
The chapter is chapter 2, &#8220;Working with Video.&#8221; It covers converting video to FLV format (in [...]]]></description>
			<content:encoded><![CDATA[<p>I just discovered that another sample chapter of my book, this time the chapter on Flash Video, has been made available by the publisher.</p>
<p>The book is &#8220;Macromedia Flash 8 Advanced: Visual QuickPro Guide&#8221; (Peachpit Press), by Russell Chun and me.</p>
<p>The chapter is chapter 2, &#8220;Working with Video.&#8221; It covers converting video to FLV format (in depth), adding Flash elements/overlays/controls to a video, and rotoscoping with Flash video.</p>
<p>The chapter has been released as part of the <a href="http://labs.adobe.com/technologies/digitaleditions/library/">sample eBook Library</a> that Adobe has released in conjunction with the <a href="http://labs.adobe.com/technologies/digitaleditions/">beta preview of the Adobe Digital Editions eBook reader</a>. You can download the chapter from the <a href="http://labs.adobe.com/technologies/digitaleditions/library/">Sample eBook Library page</a> (you may need to install the reader first &#8212; I&#8217;m not sure since I had already installed it before I went to the library page).</p>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2006/10/30/flash-8-advanced-sample-chapter-video/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Problem (and solution) : getURL() in a Flash projector fails in Firefox</title>
		<link>http://probertson.com/articles/2006/10/11/geturl-flash-projector-firefox-problem/</link>
		<comments>http://probertson.com/articles/2006/10/11/geturl-flash-projector-firefox-problem/#comments</comments>
		<pubDate>Wed, 11 Oct 2006 17:28:37 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Articles by Paul]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Web Browsers]]></category>

		<guid isPermaLink="false">http://probertson.com/articles/2006/10/11/geturl-flash-projector-firefox-problem/</guid>
		<description><![CDATA[On Windows, using  <code>getURL()</code> or a similar approach to open an HTML page from a SWF running in the standalone Flash Player (such as a Flash projector file running on a CD-ROM) doesn't work if the user has Firefox set as their default browser. Here we'll take a look at what's causing the problem and how to work around it.]]></description>
			<content:encoded><![CDATA[<p>On Windows, using  <code>getURL()</code> or a similar approach to open an HTML page from a SWF running in the standalone Flash Player (such as a Flash projector file running on a CD-ROM) doesn&#8217;t work if the user has Firefox set as their default browser. Here we&#8217;ll take a look at what&#8217;s causing the problem and how to work around it.</p>
<p class="editornote">Note: based on some <a href="#comments">helpful feedback</a> the code was revised on Oct. 30, 2006 to be more cross-platform-friendly.</p>
<p>As a followup to <a href="/articles/2006/10/06/local-remote-resources-local-swf/">a question about opening local and remote resources in ActionScript</a>, I was asked why a SWF which had been made into a projector (a standalone executable file) wasn&#8217;t able to open an HTML page using <code>getURL()</code> when the user&#8217;s default browser is Firefox. One initial idea was that it might be related to the security restrictions added in Flash Player 8, which (by default) make it so a SWF which is running off a user&#8217;s local computer can only access local resources or     network resources, but not both. However, <a href="http://livedocs.macromedia.com/flash/8/main/00001607.html">as the documentation points out</a>, a SWF which has been published as an executable file isn&#8217;t subject to the same restrictions. (And I actually tested it out to confirm that&#8217;s the case.)</p>
<p>So here&#8217;s the situation: imagine you&#8217;re creating a SWF file to use as a menu on a CD-ROM. It will have several buttons, some of which will open HTML pages that are also on the CD-ROM. That sounds easy enough&#8212;using the <code>getURL()</code> function in ActionScript 2 (or the equivalent <code>flash.net.navigateToURL()</code> function in ActionScript 3.0), you can specify a relative url (basically just the file name) of the HTML page you want to open, and when the user clicks the button, Flash Player hands the url off to the operating system and the HTML page is opened in the user&#8217;s default browser. So if you want to open a file named &#8220;test.html&#8221; which is at the same level in the file system as the SWF executable, you would use this code (ActionScript 2):</p>
<pre><code>// assume the button's instance name is myButton

myButton.onRelease = function()
{
    getURL("test.html", "_blank");
};</code></pre>
<p>or this code (ActionScript 3.0):</p>
<pre><code>// assume the button's name is myButton

import flash.events.MouseEvent;
import flash.net.*;

function openPage(event:MouseEvent):void
{
    var request:URLRequest = new URLRequest("test.html");
    navigateToURL(request, "_blank");
}

myButton.addEventListener(MouseEvent.CLICK, openPage);</code></pre>
<p>Assuming the user&#8217;s default browser is Internet Explorer (or a version of Netscape/Mozilla prior to the ones based on Firefox), this works as you would expect it to: the user clicks the button, and the page &#8220;test.html&#8221; opens in the browser.</p>
<p>However, if the user&#8217;s default browser is Firefox (or, I suspect, one of the recent Netscape versions based on Firefox) then the page does not open. Instead, one of a few possible things happens. On my system, Firefox opens with two tabs. The first tab is blank, and the second contains a security warning (something about not being able to change the location of the My Documents folder). This is very possibly because I was testing it  from my hard drive, rather than from a CD-ROM drive. On other people&#8217;s systems, from what I&#8217;ve heard, the browser opens with a blank tab and a tab which is the result of a Google &#8220;I&#8217;m feeling lucky&#8221; search based on the name of the file (which is the default action when you enter keywords rather than a valid url in the browser&#8217;s address bar).</p>
<p class="editornote">Note: this problem isn&#8217;t just limited to <code>getURL()</code> &#8212; it also applies to other methods which load a url, such as <code>LoadVars.send()</code>.</p>
<p>So what&#8217;s going on, and more importantly, how do we make it work so that we can use SWF menus to open web pages on a CD-ROM? After doing a little research, I learned first of all that Adobe is aware of the situation, and that in fact it&#8217;s not a Flash Player bug at all. It turns out that this is due to a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=249285">Firefox bug</a> (well, an out-of-control feature) based on how Firefox handles a url which is passed to it as a command-line parameter.</p>
<p>According to <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=249285">the bug report</a>, when you call Firefox on the command line, you can pass it multiple urls separated by pipe (<code>|</code>) characters and it will open each one in a separate tab. So if you issue a command like this:</p>
<pre><code>firefox -url "http://www.yahoo.com/|http://www.google.com/"</code></pre>
<p>Firefox opens a new browser window, with Yahoo in one tab and Google in another.</p>
<p>Going back to Flash Player, when you call the <code>getURL()</code>/<code>navigateToURL()</code> function with a relative url (something like &#8220;test.html&#8221;), Flash Player actually constructs an absolute url which is what it passes to the browser. So when our code says <code>getURL("test.html", "_blank")</code>, Flash Player turns that into something like this in the (Windows) operating system:</p>
<pre><code>firefox -url "file:///d|assets\test.html"</code></pre>
<p>Notice the magical pipe character (<code>|</code>) where you or I would probably put a colon (i.e. &#8220;file:///d:&#92;assets&#92;test.html&#8221;). The pipe syntax is legal&#8212;Firefox just assumes that a colon will be used instead. So when Flash Player constructs an absolute url and sends it to Firefox, Firefox sees the pipe character and says &#8220;hey, they want me to open two tabs, the first with the url &#8220;file:///d&#8221; and the second with the url &#8220;assets&#92;test.html&#8221;. Hence we see a browser window with two tabs, with the second containing the result of a Google search for &#8220;assets&#92;test.html&#8221;.</p>
<p class="editornote">Note: according to the same bug report, this has been fixed for the &#8220;Deer Park&#8221; version of Firefox, which I believe is Firefox 2.0, so once that browser is out and spread throughout the world, this won&#8217;t be as much of an issue. But I won&#8217;t be holding my breath&#8230;</p>
<p>Interestingly, on the ActionScript end of things the problem stems from the fact that Flash Player is constructing an absolute url to send to the browser, and that url contains a pipe character. When you specify an absolute url in your <code>getURL()</code>/<code>navigateToURL()</code> call, Flash Player just passes  that url to the browser unmodified. Of course that&#8217;s what we&#8217;d expect for a remote web address, like &#8220;http://www.google.com/&#8221;, but it works just the same for local &#8220;file:///&#8221; urls. So to work around the Firefox bug, what we really need to do is construct the absolute url ourselves in ActionScript, and use that url (which, again, will get passed to the browser unmodified). The big question, of course, is how we can  figure out the absolute path of a file on a CD-ROM when we don&#8217;t necessarily know the drive letter of the user&#8217;s CD-ROM drive.</p>
<p>Fortunately, ActionScript comes to our rescue. Every MovieClip object (every DisplayObject in AS3) knows the url it was loaded from. You can access this as the <code>_url</code> property in ActionScript 2, or as the <code>url</code> property of the DisplayObject&#8217;s <code>loaderInfo</code> property in ActionScript 3.0. Usually, for a SWF in a web page, this will be the url of the SWF file, of course, but when a SWF is running locally (even when it&#8217;s in an executable/projector) that property contains an absolute &#8220;file:///&#8221; url with the path of the SWF file on the file system. For example, consider this code, on a keyframe on the main timeline, running in a SWF projector (an EXE file) on a CD-ROM:</p>
<pre><code>// Assumes there's a dynamic text field on the stage named output_txt

// AS2
output_txt.text = this._url; // output_txt contains "file:///E|/assets/trial.exe"

// AS3
output_txt.text = this.loaderInfo.url; // output_txt contains "file:///E|/assets/trial.exe"</code></pre>
<p>Going back to our SWF CD-ROM menu example, if the HTML page we want to open is in the same folder as the SWF projector, we can just generate our own absolute url by getting the SWF&#8217;s url, chopping off the name of the SWF, replacing the &#8220;|&#8221; with a colon, and adding the name of the HTML page. (Or, for a more complex case, we can use the SWF&#8217;s url to determine the &#8220;base&#8221; url, and then use that to generate absolute urls for files in other folders etc.)</p>
<p>Here is the code for a working version of this (ActionScript 2):</p>
<pre><code>// code on a keyframe on the main timeline

var swfUrl:String = _root._url;
var lastSlashIndex:Number = swfUrl.lastIndexOf("/");
var pipeIndex:Number = swfUrl.indexOf("|");
var baseUrl:String;
if (pipeIndex >= 0)
{
    baseUrl = swfUrl.substring(0, pipeIndex);
    baseUrl += ":";
}
else
{
    baseUrl = "";
}
baseUrl += swfUrl.substring(pipeIndex + 1, lastSlashIndex + 1);

myButton.onRelease = function()
{
    var targetUrl:String = baseUrl + "test.html";
    getURL(targetUrl, "_blank");
};
</code></pre>
<p>And here&#8217;s a working version in ActionScript 3.0:</p>
<pre><code>// code on a keyframe on the main timeline

import flash.events.MouseEvent;
import flash.net.*;

output_txt.text = this.loaderInfo.url;

var swfUrl:String = this.root.loaderInfo.url;
var lastSlashIndex:Number = swfUrl.lastIndexOf("/");
var pipeIndex:Number = swfUrl.indexOf("|");
var baseUrl:String;
if (pipeIndex >= 0)
{
    baseUrl = swfUrl.substring(0, pipeIndex);
    baseUrl += ":";
}
else
{
    baseUrl = "";
}
baseUrl += swfUrl.substring(pipeIndex + 1, lastSlashIndex + 1);

function gotoTestHtml(event:MouseEvent):void
{
    var targetUrl:URLRequest = new URLRequest(baseUrl + "test.html");
    navigateToURL(targetUrl, "_blank");
}

myButton.addEventListener(MouseEvent.CLICK, gotoTestHtml);</code></pre>
<p class="editornote">Of course for the AS3 version you could use <a href="http://livedocs.macromedia.com/flex/2/langref/RegExp.html">regular expressions</a> for the finding and replacing&#8212;but in this case it&#8217;s simple enough, and perhaps more efficient, to not use them.</p>
<p>If you&#8217;d like to try it out for yourself, you can download <a href="/resources/2006/10/11/projector-geturl.zip">FLAs for these two versions</a> (45 KB .zip).</p>
<p>By request, I&#8217;ve also made a version of <a href="/resources/2006/10/11/projector-geturl-mx04.zip">the FLA in Flash MX 2004 format</a> (31 KB .zip).</p>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2006/10/11/geturl-flash-projector-firefox-problem/feed/</wfw:commentRss>
		<slash:comments>113</slash:comments>
		</item>
		<item>
		<title>Accessing local and remote resources in a locally running SWF</title>
		<link>http://probertson.com/articles/2006/10/06/local-remote-resources-local-swf/</link>
		<comments>http://probertson.com/articles/2006/10/06/local-remote-resources-local-swf/#comments</comments>
		<pubDate>Fri, 06 Oct 2006 16:25:14 +0000</pubDate>
		<dc:creator>Paul Robertson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Articles by Paul]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://probertson.com/articles/2006/10/06/local-remote-resources-local-swf/</guid>
		<description><![CDATA[A few days ago I got a question about accessing local and remote resources from a SWF running locally:

I have a question. You say that in your presentation &#8220;[When they&#8217;re running locally,] SWF files are set to load local files only or remote files only &#8212; if you want to load the other type, it [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I got <a href="/articles/2006/05/31/flash-data-presentation-files/#comment-2622">a question</a> about accessing local and remote resources from a SWF running locally:</p>
<blockquote><p>
I have a question. You say that in <a href="/articles/2006/05/31/flash-data-presentation-files/">your presentation</a> &#8220;[When they&#8217;re running locally,] SWF files are set to load local files only or remote files only &#8212; if you want to load the other type, it won&#8217;t work and you&#8217;ll get an error message. There are several workarounds, &#8230;&#8221;</p>
<p>Can you share the work around for this problem? I used the executable file (instead of swf) but it even gave errors when I had local and remote files to load. The browser should be always open when the file is running. Is there a way to make it run?
</p></blockquote>
<p>(Incidentally, the question was from one of my former classmates from the <a href="http://education.indiana.edu/~ist/">Indiana University Instructional Systems Technology program</a>.)</p>
<p>The workarounds depend a little bit on what you&#8217;re trying to accomplish.</p>
<p>If you want your locally-running SWF to load remote files only, the easiest solution is to change the publish settings for the movie. Under File > Publish Settings, in the Flash Tab, in the &#8220;Local playback security&#8221; field (the last field) choose &#8220;Access network only&#8221;.</p>
<p>However, it sounds like you want your SWF to be able to load remote files and local files, which makes things more complicated. What you&#8217;ll need to do is to designate the file or a location on the user&#8217;s hard drive as a &#8220;trusted&#8221; file/location. When files are trusted, Flash Player will let you access both local and remote content. There are three approaches to making this work:</p>
<ol>
<li>
<p>Designate the SWF as &#8220;trusted&#8221; in the Flash Player settings.<br />
This only works if it&#8217;s running in a browser &#8212; it sounds like you converted your SWF into an executable, so I don&#8217;t think this one will work in that situation.</p>
<p>This approach is outlined here:<br />
<a href="http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00001612.html">LiveDocs &#8220;Specifying trusted files using the Settings Manager&#8221;</a></p>
</li>
<li>
<p>Designate the folder containing the SWF (or some higher-up folder) as &#8220;trusted&#8221; in the Flash Player settings.<br />
This is the same as the previous approach, except that you designate an entire folder as trusted, so you could use one SWF to designate a folder as trusted, and put another SWF in there and it will automatically be trusted too.</p>
<p>This approach is also outlined at:<br />
<a href="http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00001612.html">LiveDocs &#8220;Specifying trusted files using the Settings Manager&#8221;</a></p>
</li>
<li>
<p>Designate the folder containing the SWF (or some higher-up folder) as &#8220;trusted&#8221; in the local configuration file.<br />
This achieves the same end result as 2) (an entire folder, and all its contents, are &#8220;trusted&#8221;).  The difference is that this approach involves creating or modifying a configuration file on the user&#8217;s computer, so it can be done without needing to access the Internet at all.</p>
<p>This approach is described here:<br />
<a href="http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00001613.html">LiveDocs &#8220;Creating configuration files for Flash development&#8221;</a></p>
</li>
</ol>
<p>
Interestingly, if you are in fact creating an executable containing your SWF and the Flash Player, you shouldn&#8217;t have any problems at all, according to this document (<a href="http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00001607.html">LiveDocs &#8220;About local file security and projector files&#8221;</a>). It says that executables are automatically &#8220;trusted&#8221; since the user explicitly chooses to run them, so they should be able to access local and remote files. I made a simple test which seemed to confirm this:</p>
<ol>
<li>Open a new FLA and add a button (instance name myButton) and a dynamic text field (instance name myTextField) to the stage.</li>
<li>Enter this code, attached to a keyframe on frame 1 of the main timeline:
<pre><code>var myLoadVars:LoadVars = new LoadVars();

myLoadVars.onLoad = function(success:Boolean)
{
     myTextField.text = "myLoadVars.value1 = " + myLoadVars.value1 + "\n";
    getURL("http://www.adobe.com/");
};

myButton.onRelease = function()
{
    myLoadVars.load("LocalSecurityTest.txt");
};</code></pre>
</li>
<li>Save the FLA to your hard drive (I just put mine on the desktop)</li>
<li>In the folder where you saved your FLA, create a new text file named &#8220;LocalSecurityTest.txt&#8221;, and enter this text in the text file (then save and close):<br />
<code>value1=Hello+There!</code></li>
<li>Under File > Publish Settings, check the &#8220;Windows Projector&#8221; checkbox, and click Publish.</li>
<li>Double-click the executable and click the button. This text should appear in the text field: &#8220;myLoadVars.value1 = Hello There!&#8221; then it should open a browser window to &#8220;www.adobe.com&#8221;. (Loading the text file data is a &#8220;local&#8221; operation; loading a url in a browser is a &#8220;network&#8221; operation).</li>
<p>If you publish an HTML/SWF version, open the html page and click the button; the text file data will load then you&#8217;ll see a security warning about accessing network content.  (Alternatively, if you publish the SWF as network only, the text file data won&#8217;t load so you&#8217;ll see &#8220;myLoadVars.value1 = undefined&#8221; in the text field and the browser will navigate to www.adobe.com).</p>
]]></content:encoded>
			<wfw:commentRss>http://probertson.com/articles/2006/10/06/local-remote-resources-local-swf/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
