<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>abitofcode</title>
	
	<link>http://abitofcode.com</link>
	<description />
	<lastBuildDate>Fri, 10 Feb 2012 16:44:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/abitofcode/JoZG" /><feedburner:info uri="abitofcode/jozg" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Toughguy over for another year</title>
		<link>http://feedproxy.google.com/~r/abitofcode/JoZG/~3/LRVV18pHfto/</link>
		<comments>http://abitofcode.com/2012/02/toughguy-over-for-another-year/#comments</comments>
		<pubDate>Fri, 10 Feb 2012 16:44:02 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://abitofcode.com/?p=680</guid>
		<description><![CDATA[Swore I&#8217;d never do this again but I&#8217;m already considering entering for 2013. Tough Guy 2011 from Realm Pictures on Vimeo.]]></description>
			<content:encoded><![CDATA[<p>Swore I&#8217;d never do this again but I&#8217;m already considering entering for 2013.<br />
<iframe src="http://player.vimeo.com/video/19831654?title=0&amp;byline=0&amp;portrait=0" width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<p><a href="http://vimeo.com/19831654">Tough Guy 2011</a> from <a href="http://vimeo.com/realmpictues">Realm Pictures</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<img src="http://feeds.feedburner.com/~r/abitofcode/JoZG/~4/LRVV18pHfto" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://abitofcode.com/2012/02/toughguy-over-for-another-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://abitofcode.com/2012/02/toughguy-over-for-another-year/</feedburner:origLink></item>
		<item>
		<title>Cocos2d Cookbook</title>
		<link>http://feedproxy.google.com/~r/abitofcode/JoZG/~3/96UMx3zsXVo/</link>
		<comments>http://abitofcode.com/2012/01/cocos2d-cookbook/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 01:48:09 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://abitofcode.com/?p=662</guid>
		<description><![CDATA[Nathan Burba has done a fantastic job of pulling together a great collection of recipes for the cocod2d cookbook covering everything from Bullets to Speech recognition. Once Sketchshare is fully launched I plan on doing a review of the book &#8230; <a href="http://abitofcode.com/2012/01/cocos2d-cookbook/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Nathan Burba has done a fantastic job of pulling together a great collection of recipes for the cocod2d cookbook covering everything from Bullets to Speech recognition.<br />
<a href="http://cocos2dcookbook.com/"><img src="http://abitofcode.com/wp-content/uploads/2012/01/cocos2d_cookbook_cover-242x300.png" alt="" title="cocos2d_cookbook_cover" width="242" height="300" class="alignleft size-medium wp-image-664" /></a> Once Sketchshare is fully launched I plan on doing a review of the book in some detail. In the meantime it&#8217;s perfect for the Inquisitive/Intermediate programmer and covers a wide variety of techniques. For further detail check out Nathans site <a href="http://cocos2dcookbook.com/">http://cocos2dcookbook.com/</a> which has videos detailing the techniques covered in the book. </p>
<p>It&#8217;s available to purchase over at <a href="http://www.packtpub.com/cocos2d-for-iphone-1-game-development-cookbook/book">Packt&#8217;s site</a></p>
<img src="http://feeds.feedburner.com/~r/abitofcode/JoZG/~4/96UMx3zsXVo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://abitofcode.com/2012/01/cocos2d-cookbook/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://abitofcode.com/2012/01/cocos2d-cookbook/</feedburner:origLink></item>
		<item>
		<title>7 days and counting :S</title>
		<link>http://feedproxy.google.com/~r/abitofcode/JoZG/~3/K6NO01DquOA/</link>
		<comments>http://abitofcode.com/2012/01/7-days-and-counting-s/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 01:53:30 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[nettlewarrior]]></category>
		<category><![CDATA[race]]></category>
		<category><![CDATA[sicknote]]></category>
		<category><![CDATA[toughguy]]></category>

		<guid isPermaLink="false">http://abitofcode.com/?p=624</guid>
		<description><![CDATA[7 days until the Raiders start this years Toughguy race by firing what&#8217;s left of the cannon. I&#8217;ll be running as &#8216;Sicknote&#8217;. I&#8217;m starting to feel a little nervous about this years race. I&#8217;ve done the summer event &#8216;NettleWarrior&#8217; 6 &#8230; <a href="http://abitofcode.com/2012/01/7-days-and-counting-s/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>7 days until the Raiders start this years <a href="http://toughguy.co.uk">Toughguy</a> race by firing what&#8217;s left of the  cannon. I&#8217;ll be running as &#8216;Sicknote&#8217;.<br />
<a href="http://abitofcode.com/wp-content/uploads/2012/01/20120122_water.jpg"><img src="http://abitofcode.com/wp-content/uploads/2012/01/20120122_water.jpg" alt="" title="20120122_water" width="560" height="420" class="aligncenter size-full wp-image-633" /></a><br />
<span id="more-624"></span><br />
I&#8217;m starting to feel a little nervous about this years race. I&#8217;ve done the summer event &#8216;NettleWarrior&#8217; 6 times now and though Nettlewarrior involves an extra lap it has only ever been cold, it&#8217;s never been freezing. </p>
<p><iframe width="620" height="349" src="http://www.youtube.com/embed/UsOboX4aFv8?fs=1&#038;feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>Cold aside, the only real unpleasant part of the course are the electric shocks in the torture tunnels. Dangly electrified wires hang between wooden blocks in the near dark.</p>
<p><iframe width="620" height="349" src="http://www.youtube.com/embed/OMgBNTIDEu4?fs=1&#038;feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>On the whole though looking forward to running again, my training strategy over Christmas was to put on plenty of weight. Not a great strategy but too late to change it now.</p>
<div id="attachment_632" class="wp-caption aligncenter" style="width: 570px"><a href="http://abitofcode.com/wp-content/uploads/2012/01/20120122_berg.jpg"><img src="http://abitofcode.com/wp-content/uploads/2012/01/20120122_berg.jpg" alt="" title="20120122_berg" width="560" height="420" class="size-full wp-image-632" /></a><p class="wp-caption-text">The only obstacle this thing doesn&#039;t go through are the concrete tunnels</p></div>
<p>At least we&#8217;re not pulling the cannon round this time <img src='http://abitofcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<img src="http://feeds.feedburner.com/~r/abitofcode/JoZG/~4/K6NO01DquOA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://abitofcode.com/2012/01/7-days-and-counting-s/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://abitofcode.com/2012/01/7-days-and-counting-s/</feedburner:origLink></item>
		<item>
		<title>We’ve open sourced the Sketchshare colour picker</title>
		<link>http://feedproxy.google.com/~r/abitofcode/JoZG/~3/X5bl3zX-ihQ/</link>
		<comments>http://abitofcode.com/2012/01/weve-open-sourced-the-sketchshare-colour-picker/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 01:08:26 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Cocos2d]]></category>

		<guid isPermaLink="false">http://abitofcode.com/?p=613</guid>
		<description><![CDATA[The color picker was commented on a number of times during beta testing so we&#8217;ve decided to give it away It&#8217;s written in cocos2d and uses the CCControl approach suggested by YannickL on the forum. Color pickers can be fiddly &#8230; <a href="http://abitofcode.com/2012/01/weve-open-sourced-the-sketchshare-colour-picker/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The color picker was commented on a number of times during beta testing so we&#8217;ve decided to give it away <img src='http://abitofcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It&#8217;s written in cocos2d and uses the CCControl approach <a href="http://www.cocos2d-iphone.org/forum/topic/19915">suggested by YannickL on the forum</a>. Color pickers can be fiddly at the best of times so Stu (<a href="https://twitter.com/#!/creativewax">@creativewax</a>) designed this one to give a much larger color selection area, particularly useful on mobile devices.<br />
<a href="http://abitofcode.com/wp-content/uploads/2012/01/colorpicker.png"><img src="http://abitofcode.com/wp-content/uploads/2012/01/colorpicker.png" alt="Sketchshare Color picker" title="Sketchshare Color picker" width="500" height="375" class="aligncenter size-full wp-image-618" /></a><br />
You can get <a href="http://www.cocos2d-iphone.org/forum/topic/28431">further details and the source code from here</a> at the moment, it&#8217;ll be moving onto github once we have a little more time.</p>
<img src="http://feeds.feedburner.com/~r/abitofcode/JoZG/~4/X5bl3zX-ihQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://abitofcode.com/2012/01/weve-open-sourced-the-sketchshare-colour-picker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://abitofcode.com/2012/01/weve-open-sourced-the-sketchshare-colour-picker/</feedburner:origLink></item>
		<item>
		<title>Sketchshare development</title>
		<link>http://feedproxy.google.com/~r/abitofcode/JoZG/~3/jRrUsPWDrgM/</link>
		<comments>http://abitofcode.com/2012/01/sketchshare-development/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 23:12:28 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Cocos2d]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://abitofcode.com/?p=599</guid>
		<description><![CDATA[Sketchshare has had some fantastic feedback from Beta &#8211; many thanks to those of you who are helping out! we’re working through all your comments and hope that you’ll appreciate the results. We’ve had quite a bit of interest in &#8230; <a href="http://abitofcode.com/2012/01/sketchshare-development/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sketchshare has had some fantastic feedback from Beta &#8211; many thanks to those of you who are helping out! we’re working through all your comments and hope that you’ll appreciate the results. We’ve had quite a bit of interest in the development of the tool, so this is some background on how it all came about -</p>
<p><iframe width="620" height="349" src="http://www.youtube.com/embed/ARyXKIjY378?fs=1&#038;feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p><span id="more-599"></span><br />
Both <a href="https://twitter.com/#!/creativewax">Stu</a> and I have young families and I guess made the decision to work remotely very early on so that we didn’t miss out through spending unnecessary hours away from the kids (did I really say that???). So, the idea for Sketchshare has been developed from our own need for a real-time collaborative tool. Working remotely as an indie developer, there is constant emailing of large files between team members &#8211; even holding images up to a webcam on occasion. I use a number of great tools for remote working &#8211; dropbox git skype, but the lack of a collaboration tool means constant travelling to meetings which is often inconvenient and time consuming.</p>
<p>The frustration has been brewing away for a few years now and the shape of the tool was there, but it was after hearing <a href="http://twitter.com/#!/fraserspeirs">Fraser Speirs</a> speaking at IOS dev in September 2011, Stu and I got together and refined the idea. A great deal of brainstorming lead to a large number of features which we then pared back to the brief for Sketchshare.</p>
<p>What we wanted was a communication rather than a creation tool, something that enhanced our development work flow by improving the way that we got ideas out there so that other people could understand us, and we them. </p>
<p>Sketchshare is a real-time collaborative communication tool that allows up to 4 users on Apple devices to talk and draw in order to enhance understanding &#8211; for example, hand annotating or editing of documents remotely during live discussion, images, or maps or doodling to explain ideas and concepts (although many other uses have been suggested). It is designed primarily as a workflow app and the result of the conversation is just saved as a single image that the users can then use as a basis for reference in whatever they are doing. The kids love doodling and talking to each other with the app too and it is really exciting how quickly everyone picks it up.</p>
<img src="http://feeds.feedburner.com/~r/abitofcode/JoZG/~4/jRrUsPWDrgM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://abitofcode.com/2012/01/sketchshare-development/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://abitofcode.com/2012/01/sketchshare-development/</feedburner:origLink></item>
		<item>
		<title>Export Flash library items as PNG’s with JSFL</title>
		<link>http://feedproxy.google.com/~r/abitofcode/JoZG/~3/8oGNJ-K2kzY/</link>
		<comments>http://abitofcode.com/2011/11/export-flash-library-items-as-pngs-with-jsfl/#comments</comments>
		<pubDate>Sat, 19 Nov 2011 16:32:28 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://abitofcode.com/?p=568</guid>
		<description><![CDATA[After last weeks news from Adobe I&#8217;m happy I held back on upgrading from Flash CS3. Flash though is still a valuable tool in the development process allowing the quick prototyping of game mechanics. What I&#8217;ve ended up doing on &#8230; <a href="http://abitofcode.com/2011/11/export-flash-library-items-as-pngs-with-jsfl/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After last weeks <a href="http://blogs.adobe.com/flashplatform/2011/11/flash-to-focus-on-pc-browsing-and-mobile-apps-adobe-to-more-aggressively-contribute-to-html5.html" title="news from adobe">news from Adobe</a> I&#8217;m happy I held back on upgrading from Flash CS3. Flash though is still a valuable tool in the development process allowing the quick prototyping of game mechanics. </p>
<p>What I&#8217;ve ended up doing on more than one occasion however is prototyping something in Flash, then finding I need to get the information out of flash into a form I can use elsewhere e.g for iOS development. Flash comes with an extension language called JSFL (JavaScript Flash) that allows scripted manipulation of the authoring environment, Adobe in their infinite wisdom decided that producing decent documentation for this killer feature was not worth the effort. Fortunately Keith Peters and Todd Yard filled the void  with the book &#8216;<a href="http://www.amazon.com/Extending-Macromedia-Flash-2004-JavaScript/dp/1590593049/ref=sr_1_1?s=books&#038;ie=UTF8&#038;qid=1321716589&#038;sr=1-1">Extending Flash MX 2004</a>&#8216; it&#8217;s still a valid book today.</p>
<p>In a recent project I needed to run through an .fla used to generate a swc and export all the items in the library that had a linkageIdentifier as separate PNG images. It took longer than it should have as I made all the mistakes I&#8217;d made on previous JSFL projects, so this time I commented the code and jotted down the issues for future reference. Another source of useful information is <a href="http://www.wastedpotential.com/?p=347">Writing a JSFL component for Flash AS3</a> where there is a link to a <a href="http://livedocs.adobe.com/flash/9.0/main/flash_cs3_extending.pdf">comprehensive API specification for JSFL</a> in pdf format.</p>
<p>The following JSFL scripts have been tested with Flash CS3 on Lion (OSX)<br />
<span id="more-568"></span></p>
<h3>1. Getting started</h3>
<p>Scripts saved with a .jsfl extension in the correct directory will show up in the Commands menu within the flash IDE. You do not need to restart flash for any changes or new scripts to be detected so I tend to open the directory in finder and use textmate (use your editor of choice) to build the scripts.</p>
<div class="terminal">
>cd ~/Library/Application\ Support/Adobe/Flash\ CS3/en/Configuration/Commands<br />
>touch test.jsfl<br />
>open .
</div>
<p>Here the backslashes in the path are escaping the spaces, and the tilda (~) is a shortcut to the users home directory.<br />
&#8216;touch test.jsfl&#8217; creates an empty file called &#8216;test.jsfl&#8217;<br />
&#8216;open .&#8217; opens a finder window in the current directory from the terminal window.</p>
<p>The following file loops through all the library items and writes their names to the output window, if you have no library items, you&#8217;ll have no output.</p>
<p>Download the file here: <a href="http://abitofcode.com/wp-content/plugins/download-monitor/download.php?id=6">ListItems.jsfl (zipped)</a></p>

<div class="wp_codebox"><table><tr id="p5685"><td class="code" id="p568code5"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// Clear the output panel </span>
fl.<span style="color: #006600;">outputPanel</span>.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// Get the Document object of the currently active</span>
<span style="color: #808080; font-style: italic;">// document (FLA file)</span>
<span style="color: #000000; font-weight: bold;">var</span> doc = fl.<span style="color: #006600;">getDocumentDOM</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// Loop through all the items in the library</span>
<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>idx <span style="color: #b1b100;">in</span> doc.<span style="color: #006600;">library</span>.<span style="color: #006600;">items</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// get a reference to the current item</span>
    <span style="color: #000000; font-weight: bold;">var</span> currentItem = doc.<span style="color: #006600;">library</span>.<span style="color: #006600;">items</span><span style="color: #66cc66;">&#91;</span>idx<span style="color: #66cc66;">&#93;</span>;
&nbsp;
    fl.<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'item:'</span> + currentItem.<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<h3>2. Export library items with a linkage as PNG&#8217;s</h3>
<p>The following script is a modified version of one I found a while back from <a href="http://www.johnnystorm.com">http://www.johnnystorm.com</a> with comments added and simplified to do what I needed.</p>
<p>It loops through all the library items, the copies each item that has a linkage to the stage before selecting all the items on the stage and cutting to the clipboard. A publish profile is generated before each image is published that has the width, height and file path set for the current library item.</p>
<p>A new temporary document is then created and the clipboard is pasted onto it. The width and height of the new document are adjusted to the size of the item and the item is placed correctly within the bounds of the document. The document is then published using the profile generated earlier which result in an image (PNG) being produced. </p>
<p>Finally we close the new document before going onto the next library item.</p>
<p>Download the file here: <a href="http://abitofcode.com/wp-content/plugins/download-monitor/download.php?id=7">ExportItemsAsPngs.jsfl (zipped)</a></p>

<div class="wp_codebox"><table><tr id="p5686"><td class="code" id="p568code6"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// Create a reference to the publishing profile we generate for each file</span>
<span style="color: #000000; font-weight: bold;">var</span> profpath = fl.<span style="color: #006600;">configURI</span> + <span style="color: #ff0000;">'Publish%20Profiles/png.xml'</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// Clear the output panel </span>
fl.<span style="color: #006600;">outputPanel</span>.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// Get a location to export images to. trim the file:/// from it using join and split</span>
<span style="color: #000000; font-weight: bold;">var</span> folderURI = decodeURI<span style="color: #66cc66;">&#40;</span>fl.<span style="color: #006600;">browseForFolderURL</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Select a folder.&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;file:///&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">join</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// split path into an array on the forward slash</span>
<span style="color: #000000; font-weight: bold;">var</span> folderItems = folderURI.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// On the Mac we need to remove the first item in the path</span>
<span style="color: #000000; font-weight: bold;">var</span> saveDir = <span style="color: #ff0000;">&quot;/&quot;</span> + folderItems.<span style="color: #0066CC;">slice</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>,folderItems.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">join</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">&quot;/&quot;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// if there is a save Directory specified then process the library items</span>
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>saveDir<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">// Get the Document object of the currently active document (FLA file)</span>
    <span style="color: #000000; font-weight: bold;">var</span> doc = fl.<span style="color: #006600;">getDocumentDOM</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Loop through all the items in the library</span>
    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>idx <span style="color: #b1b100;">in</span> doc.<span style="color: #006600;">library</span>.<span style="color: #006600;">items</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">// get a reference to the current item</span>
        <span style="color: #000000; font-weight: bold;">var</span> currentItem = doc.<span style="color: #006600;">library</span>.<span style="color: #006600;">items</span><span style="color: #66cc66;">&#91;</span>idx<span style="color: #66cc66;">&#93;</span>;
&nbsp;
        <span style="color: #808080; font-style: italic;">// Check of the linkageIdentifier property of the current item &lt;span class=&quot;hiddenGrammarError&quot; pre=&quot;movie &quot;&gt;&lt;span class=&quot;hiddenGrammarError&quot; pre=&quot;movie &quot;&gt;is</span>
        <span style="color: #808080; font-style: italic;">// set&lt;/span&gt;&lt;/span&gt;, if not ignore the item.</span>
        <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>currentItem.<span style="color: #006600;">linkageIdentifier</span> <span style="color: #66cc66;">!</span>= <span style="color: #0066CC;">undefined</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
            <span style="color: #808080; font-style: italic;">// export the current item as a png</span>
            exportItemAsPng<span style="color: #66cc66;">&#40;</span>currentItem<span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> exportItemAsPng<span style="color: #66cc66;">&#40;</span>item<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// build a filename using the linkageIdentifier </span>
    <span style="color: #000000; font-weight: bold;">var</span> pngName = saveDir + item.<span style="color: #006600;">linkageIdentifier</span> +<span style="color: #ff0000;">&quot;.png&quot;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// selects the specified library item (true = replace current selection)</span>
    doc.<span style="color: #006600;">library</span>.<span style="color: #006600;">selectItem</span><span style="color: #66cc66;">&#40;</span>item.<span style="color: #0066CC;">name</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// gets an array of all currently selected items in the library.</span>
    <span style="color: #000000; font-weight: bold;">var</span> selectedItems = doc.<span style="color: #006600;">library</span>.<span style="color: #006600;">getSelectedItems</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Add the current library item to the stage</span>
    doc.<span style="color: #006600;">library</span>.<span style="color: #006600;">addItemToDocument</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>x:<span style="color: #cc66cc;">0</span>, y:<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// array of selected items in the document</span>
    <span style="color: #000000; font-weight: bold;">var</span> w = doc.<span style="color: #0066CC;">selection</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">width</span>;
    <span style="color: #000000; font-weight: bold;">var</span> h = doc.<span style="color: #0066CC;">selection</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">height</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// create a publishing profile for this output with the filename, width and height set</span>
    createProfile<span style="color: #66cc66;">&#40;</span>item.<span style="color: #006600;">linkageIdentifier</span>, w, h, saveDir<span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// cuts the current selection from the document and writes it to the Clipboard.</span>
    doc.<span style="color: #006600;">clipCut</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Create a new temporary document to paste the clip held in the clipboard </span>
    fl.<span style="color: #006600;">createDocument</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;    
&nbsp;
    <span style="color: #808080; font-style: italic;">// get a handle on the currently focused document (the temporary one)</span>
    exportdoc = fl.<span style="color: #006600;">getDocumentDOM</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Setup the document to use the profile we generated for it useing </span>
    <span style="color: #808080; font-style: italic;">// the tenmplate</span>
    exportdoc.<span style="color: #006600;">importPublishProfile</span><span style="color: #66cc66;">&#40;</span>profpath<span style="color: #66cc66;">&#41;</span>;        
    exportdoc.<span style="color: #006600;">currentPublishProfile</span> = <span style="color: #ff0000;">&quot;png&quot;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// pastes the contents of the Clipboard into the document, defaults to </span>
    <span style="color: #808080; font-style: italic;">// adding it at the center of the document    </span>
    exportdoc.<span style="color: #006600;">clipPaste</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Selects all items on the Stage</span>
    exportdoc.<span style="color: #006600;">selectAll</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// We are only adding one item to each document so we only need to get the </span>
    <span style="color: #808080; font-style: italic;">// first item in the array of selected items</span>
    <span style="color: #000000; font-weight: bold;">var</span> selectedItem = exportdoc.<span style="color: #0066CC;">selection</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// set the dimensions of the output movie to match the dimensions of our selected clip</span>
    exportdoc.<span style="color: #0066CC;">width</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>w<span style="color: #66cc66;">&#41;</span>;
    exportdoc.<span style="color: #0066CC;">height</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>h<span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Move the selection to fit the dimensions of the export movie. </span>
    exportdoc.<span style="color: #006600;">moveSelectionBy</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>x:-selectedItem.<span style="color: #0066CC;">left</span>, y:-selectedItem.<span style="color: #006600;">top</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Deselect the selected item</span>
    exportdoc.<span style="color: #006600;">selectNone</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;    
&nbsp;
    <span style="color: #808080; font-style: italic;">// Publish the current document using the png profile we set up earlier</span>
    exportdoc.<span style="color: #006600;">publish</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
&nbsp;
    <span style="color: #808080; font-style: italic;">// access the document that is currently focused (the temporary one) and</span>
    <span style="color: #808080; font-style: italic;">// close it. Do not promt the user to save changes</span>
    exportdoc.<span style="color: #0066CC;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;    
&nbsp;
    <span style="color: #808080; font-style: italic;">// trace its name in the output panel</span>
    fl.<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'saving:'</span> + pngName<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> createProfile<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>, w, h, path<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	profile = 	<span style="color: #ff0000;">'&lt;?xml version=&quot;1.0&quot;?&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'&lt;flash_profile version=&quot;1.0&quot; name=&quot;Default&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;PublishFormatProperties enabled=&quot;true&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;defaultNames&gt;0&lt;/defaultNames&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;flash&gt;0&lt;/flash&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;generator&gt;0&lt;/generator&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;projectorWin&gt;0&lt;/projectorWin&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;projectorMac&gt;0&lt;/projectorMac&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;html&gt;0&lt;/html&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;gif&gt;0&lt;/gif&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;jpeg&gt;0&lt;/jpeg&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;png&gt;1&lt;/png&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;qt&gt;0&lt;/qt&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;rnwk&gt;0&lt;/rnwk&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;flashDefaultName&gt;0&lt;/flashDefaultName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;generatorDefaultName&gt;1&lt;/generatorDefaultName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;projectorWinDefaultName&gt;1&lt;/projectorWinDefaultName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;projectorMacDefaultName&gt;1&lt;/projectorMacDefaultName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;htmlDefaultName&gt;1&lt;/htmlDefaultName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;gifDefaultName&gt;1&lt;/gifDefaultName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;jpegDefaultName&gt;0&lt;/jpegDefaultName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;pngDefaultName&gt;0&lt;/pngDefaultName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;qtDefaultName&gt;1&lt;/qtDefaultName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;rnwkDefaultName&gt;1&lt;/rnwkDefaultName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;flashFileName&gt;'</span> + path + <span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">'.swf&lt;/flashFileName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;generatorFileName&gt;'</span> + path + <span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">'.swt&lt;/generatorFileName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;projectorWinFileName&gt;'</span> + path + <span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">'.exe&lt;/projectorWinFileName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;projectorMacFileName&gt;'</span> + path + <span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">'.app&lt;/projectorMacFileName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;htmlFileName&gt;'</span> + path + <span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">'.html&lt;/htmlFileName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;gifFileName&gt;'</span> + path + <span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">'.gif&lt;/gifFileName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;jpegFileName&gt;'</span> + path + <span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">'.jpg&lt;/jpegFileName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;pngFileName&gt;'</span> + path + <span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">'.png&lt;/pngFileName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;qtFileName&gt;'</span> + path + <span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">'.mov&lt;/qtFileName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;rnwkFileName&gt;'</span> + path + <span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">'.smil&lt;/rnwkFileName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;/PublishFormatProperties&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;PublishHtmlProperties enabled=&quot;true&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;VersionDetectionIfAvailable&gt;0&lt;/VersionDetectionIfAvailable&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;VersionInfo&gt;9,0,115,0;8,0,24,0;7,0,14,0;6,0,79,0;5,0,58,0;4,0,32,0;3,0,8,0;2,0,1,12;1,0,0,1;&lt;/VersionInfo&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;UsingDefaultContentFilename&gt;1&lt;/UsingDefaultContentFilename&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;UsingDefaultAlternateFilename&gt;1&lt;/UsingDefaultAlternateFilename&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;ContentFilename&gt;'</span>+ <span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">'.html&lt;/ContentFilename&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;AlternateFilename&gt;'</span>+ <span style="color: #0066CC;">name</span> + <span style="color: #ff0000;">'html&lt;/AlternateFilename&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;UsingOwnAlternateFile&gt;0&lt;/UsingOwnAlternateFile&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;OwnAlternateFilename&gt;&lt;/OwnAlternateFilename&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
    <span style="color: #ff0000;">'    &lt;Width&gt;'</span> + w + <span style="color: #ff0000;">'&lt;/Width&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>+
    <span style="color: #ff0000;">'    &lt;Height&gt;'</span> + h + <span style="color: #ff0000;">'&lt;/Height&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>+
	<span style="color: #ff0000;">'    &lt;Align&gt;0&lt;/Align&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Units&gt;0&lt;/Units&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Loop&gt;1&lt;/Loop&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;StartPaused&gt;0&lt;/StartPaused&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Scale&gt;0&lt;/Scale&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;HorizontalAlignment&gt;1&lt;/HorizontalAlignment&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;VerticalAlignment&gt;1&lt;/VerticalAlignment&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Quality&gt;4&lt;/Quality&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;WindowMode&gt;0&lt;/WindowMode&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;DisplayMenu&gt;1&lt;/DisplayMenu&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;DeviceFont&gt;0&lt;/DeviceFont&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;TemplateFileName&gt;/Users/abitofcode/Library/Application Support/Adobe/Flash CS3/en/Configuration/HTML/Default.html&lt;/TemplateFileName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;showTagWarnMsg&gt;1&lt;/showTagWarnMsg&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;/PublishHtmlProperties&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;PublishFlashProperties enabled=&quot;true&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;TopDown&gt;0&lt;/TopDown&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Report&gt;0&lt;/Report&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Protect&gt;0&lt;/Protect&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;OmitTraceActions&gt;0&lt;/OmitTraceActions&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Quality&gt;100&lt;/Quality&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;StreamFormat&gt;0&lt;/StreamFormat&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;StreamCompress&gt;7&lt;/StreamCompress&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;EventFormat&gt;0&lt;/EventFormat&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;EventCompress&gt;7&lt;/EventCompress&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;OverrideSounds&gt;0&lt;/OverrideSounds&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Version&gt;8&lt;/Version&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;ExternalPlayer&gt;&lt;/ExternalPlayer&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;ActionScriptVersion&gt;1&lt;/ActionScriptVersion&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;PackageExportFrame&gt;1&lt;/PackageExportFrame&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;PackagePaths&gt;&lt;/PackagePaths&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;AS3PackagePaths&gt;&lt;/AS3PackagePaths&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;DebuggingPermitted&gt;0&lt;/DebuggingPermitted&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;DebuggingPassword&gt;&lt;/DebuggingPassword&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;CompressMovie&gt;1&lt;/CompressMovie&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;FireFox&gt;0&lt;/FireFox&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;InvisibleLayer&gt;1&lt;/InvisibleLayer&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;DeviceSound&gt;0&lt;/DeviceSound&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;StreamUse8kSampleRate&gt;0&lt;/StreamUse8kSampleRate&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;EventUse8kSampleRate&gt;0&lt;/EventUse8kSampleRate&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;UseNetwork&gt;0&lt;/UseNetwork&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;DocumentClass&gt;&lt;/DocumentClass&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;AS3Strict&gt;1&lt;/AS3Strict&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;AS3Coach&gt;1&lt;/AS3Coach&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;AS3AutoDeclare&gt;1&lt;/AS3AutoDeclare&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;AS3Dialect&gt;AS3&lt;/AS3Dialect&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;AS3ExportFrame&gt;1&lt;/AS3ExportFrame&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;AS3Optimize&gt;1&lt;/AS3Optimize&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;ExportSwc&gt;0&lt;/ExportSwc&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;ScriptStuckDelay&gt;15&lt;/ScriptStuckDelay&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;/PublishFlashProperties&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;PublishJpegProperties enabled=&quot;true&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
    <span style="color: #ff0000;">'    &lt;Width&gt;'</span> + w + <span style="color: #ff0000;">'&lt;/Width&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>+
    <span style="color: #ff0000;">'    &lt;Height&gt;'</span> + h + <span style="color: #ff0000;">'&lt;/Height&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>+
	<span style="color: #ff0000;">'    &lt;Progressive&gt;0&lt;/Progressive&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;DPI&gt;4718592&lt;/DPI&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Size&gt;0&lt;/Size&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Quality&gt;80&lt;/Quality&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;MatchMovieDim&gt;1&lt;/MatchMovieDim&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;/PublishJpegProperties&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;PublishRNWKProperties enabled=&quot;true&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;exportFlash&gt;1&lt;/exportFlash&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;flashBitRate&gt;0&lt;/flashBitRate&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;exportAudio&gt;1&lt;/exportAudio&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;audioFormat&gt;0&lt;/audioFormat&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;singleRateAudio&gt;0&lt;/singleRateAudio&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;realVideoRate&gt;100000&lt;/realVideoRate&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;speed28K&gt;1&lt;/speed28K&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;speed56K&gt;1&lt;/speed56K&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;speedSingleISDN&gt;0&lt;/speedSingleISDN&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;speedDualISDN&gt;0&lt;/speedDualISDN&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;speedCorporateLAN&gt;0&lt;/speedCorporateLAN&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;speed256K&gt;0&lt;/speed256K&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;speed384K&gt;0&lt;/speed384K&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;speed512K&gt;0&lt;/speed512K&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;exportSMIL&gt;1&lt;/exportSMIL&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;/PublishRNWKProperties&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;PublishGifProperties enabled=&quot;true&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
    <span style="color: #ff0000;">'    &lt;Width&gt;'</span> + w + <span style="color: #ff0000;">'&lt;/Width&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>+
    <span style="color: #ff0000;">'    &lt;Height&gt;'</span> + h + <span style="color: #ff0000;">'&lt;/Height&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>+
	<span style="color: #ff0000;">'    &lt;Animated&gt;0&lt;/Animated&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;MatchMovieDim&gt;1&lt;/MatchMovieDim&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Loop&gt;1&lt;/Loop&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;LoopCount&gt;&lt;/LoopCount&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;OptimizeColors&gt;1&lt;/OptimizeColors&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Interlace&gt;0&lt;/Interlace&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Smooth&gt;1&lt;/Smooth&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;DitherSolids&gt;0&lt;/DitherSolids&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;RemoveGradients&gt;0&lt;/RemoveGradients&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;TransparentOption&gt;&lt;/TransparentOption&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;TransparentAlpha&gt;128&lt;/TransparentAlpha&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;DitherOption&gt;&lt;/DitherOption&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;PaletteOption&gt;&lt;/PaletteOption&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;MaxColors&gt;255&lt;/MaxColors&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;PaletteName&gt;&lt;/PaletteName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;/PublishGifProperties&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;PublishPNGProperties enabled=&quot;true&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
    <span style="color: #ff0000;">'    &lt;Width&gt;'</span> + w + <span style="color: #ff0000;">'&lt;/Width&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>+
    <span style="color: #ff0000;">'    &lt;Height&gt;'</span> + h + <span style="color: #ff0000;">'&lt;/Height&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>+
	<span style="color: #ff0000;">'    &lt;OptimizeColors&gt;1&lt;/OptimizeColors&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Interlace&gt;0&lt;/Interlace&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Transparent&gt;0&lt;/Transparent&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Smooth&gt;1&lt;/Smooth&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;DitherSolids&gt;0&lt;/DitherSolids&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;RemoveGradients&gt;0&lt;/RemoveGradients&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;MatchMovieDim&gt;1&lt;/MatchMovieDim&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;DitherOption&gt;None&lt;/DitherOption&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;FilterOption&gt;None&lt;/FilterOption&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;PaletteOption&gt;Web 216&lt;/PaletteOption&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;BitDepth&gt;24-bit with Alpha&lt;/BitDepth&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;MaxColors&gt;255&lt;/MaxColors&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;PaletteName&gt;&lt;/PaletteName&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;/PublishPNGProperties&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;PublishQTProperties enabled=&quot;true&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
    <span style="color: #ff0000;">'    &lt;Width&gt;'</span> + w + <span style="color: #ff0000;">'&lt;/Width&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>+
    <span style="color: #ff0000;">'    &lt;Height&gt;'</span> + h + <span style="color: #ff0000;">'&lt;/Height&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>+
	<span style="color: #ff0000;">'    &lt;MatchMovieDim&gt;1&lt;/MatchMovieDim&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;UseQTSoundCompression&gt;0&lt;/UseQTSoundCompression&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;AlphaOption&gt;&lt;/AlphaOption&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;LayerOption&gt;&lt;/LayerOption&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;QTSndSettings&gt;00000000&lt;/QTSndSettings&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;ControllerOption&gt;0&lt;/ControllerOption&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Looping&gt;0&lt;/Looping&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;PausedAtStart&gt;0&lt;/PausedAtStart&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;PlayEveryFrame&gt;0&lt;/PlayEveryFrame&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'    &lt;Flatten&gt;1&lt;/Flatten&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'  &lt;/PublishQTProperties&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> + 
	<span style="color: #ff0000;">'&lt;/flash_profile&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// Clear the output window</span>
    fl.<span style="color: #006600;">outputPanel</span>.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #808080; font-style: italic;">// write the profile xml (above) into the output window</span>
    fl.<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>profile<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #808080; font-style: italic;">// save the contents of the output window to the path stored in propath</span>
    fl.<span style="color: #006600;">outputPanel</span>.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span>profpath<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #808080; font-style: italic;">// clear the output window</span>
    fl.<span style="color: #006600;">outputPanel</span>.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>fl.browseForFolderURL returns a file with the prefix file:/// which when used as the file path in the publish profile causes the export to fail silently, we need to handle this.</p>
<h3>Gotcha&#8217;s</h3>
<p><strong>Silent Fail</strong> &#8211; error in publish profile such as file:/// prefix on filename. The file path in the generated publish profile has to be correct or the file will not output and Flash will probably not tell you why. Opening the file built in the createProfile method and looking through should help solve any issues here.</p>
<p>To test I set up one item in the fla and then commented out the line that closed the document;</p>

<div class="wp_codebox"><table><tr id="p5687"><td class="code" id="p568code7"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// exportdoc.close(false);</span></pre></td></tr></table></div>

<p>This left the new document open where I could try and publish it within the IDE. After fixing the file path I discovered the following error. </p>
<p><strong>Silent Fail</strong> &#8211; Trying to export with the wrong version set.</p>
<div id="attachment_575" class="wp-caption aligncenter" style="width: 598px"><a href="http://abitofcode.com/wp-content/uploads/2011/11/2011_11_19_error_v6.png"><img src="http://abitofcode.com/wp-content/uploads/2011/11/2011_11_19_error_v6.png" alt="" title="2011_11_19_error_v6" width="588" height="268" class="size-full wp-image-575" /></a><p class="wp-caption-text">Version errors can occur even though the only output is an image</p></div>
<p>Even though I was only publishing a PNG it insisted (silently) that I needed to have a version of the flash player set higher than 6. Rather than manually build up a profile that worked I changed the settings in the IDE and then used the Helper function further down to build most of the profile for me. There was some manual adjustment to add in the width, heights and filenames but as I&#8217;d only be doing this once I thought I&#8217;d leave it as is.</p>
<p>Having fixed this error I stared getting the following error;</p>
<div id="attachment_576" class="wp-caption aligncenter" style="width: 598px"><a href="http://abitofcode.com/wp-content/uploads/2011/11/2011_11_19_error_noprops.png"><img src="http://abitofcode.com/wp-content/uploads/2011/11/2011_11_19_error_noprops.png" alt="" title="2011_11_19_error_noprops" width="588" height="268" class="size-full wp-image-576" /></a><p class="wp-caption-text">When working with multiple documents make sure you have the right one before accessing properties on it</p></div>
<p>After some searching I realised I&#8217;d not closed the document after fixing the earlier error so I was in one document while trying to access properties of another one. Coupled with this, I now had an untitled document open that had no items in its library and I was running the script against it which of course produced no results.</p>
<p>Make sure before you run the script that you are on the main stage and not within a movie clip you may have been editing or you may get an error to the effect &#8216;Cannot embed blah within an instance of itself&#8217;.</p>
<p><strong>Finally: If your movie is set with Actionscript version: Actionscript 2 you will need to use linkageClassName instead of linkageBaseClass (AS3) </strong></p>
<p>Hopefully this png extraction will make more sense once I have the next post up.</p>
<h3>Helper function</h3>
<p>Download the file here: <a href="http://abitofcode.com/wp-content/plugins/download-monitor/download.php?id=8">GetProfile.jsfl (zipped)</a></p>

<div class="wp_codebox"><table><tr id="p5688"><td class="code" id="p568code8"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/****************************************************
 * Set the desired publish profile properties in    *
 * the flash IDE. Run this script from the Commands *
 * Menu and cut and paste the output from into the  *
 * export script                                    *
 * Some modification will need to be made to take   *
 * the width, height and name of each item. See the *
 * export script for an example                     *
 *                                                  *
 * Author: C.Wilson - abitofcode                    *
 * Date: 19-11-2011                                 *
 ****************************************************/</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// clear the output window</span>
fl.<span style="color: #660066;">outputPanel</span>.<span style="color: #660066;">clear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Get a path to save the current profile information into</span>
<span style="color: #003366; font-weight: bold;">var</span> saveDir <span style="color: #339933;">=</span> fl.<span style="color: #660066;">browseForFolderURL</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Save your profile template where:&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #003366; font-weight: bold;">var</span> profFile <span style="color: #339933;">=</span> saveDir <span style="color: #339933;">+</span> <span style="color: #3366CC;">'/pubprofile_template.xml'</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Export the current publish profile</span>
fl.<span style="color: #660066;">getDocumentDOM</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">exportPublishProfile</span><span style="color: #009900;">&#40;</span>profFile<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Read the profile we have exported back into a string</span>
<span style="color: #003366; font-weight: bold;">var</span> str <span style="color: #339933;">=</span> FLfile.<span style="color: #660066;">read</span><span style="color: #009900;">&#40;</span> profFile<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>str<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// Split the profile XML by line break</span>
    <span style="color: #003366; font-weight: bold;">var</span> lines <span style="color: #339933;">=</span> str.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Start building the profile string that we'll use in </span>
    <span style="color: #006600; font-style: italic;">// the export script.</span>
    <span style="color: #003366; font-weight: bold;">var</span> profileString <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>profile = &quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// loop through each line formatting for use in the template</span>
    <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>line <span style="color: #000066; font-weight: bold;">in</span> lines<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>lines<span style="color: #009900;">&#91;</span>line<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            profileString <span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>'&quot;</span> <span style="color: #339933;">+</span> lines<span style="color: #009900;">&#91;</span>line<span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>n' + <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>        
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Output the profile string to the output window so we can</span>
    <span style="color: #006600; font-style: italic;">// cut and paste into the export script</span>
    fl.<span style="color: #660066;">trace</span><span style="color: #009900;">&#40;</span>profileString<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<img src="http://feeds.feedburner.com/~r/abitofcode/JoZG/~4/8oGNJ-K2kzY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://abitofcode.com/2011/11/export-flash-library-items-as-pngs-with-jsfl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://abitofcode.com/2011/11/export-flash-library-items-as-pngs-with-jsfl/</feedburner:origLink></item>
		<item>
		<title>TotalTerminal color fix</title>
		<link>http://feedproxy.google.com/~r/abitofcode/JoZG/~3/BZIAIiSdg3w/</link>
		<comments>http://abitofcode.com/2011/10/totalterminal-color-fix/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 12:25:24 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Terminal]]></category>

		<guid isPermaLink="false">http://abitofcode.com/?p=533</guid>
		<description><![CDATA[Finally made the upgrade to Lion on my work laptop. Missing Front row a bit, the reverse scroll thing I&#8217;m getting on with and not sure what happened to spaces but losing the colour in TotalTerminal (http://totalterminal.binaryage.com/) is something I &#8230; <a href="http://abitofcode.com/2011/10/totalterminal-color-fix/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Finally made the upgrade to Lion on my work laptop. Missing Front row a bit, the reverse scroll thing I&#8217;m getting on with and not sure what happened to spaces but losing the colour in TotalTerminal (http://totalterminal.binaryage.com/) is something I can&#8217;t deal with. For the themes like Homebrew etc it&#8217;s an easy fix, open preferences and go to Settings > Advanced > Declare terminal as: and change the value to xterm-color. </p>
<div id="attachment_534" class="wp-caption aligncenter" style="width: 714px"><a href="http://abitofcode.com/wp-content/uploads/2011/10/TotalTermColor.png&nbsp;.png"><img src="http://abitofcode.com/wp-content/uploads/2011/10/TotalTermColor.png&nbsp;.png" alt="" title="TotalTermColor.png&nbsp;" width="704" height="648" class="size-full wp-image-534" /></a><p class="wp-caption-text">Change xterm256-color to xterm-color to get some colour back</p></div>
<p>Alternatively download the much nicer <a href="http://blog.toddwerth.com/entries/13" title="IR_Black terminal scheme">IR_Black colour scheme</a> and follow the instructions to install.</p>
<p>If the colour listings don&#8217;t work when using ls add an alias to your .bash_profile;</p>
<div class="terminal">
alias ls=&#8217;ls -GFh&#8217;
</div>
<p>To reload your profile after the update;</p>
<div class="terminal">
source ~/.bash_profile
</div>
<img src="http://feeds.feedburner.com/~r/abitofcode/JoZG/~4/BZIAIiSdg3w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://abitofcode.com/2011/10/totalterminal-color-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://abitofcode.com/2011/10/totalterminal-color-fix/</feedburner:origLink></item>
		<item>
		<title>Steve Jobs 1955 – 2011</title>
		<link>http://feedproxy.google.com/~r/abitofcode/JoZG/~3/TjL29nTb5dM/</link>
		<comments>http://abitofcode.com/2011/10/steve-jobs-1955-2011/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 09:59:27 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://abitofcode.com/?p=522</guid>
		<description><![CDATA[Image by jonathan mak]]></description>
			<content:encoded><![CDATA[<div id="attachment_521" class="wp-caption aligncenter" style="width: 510px"><a href="http://abitofcode.com/wp-content/uploads/2011/10/sj.png"><img src="http://abitofcode.com/wp-content/uploads/2011/10/sj.png" alt="" title="Steve Jobs 1955 - 2011" width="500" height="500" class="size-full wp-image-521" /></a><p class="wp-caption-text">RIP Steve, thanks for making the world a little less beige</p></div>
<p>Image by <a href="http://jmak.tumblr.com/post/9377189056">jonathan mak</a> </p>
<img src="http://feeds.feedburner.com/~r/abitofcode/JoZG/~4/TjL29nTb5dM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://abitofcode.com/2011/10/steve-jobs-1955-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://abitofcode.com/2011/10/steve-jobs-1955-2011/</feedburner:origLink></item>
		<item>
		<title>Give your website a custom iPad icon</title>
		<link>http://feedproxy.google.com/~r/abitofcode/JoZG/~3/McSLKGJHeOo/</link>
		<comments>http://abitofcode.com/2011/07/give-your-website-a-custom-ipad-icon/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 00:22:22 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://abitofcode.com/?p=428</guid>
		<description><![CDATA[If an icon is not explicitly provided one will be generated, the results can be a little hit and miss. Providing an asset involves creating a 72 x 72 pixels png file, saving it as apple-touch-icon.png and saving it into &#8230; <a href="http://abitofcode.com/2011/07/give-your-website-a-custom-ipad-icon/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_430" class="wp-caption aligncenter" style="width: 810px"><a href="http://abitofcode.com/wp-content/uploads/2011/07/2011_07_13.jpg"><img src="http://abitofcode.com/wp-content/uploads/2011/07/2011_07_13.jpg" alt="" title="2011_07_13" width="800" height="600" class="size-full wp-image-430" /></a><p class="wp-caption-text">The custom iPad link icon to abitofcode.com after selecting &#039;Add to Home Screen&#039;</p></div><br />
<span id="more-428"></span><br />
<div id="attachment_433" class="wp-caption alignleft" style="width: 310px"><a href="http://abitofcode.com/wp-content/uploads/2011/07/2011_07_13_add_button.jpg"><img src="http://abitofcode.com/wp-content/uploads/2011/07/2011_07_13_add_button-300x245.jpg" alt="" title="2011_07_13_add_button" width="300" height="245" class="size-medium wp-image-433" /></a><p class="wp-caption-text">An icon is added when the user selects &#039;Add to home screen&#039;</p></div></p>
<p>If an icon is not explicitly provided one will be generated, the results can be a little hit and miss. </p>
<p>Providing an asset involves creating a 72 x 72 pixels png file, saving it as apple-touch-icon.png and saving it into the root of your web folder. </p>
<p>The rounded corners and highlight effect will be generated automatically, you do not need to create them in the png.</p>
<p><br/><br />
The icon I have used for this site (as seen in the top image) is shown here.</p>
<div id="attachment_434" class="wp-caption aligncenter" style="width: 82px"><a href="http://abitofcode.com/wp-content/uploads/2011/07/apple-touch-icon.png"><img src="http://abitofcode.com/wp-content/uploads/2011/07/apple-touch-icon.png" alt="" title="apple-touch-icon" width="72" height="72" class="size-full wp-image-434" /></a><p class="wp-caption-text">apple-touch-icon.png</p></div>
<img src="http://feeds.feedburner.com/~r/abitofcode/JoZG/~4/McSLKGJHeOo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://abitofcode.com/2011/07/give-your-website-a-custom-ipad-icon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://abitofcode.com/2011/07/give-your-website-a-custom-ipad-icon/</feedburner:origLink></item>
		<item>
		<title>Displaying the apple Command + Option characters</title>
		<link>http://feedproxy.google.com/~r/abitofcode/JoZG/~3/UhmSHkIsLWc/</link>
		<comments>http://abitofcode.com/2011/07/displaying-the-apple-command-option-characters/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 23:17:28 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[ascii]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[delete]]></category>
		<category><![CDATA[hex]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[option]]></category>
		<category><![CDATA[shift]]></category>
		<category><![CDATA[tab]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://abitofcode.com/?p=399</guid>
		<description><![CDATA[Some useful Unicode and Hex Keyboard symbols &#8984; – &#38;#x2318; – &#38;#8984; – the Command Key symbol &#8997; – &#38;#x2325; – &#38;#8997; – the Option Key symbol &#8679; – &#38;#x21E7; – &#38;#8679; – the Shift Key &#8677; – &#38;#x21E5; – &#8230; <a href="http://abitofcode.com/2011/07/displaying-the-apple-command-option-characters/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some useful Unicode and Hex Keyboard symbols</p>
<p>&#8984; – &amp;#x2318; – &amp;#8984; – the Command Key symbol<br />
&#8997; – &amp;#x2325; – &amp;#8997; – the Option Key symbol<br />
&#8679; – &amp;#x21E7; – &amp;#8679; – the Shift Key<br />
&#8677; – &amp;#x21E5; – &amp;#8677; – the Tab Key symbol<br />
&#9166; – &amp;#x23CE; – &amp;#9166; – the Return Key symbol<br />
&#9003; – &amp;#x232B; – &amp;#9003; – the Delete Key symbol</p>
<p>Source: <a href="http://hugh.thejourneyler.org/finding-that-apple-command-symbol" title="The Journeyler">The Journeyler</a></p>
<img src="http://feeds.feedburner.com/~r/abitofcode/JoZG/~4/UhmSHkIsLWc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://abitofcode.com/2011/07/displaying-the-apple-command-option-characters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://abitofcode.com/2011/07/displaying-the-apple-command-option-characters/</feedburner:origLink></item>
	</channel>
</rss>

