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

<channel>
	<title>That Mike Jones</title>
	<atom:link href="https://blog.flashgen.com/feed/" rel="self" type="application/rss+xml"/>
	<link>https://blog.flashgen.com</link>
	<description>An infrequent look at developments in the world of design, development &amp; technology</description>
	<lastBuildDate>Sat, 08 Jul 2023 18:30:45 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.2.4</generator>
	<xhtml:meta content="noindex" name="robots" xmlns:xhtml="http://www.w3.org/1999/xhtml"/><item>
		<title>Debugging Core Data In Xcode 8.1 Not Working?</title>
		<link>https://blog.flashgen.com/2016/11/debugging-core-data-in-xcode-8-1-not-working/</link>
		
		<dc:creator><![CDATA[Mike Jones]]></dc:creator>
		<pubDate>Mon, 07 Nov 2016 11:05:33 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[iOS]]></category>
		<guid isPermaLink="false">https://blog.flashgen.com/?p=1311</guid>

					<description><![CDATA[<p>I was working on a new project this weekend and I came across an issue using Xcode 8.1 that I'd not seen in 8.0 - The debug info from Core Data wasn't being pushed to the console in Xcode.</p>
<p>Now if you've not worked with Core Data before, or never had to look hard under the hood at what it's doing when to add items to it you may never have come across -com.apple.CoreData.SQLDebug before. This is a runtime argument that is passed in to your app at launch that (depending on the logging level - 1 through 3) spews out in-depth info on what is being inserted etc in to your Core Data store. <a href="https://blog.flashgen.com/2016/11/debugging-core-data-in-xcode-8-1-not-working/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://blog.flashgen.com/2016/11/debugging-core-data-in-xcode-8-1-not-working/">Debugging Core Data In Xcode 8.1 Not Working?</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>I was working on a new project this weekend and I came across an issue using Xcode 8.1 that I&#8217;d not seen in 8.0 &#8211; The debug info from Core Data wasn&#8217;t being pushed to the console in Xcode.</p>
<p>Now if you&#8217;ve not worked with Core Data before, or never had to look hard under the hood at what it&#8217;s doing when to add items to it you may never have come across <strong>-com.apple.CoreData.SQLDebug</strong> before. This is a runtime argument that is passed in to your app at launch that (depending on the logging level &#8211; 1 through 3) spews out in-depth info on what is being inserted etc in to your Core Data store.</p>
<p>I tend to use:</p>
<pre class="lang:sh decode:true ">-com.apple.CoreData.SQLDebug 3</pre>
<p>As I said this worked fine in Xcode 8, but stopped working in Xcode 8.1. Unsurprisingly it was because there had been a change to how logging in general is handled in Core Data with macOS 12.0 and iOS 10.0 onwards. Now you need to add an additional argument to the run arguments:</p>
<pre class="lang:sh decode:true">-com.apple.CoreData.Logging.stderr 1</pre>
<p>You can see both entries in the screenshot of my scheme entry below (click to open a larger version).</p>
<p><a href="https://blog.flashgen.com/images/Xcode.png" target="_blank"><img decoding="async" class="captionFull aligncenter wp-image-1314 size-medium" src="https://blog.flashgen.com/images/Xcode-300x174.png" alt="Core Data debugging in Xcode 8.1" width="300" height="174" srcset="https://blog.flashgen.com/images/Xcode-300x174.png 300w, https://blog.flashgen.com/images/Xcode-768x444.png 768w, https://blog.flashgen.com/images/Xcode.png 930w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Obviously if I had read the <a href="https://developer.apple.com/library/content/releasenotes/General/WhatNewCoreData2016/ReleaseNotes.html#//apple_ref/doc/uid/TP40017342-CH1-DontLinkElementID_10" target="_blank">update notes for Core Data</a> in Xcode 8.1, I would have seen this tucked away near the bottom &#8211; but I&#8217;m a typical blokeÂ and therefore I read no instructions whatsoever and all of my Ikea furniture is wonky because of it :p.</p>
<p>Hopefully you&#8217;re not like me and you&#8217;ve had time to read this instead, and your flat-packed furniture is well made?</p><p>The post <a href="https://blog.flashgen.com/2016/11/debugging-core-data-in-xcode-8-1-not-working/">Debugging Core Data In Xcode 8.1 Not Working?</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Site clean-up and archiving</title>
		<link>https://blog.flashgen.com/2016/11/clean-up-and-archiving/</link>
		
		<dc:creator><![CDATA[Mike Jones]]></dc:creator>
		<pubDate>Tue, 01 Nov 2016 10:00:00 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Site]]></category>
		<category><![CDATA[branding]]></category>
		<category><![CDATA[rebuild]]></category>
		<category><![CDATA[site]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">http://blog.flashgen.com/?p=1292</guid>

					<description><![CDATA[<p>I know I said I was going to do something about the site a while back, but like most things in life, something else was more important and this has slipped and slipped and slipped. The site is looking a&#8230; <a href="https://blog.flashgen.com/2016/11/clean-up-and-archiving/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://blog.flashgen.com/2016/11/clean-up-and-archiving/">Site clean-up and archiving</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>I know I said I was going to do something about the site a while back, but like most things in life, something else was more important and this has slipped and slipped and slipped. The site is looking a bit long in the tooth now and not really responsive (it uses WP-Touch for mobile which is pretty bland to say the least). So I going to start work on some designs and a new theme over the coming months (it&#8217;s a pet project so paid work comes first).</p>
<p>As part of the update I will be looking at ways to archive a lot of the older articles and fix any broken links, images and the like.</p>
<p>Hopefully you&#8217;ll like the new design (whatever that may be) and it will be within keeping to the overall focus and spirit of this site?</p>
<p>Keep watching this space for further updates!</p>
<p>Thanks<br />
&#8211;<br />
m</p><p>The post <a href="https://blog.flashgen.com/2016/11/clean-up-and-archiving/">Site clean-up and archiving</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Auto Layout Visual Format language helpers</title>
		<link>https://blog.flashgen.com/2016/10/auto-layout-visual-format-language-helpers/</link>
		
		<dc:creator><![CDATA[Mike Jones]]></dc:creator>
		<pubDate>Mon, 31 Oct 2016 09:00:54 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Swift]]></category>
		<category><![CDATA[autolayout]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[swift]]></category>
		<category><![CDATA[xcode]]></category>
		<guid isPermaLink="false">http://blog.flashgen.com/?p=1285</guid>

					<description><![CDATA[<p>I watch an awful lot of videos of people programming. I find it both relaxing and interesting. Once such set of videos I enjoy watching are those produced by Brian Voong, who posts YouTube iOS walk-throughs under the title of&#8230; <a href="https://blog.flashgen.com/2016/10/auto-layout-visual-format-language-helpers/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://blog.flashgen.com/2016/10/auto-layout-visual-format-language-helpers/">Auto Layout Visual Format language helpers</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>I watch an awful lot of videos of people programming. I find it both relaxing and interesting. Once such set of videos I enjoy watching are those produced by Brian Voong, who posts <a href="https://www.youtube.com/LetsBuildThatApp" target="_blank" rel="noopener">YouTube iOS walk-throughs under the title of &#8220;Let&#8217;s Build That App&#8221;</a>.</p>
<p>I happened to have one of his videos running on my second monitor while I was coding and my ears pricked up when he started speaking about a helper extension he was using (and I assume also created) that took away some of the verbose boilerplate code that you need to write when creating Auto Layout constraints programmatically using the visual formatting language (VFL). Now this may not be useful if you need to add additional <strong>NSLayoutFormatOptions</strong> beyond the defaults but for the majority of use cases this is very handy.</p>
<p>To that end I wanted to share the code</p>
<ol>
<li>because I think it&#8217;s very handy if you do a lot of constraint configuring in code</li>
<li>and because Brian&#8217;s videos are great and you should check them out (regardless of your ability)</li>
</ol>
<p>So here&#8217;s the code:</p>
<pre class="lang:swift decode:true " title="VFL helper extension">import UIKit

extension UIView {
    
    func addConstraintsWithFormat(format: String, views: UIView...) {
        
        var viewDictionary = [String: UIView]()
        
        for (index, view) in views.enumerated() {
            let key = "v\(index)"
            viewDictionary[key] = view
            view.translatesAutoresizingMaskIntoConstraints = false
        }
        
        self.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: format,
                                                           options: NSLayoutFormatOptions(),
                                                           metrics: nil,
                                                           views: viewDictionary))
        
    }
}
</pre>
<p>Here is how you&#8217;d implement it within a custom view for example:</p>
<pre class="lang:swift decode:true" title="A Simple example">self.addConstraintsWithFormat(format: "H:|[v0]|", views: contentView)
self.addConstraintsWithFormat(format: "V:|[v0]|", views: contentView)</pre>
<p>and here is something slightly more complexâ€¦</p>
<pre class="lang:swift decode:true" title="Smaller and cleaner">self.addConstraintsWithFormat(format: "H:|-8-[v0(100)]-8-[v1(&gt;=20)]-8-[v2(100)]-8-|", views: previousButton, pageControl, nextButton)
</pre>
<p>Pretty clean and compact eh? Anyway I hope you find this useful, and thanks Brian!</p><p>The post <a href="https://blog.flashgen.com/2016/10/auto-layout-visual-format-language-helpers/">Auto Layout Visual Format language helpers</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Clean Xcode project directories with Synx</title>
		<link>https://blog.flashgen.com/2016/09/clean-xcode-project-directories-with-synx/</link>
		
		<dc:creator><![CDATA[Mike Jones]]></dc:creator>
		<pubDate>Wed, 21 Sep 2016 11:05:44 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[swift]]></category>
		<category><![CDATA[synx]]></category>
		<category><![CDATA[xcode]]></category>
		<guid isPermaLink="false">http://blog.flashgen.com/?p=1277</guid>

					<description><![CDATA[<p>Iâ€™ve been writing code for a very long time now, using different IDEs and a varied array of languages. My current jam is developing iOS applications, or more specifically, writing Swift. However, one thing that is a constant for me&#8230; <a href="https://blog.flashgen.com/2016/09/clean-xcode-project-directories-with-synx/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://blog.flashgen.com/2016/09/clean-xcode-project-directories-with-synx/">Clean Xcode project directories with Synx</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></description>
										<content:encoded><![CDATA[<div>Iâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />ve been writing code for a very long time now, using different IDEs and a varied array of languages. My current jam is developing iOS applications, or more specifically, writing Swift. However, one thing that is a constant for me &#8211; regardless of what language / glorified text editor Iâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />m using isâ€¦ keeping my file system neat and tidy.</div>
<div></div>
<div>I suppose you could say I was a bit obsessive compulsive in that way &#8211; although I warrant that most people who use a computer for more than email and Facebook probably spend a good amount of time making sure everything is organised on their hard disk (or am I truly the only oneâ€¦). Anyway before I go off on a tangent I should bring this back to the core point of this article &#8211; neat and organised code on my file system.</div>
<div></div>
<div>Now anyone whoâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />s used Xcode for any amount of time will know all about its concept of <b>groups</b>. Groups to Xcode are a conceptual way of organising your application within the project overview, but unfortunately have nothing to do with how your files are organised on your hard drive. Now for a lot of us this may not be an issue as a lot of iOS apps have a handful of classes, view controllers and storyboards; so keeping them organised isnâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />t a big deal (well not to normal people but I still see the issue :p).</div>
<div></div>
<div>The problem of â€˜virtualâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" /> grouping and file system organisation raises its ugly head when you work on a more complex and broader application that may have several hundred classes, view controllers or storyboards etc. and being able to quickly jump to one of the files from outside of Xcode can become problematic. If it does you can approach this in a couple of ways:</div>
<ol>
<li>Ignore it and accept this is how it should be</li>
<li>Manually create folders in your actual app folder to replicate the virtual groups in Xcode and organise your code the same way</li>
<li>Use something like Synx</li>
</ol>
<div>So letâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />s go through my non-exhaustive list of options one-by-one and see which may be useful, if like me, you feel it needs more thought.</div>
<div></div>
<div>First up we have Option 1 &#8211; the head in the sand approach. Itâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />s the way it is and so it shall remain. To be honest, I have no issue with this if it works for you. It doesnâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />t work for me so Iâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />m more interested in options 2 and 3.</div>
<div></div>
<div>Option 2 &#8211; manually recreate the groups as actual folders and move the files in to the same structure as Xcode groups. This works but is very manual and will likely not work on the first pass. This is generally because you have to remove all of the compile sources, linked binaries and bundle resource entries in the Build Phase of your project because they will now all be pointing to the wrong location. Plus all of the entries in your actual project will now have probably turned red as Xcode can no longer find the files. The fix for this is to remove all the file references and add them back to the project based on their new location on your hard drive. Thatâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />ll fix it but as you can see itâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />s a bit brittle. Oh and donâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />t forget your info.plist files will need resetting in the project overview for each target you have set.</div>
<div></div>
<div>Not the end of the world, but still a bit â€œmanualâ€ and time consuming. Which leads us to Synx (which is obviously the focus of this article any way :D).</div>
<div></div>
<div>Option 3 &#8211; Synx. OK, so what is Synx? Synx is a simple command line tool that reads your .xcodeproj or .xcworkspace and recreates the folder structure based on your Xcode groups and moves the files in to these newly created folders. Yay! It does all the manual stuff and quicker than I can. FTW!</div>
<div></div>
<div>Whoa there horsey! There are a few things you need to know before cracking out the Playstation controller and kicking back. Firstly you need to have Ruby on your Mac (not a big ask as most modern Macs come with a version of Ruby installed by default). Next you need to install the Ruby Gem:</div>
<div>
<pre class="lang:sh decode:true" title="Install Synx">gem install synx</pre>
</div>
<div>If youâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />re using the built in version of Ruby youâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />ll likely need to sudo the previous command, (and you should really consider using RVM).</div>
<div></div>
<div>Next via Terminal locate the root directory of your Xcode project, and once there use the following command to get Synx to rebuild your folder structure. WARNING &#8211; Make sure you have back up your project to Git or a separate location before doing this!</div>
<div>
<pre class="lang:sh decode:true" title="Firing up Synx">sync path/to/my/project.xcodeproj</pre>
</div>
<div>(obviously replacing the path with that of your actual project)</div>
<div></div>
<div>If youâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />re using Cocoapods it may have moved some bits around, which will likely confuse Cocoapods &#8211; so to be safe runÂ pod install to recreate your Cocoapods repository again.</div>
<div></div>
<div>If youâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />d like to try it out or know more, head over to the Synx repo on Github:Â <a href="https://github.com/venmo/synx" rev="en_rl_minimal">https://github.com/venmo/synx</a></div><p>The post <a href="https://blog.flashgen.com/2016/09/clean-xcode-project-directories-with-synx/">Clean Xcode project directories with Synx</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Reasons To Be Creative 2015 Slides</title>
		<link>https://blog.flashgen.com/2015/09/reasons-to-be-creative-2015-slides/</link>
		
		<dc:creator><![CDATA[Mike Jones]]></dc:creator>
		<pubDate>Fri, 25 Sep 2015 09:53:42 +0000</pubDate>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[reasons.to]]></category>
		<category><![CDATA[swift]]></category>
		<guid isPermaLink="false">http://blog.flashgen.com/?p=1271</guid>

					<description><![CDATA[<p>After a 2 year sabbatical from speaking at conferences I &#8220;jumped back on the pony&#8221; at Reasons To Be Creative 2015 in Brighton. This is probably my favourite conference and if you&#8217;ve never attended (or have stopped attending since it&#8230; <a href="https://blog.flashgen.com/2015/09/reasons-to-be-creative-2015-slides/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://blog.flashgen.com/2015/09/reasons-to-be-creative-2015-slides/">Reasons To Be Creative 2015 Slides</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>After a 2 year sabbatical from speaking at conferences I &#8220;jumped back on the pony&#8221; at Reasons To Be Creative 2015 in Brighton. This is probably my favourite conference and if you&#8217;ve never attended (or have stopped attending since it changed from Flash on the Beach), you really should come next year. </p>
<p>Anyway, my session topic this year was about Swift 1.0 (given that Swift 2.0 wasn&#8217;t getting released, literally, until after I had done my presentation). </p>
<p>If you want to have a look through the slides please feel free to do so, and grab a copy if you want to use it as a basis for a Swift 2.0 session.</p>
<p><iframe loading="lazy" src="//www.slideshare.net/slideshow/embed_code/key/omiOhBE1BuI7k8" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe> </p>
<div style="margin-bottom:5px"> <strong> <a href="//www.slideshare.net/FlashGen/swift-modern-expressive-or-magical-unicorn" title="Swift - Modern &amp; Expressive, or Magical Unicorn?" target="_blank">Swift &#8211; Modern &amp; Expressive, or Magical Unicorn?</a> </strong> from <strong><a href="//www.slideshare.net/FlashGen" target="_blank">Mike Jones</a></strong> </div>
<p>A big thanks to all those who attended and for the positive and constructive feedback :)</p><p>The post <a href="https://blog.flashgen.com/2015/09/reasons-to-be-creative-2015-slides/">Reasons To Be Creative 2015 Slides</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Thinking Things Over?</title>
		<link>https://blog.flashgen.com/2014/05/thinking-things-over/</link>
		
		<dc:creator><![CDATA[Mike Jones]]></dc:creator>
		<pubDate>Tue, 20 May 2014 13:15:08 +0000</pubDate>
				<category><![CDATA[News]]></category>
		<category><![CDATA[flashgen.com]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[redesign]]></category>
		<guid isPermaLink="false">http://blog.flashgen.com/?p=1266</guid>

					<description><![CDATA[<p>For those of you who used to visit my blog regularly you&#8217;d be aware that there was a fairly constant stream of updates and articles around the Flash Platform. For the last 2 years those regular updates have been null&#8230; <a href="https://blog.flashgen.com/2014/05/thinking-things-over/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://blog.flashgen.com/2014/05/thinking-things-over/">Thinking Things Over?</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>For those of you who used to visit my blog regularly you&#8217;d be aware that there was a fairly constant stream of updates and articles around the Flash Platform. For the last 2 years those regular updates have been null and void. Is this because of the death of Flash you may asks. Well no, Flash isn&#8217;t dead, nor do I think it&#8217;s taking its last breaths &#8211; and that&#8217;s all I have to say on the subject. However, since leaving Adobe I&#8217;ve been concentrating on other technologies in more depth &#8211; Objective-C, PHP, HTML, CSS, JavaScript and a few others. You know, all &#8220;the other stuff&#8221;.</p>
<p>To that end I&#8217;ve decided to climb back in to the blogging saddle and get back to writing up my thoughts, processes and approaches to development, design and everything in between, but now on a slightly broader basis. The first step on this &#8216;rebirth&#8217;, if you will, is the obligatory site redesign &#8211; responsive of course. Although that may take a while as I&#8217;ll need to fit it in with other stuff like paid work :p.</p>
<p>In the interim I&#8217;m going to put up a few posts about some of the tools &#038; frameworks I&#8217;m now using on a more regular basis, as well as gotchas and tip/tricks. So stay tuned for something new that&#8217;s also familiar.</p><p>The post <a href="https://blog.flashgen.com/2014/05/thinking-things-over/">Thinking Things Over?</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Remapping Flash Builder 4.x’s Default Workspace in OS X</title>
		<link>https://blog.flashgen.com/remapping-flash-builder-4-xs-default-workspace-in-os-x/</link>
					<comments>https://blog.flashgen.com/remapping-flash-builder-4-xs-default-workspace-in-os-x/#respond</comments>
		
		<dc:creator><![CDATA[Mike Jones]]></dc:creator>
		<pubDate>Wed, 03 Oct 2012 15:30:55 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<guid isPermaLink="false">http://blog.flashgen.com/?page_id=1258</guid>

					<description><![CDATA[<p>While in general I&#8217;m a pretty laid back kind of guy. Some things just plain annoy me &#8211; my wife keeps telling me it&#8217;s my &#8216;OCD&#8217;, not that I have OCD, but I am quite anal about how certain things&#8230; <a href="https://blog.flashgen.com/remapping-flash-builder-4-xs-default-workspace-in-os-x/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://blog.flashgen.com/remapping-flash-builder-4-xs-default-workspace-in-os-x/">Remapping Flash Builder 4.x’s Default Workspace in OS X</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>While in general I&#8217;m a pretty laid back kind of guy. Some things just plain annoy me &#8211; my wife keeps telling me it&#8217;s my &#8216;OCD&#8217;, not that I have OCD, but I am quite anal about how certain things should work or be used. So you can imagine how annoying it was for me to have custom Flash Builder workspaces, but not be able to remove the default one it creates in the Documents folder on my Mac, (I don&#8217;t like any applications dumping configuration information in my Documents folder &#8211; it&#8217;s for DOCUMENTS GODDAMMIT :p. Yes Microsoft, I&#8217;m looking at you too.).</p>
<p>So back to the case in point. The reason the default Flash Builder directory can&#8217;t be removed is because Adobe saw fit to put linked configuration settings in this folder that Flash Builder uses; as you can see below.</p>
<p><img decoding="async" src="http://blog.flashgen.com/images/flex/fb46_default_config_files.png" class="floatCenter" /></p>
<p><strong>Easily Provoked</strong><br />
Now if you find it both annoying and a trifle odd, like I did, that this information wasn&#8217;t placed in the Application Support folder, or the Library folder at the very least. And would like to permanently remove them from your Documents folder then read on. Before we continue I just want to point out that this is obviously a solution for OS X, but should work for Windows (if Adobe have done the same thing of creating a default workspace within your user space and added the cascaded configuration to it, although the paths will be different of course :p).</p>
<p><strong>Editing Flash Builder Configurations</strong><br />
The first thing you&#8217;ll need to do is edit the configuration files that Flash Builder loads up each time it is opened. I say configuration files, actually there is only one configuration files but it is duplicated within another folder in the Flash Builder application directory &#8211; hence editing 2 files.
</p>
<p><img decoding="async" src="http://blog.flashgen.com/images/flex/fb46_config_file_locations.png" class="floatRight" />You&#8217;ll find these inside the Flash Builder application folder (Applications/Adobe Flash Builder 4.6/). The files you&#8217;ll need to alter are marked in the image to the right.</p>
<p>Before we start hacking around in Flash Builder&#8217;s application directory you need to do some house keeping. The first thing to do is <strong>MAKE A COPY OF BOTH CONFIG.INI FILES ON YOUR DESKTOP</strong>. I know, a bit over aggressive, but if you muck the next steps up you&#8217;ll end up with a broken copy of Flash Builder &#8211; You have been warned!</p>
<p>Secondly, you&#8217;ll need to create a new directory within your home directory that&#8217;ll contain the configuration information that is currently in the <span style="font-family: 'Courier New';  font-size: 14px;">~/Documents/Adobe Flash Builder 4.6/</span> directory, in a folder called <span style="font-family: 'Courier New';  font-size: 14px;">cascaded</span>. As an example I have a directory called Development in the root of my home directory and within there I have various sub-folders for Resources, Repos, Workspaces etc. So I have placed my cascaded folder a sub-folder in there. You don&#8217;t have to copy me, but put it somewhere meaningful :)</p>
<p>Final point, make sure you create the folder within your home folder, not in some funky application level or hidden system folder as Flash Builder runs as you and if you need to SUDO, or authenticate to access, or create the folder you&#8217;ve just placed the configuration information in, Flash Builder won&#8217;t run. With all that out of the way, let&#8217;s get updating our Flash Builder configuration.</p>
<p>Select and open one of them (it doesn&#8217;t matter which as they are identical), and follow the steps below:</p>
<ul>
<li>locate the line <span style="font-family: 'Courier New';  font-size: 14px;">osgi.instance.area.default=@user.home/Documents/Adobe Flash Builder 4.6</span></li>
<li>change the path after <span style="font-family: 'Courier New';  font-size: 14px;">@user.home/</span> to point to the directory you created earlier</li>
<li>next locate the line <span style="font-family: 'Courier New';  font-size: 14px;">osgi.configuration.area=@user.home/Documents/Adobe Flash Builder 4.6/cascaded/335153/configuration</span> (I&#8217;m assuming the number 335153 to be machine specific, so if yours is different, use the one present in your config.ini file)</li>
<li>save the file</li>
<li>repeat the exact same steps on the second config.ini file</li>
</ul>
<p>Below is a copy of my config.ini file so you can see where I&#8217;ve made my edits (I&#8217;ve put comments around lines that need changing):</p>
<pre line="1">
#This configuration file was written by: org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser
#Fri Jul 30 17:13:05 PDT 2010
org.eclipse.update.reconcile=false
eclipse.p2.profile=epp.package.java
#### Change This ####
osgi.instance.area.default=@user.home/Development/Resources/Flex/Linkages/FB4.6
#### 			 ####
osgi.framework=file\:plugins/org.eclipse.osgi_3.7.0.v20110613.jar
equinox.use.ds=true
eclipse.buildId=I20100608-0911
osgi.bundles=reference\:file\:org.eclipse.equinox.simpleconfigurator_1.0.200.v20110502-1955.jar@1\:start
org.eclipse.equinox.simpleconfigurator.configUrl=file\:org.eclipse.equinox.simpleconfigurator/bundles.info
eclipse.product=com.adobe.flexbuilder.standalone.producte36
osgi.framework.extensions=
osgi.bundles.defaultStartLevel=4
eclipse.application=com.adobe.flexbuilder.standalone.FlashBuilderApplication
eclipse.p2.data.area=@user.dir/../../../p2/
#### Change This ####
osgi.configuration.area=@user.home/Development/Resources/Flex/Linkages/FB4.6/cascaded/335153/configuration
####			####
osgi.shared.configuration.area=file\:configuration
osgi.configuration.cascaded=true?</pre>
</p>
<p>When you save the files you&#8217;ll more than likely need to authenticate the save &#8211; this is because you&#8217;re editing a file that&#8217;s not owned by you &#8211; it&#8217;s not a problem, just type your password in and click OK to apply the changes. Now that&#8217;s all sorted fire up Flash Builder.</p>
<p><strong>The Acid Test</strong><br />
Now that both config.ini files have been updated you need to move the contents of the Adobe Flash Builder 4.6 folder (i.e the folder called cascaded), to the new directory you added in your config.ini file. If you have projects stored in this folder too, you&#8217;ll need to move them to a new location (this process is out of scope for this article but a quick Google will provide the relevant answer should you need them). Once you have moved all of the content out of the ~/Documents/Adobe Flash Builder 4.6 folder you are safe to delete it.
</p>
<p>Now if you have your Documents directory open when Flash Builder starts up you may notice a strange thing. Flash Builder will more than likely re-create the folder you just deleted. However this time it will be empty.</p>
<blockquote><p>If it recreates the <span style="font-family: 'Courier New';  font-size: 14px;">cascaded</span> folder then you&#8217;ve missed something out when updating the config.ini files, so go back and check them again.</p></blockquote>
<p>There are a couple of reasons why it has recreated that folder again. First up is that you still have it set as your default workspace. If so create a new one, switch to it and restart Flash Builder. The second, more likely reason, is that you still have a reference to it in your Flash Builder preferences. This entry is created the first time Flash Builder runs as it is the default workspace</p>
<p><img decoding="async" src="http://blog.flashgen.com/images/flex/fb46_prefs_workspaces.png" class="floatCenter" /></p>
<p>Delete this entry from Flash Builder Preferences, quit Flash Builder. Delete the directory in your Documents folder again and restart Flash Builder. This time it should behave as expected and no folder will be created.</p>
<p>Perfect, the world is at one again :D</p><p>The post <a href="https://blog.flashgen.com/remapping-flash-builder-4-xs-default-workspace-in-os-x/">Remapping Flash Builder 4.x’s Default Workspace in OS X</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://blog.flashgen.com/remapping-flash-builder-4-xs-default-workspace-in-os-x/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Privacy Policy</title>
		<link>https://blog.flashgen.com/privacy-policy/</link>
					<comments>https://blog.flashgen.com/privacy-policy/#respond</comments>
		
		<dc:creator><![CDATA[Mike Jones]]></dc:creator>
		<pubDate>Fri, 06 Jul 2012 11:59:10 +0000</pubDate>
				<guid isPermaLink="false">http://blog.flashgen.com/?page_id=1251</guid>

					<description><![CDATA[<p>Overview This privacy policy sets out how â€œFlashGen.Comâ€ uses and protects any information that you give â€œFlashGen.Comâ€ when you use this website. â€œFlashGen.Comâ€ is committed to ensuring that your privacy is protected. Should we ask you to provide certain information&#8230; <a href="https://blog.flashgen.com/privacy-policy/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://blog.flashgen.com/privacy-policy/">Privacy Policy</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>Overview</strong><br />
This privacy policy sets out how â€œFlashGen.Comâ€ uses and protects any information that you give â€œFlashGen.Comâ€ when you use this website.</p>
<p>
â€œFlashGen.Comâ€ is committed to ensuring that your privacy is protected. Should we ask you to provide certain information by which you can be identified when using this website, then you can be assured that it will only be used in accordance with this privacy statement.</p>
<p>
â€œFlashGen.Comâ€ may change this policy from time to time by updating this page. You should check this page from time to time to ensure that you are happy with any changes. This policy is effective from 01/01/2012.
</p>
<p><strong>What we collect</strong><br />
We may collect the following information:</p>
<ul>
<li>name</li>
<li>contact information including email address</li>
<li>demographic information such as postcode, preferences and interests</li>
<li>other information relevant to customer surveys and/or offers</li>
</ul>
<p><strong>What we do with the information we gather</strong><br />
We require this information to understand your needs and provide you with a better service, and in particular for the following reasons:</p>
<ul>
<li>Internal record keeping</li>
<li>We may use the information to improve our products and services</li>
<li>We may periodically send promotional emails about new products, special offers or other information which we think you may find interesting using the email address which you have provided</li>
<li>From time to time, we may also use your information to contact you for market research purposes. We may contact you by email, phone, fax or mail. We may use the information to customise the website according to your interests</li>
</ul>
<p><strong>Security</strong><br />
We are committed to ensuring that your information is secure. In order to prevent unauthorised access or disclosure we have put in place suitable physical, electronic and managerial procedures to safeguard and secure the information we collect online.
</p>
<p><strong>How we use cookies</strong><br />
A cookie is a small file which asks permission to be placed on your computerâ€<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />s hard drive. Once you agree, the file is added and the cookie helps analyse web traffic or lets you know when you visit a particular site. Cookies allow web applications to respond to you as an individual. The web application can tailor its operations to your needs, likes and dislikes by gathering and remembering information about your preferences.</p>
<p>
We use traffic log cookies to identify which pages are being used. This helps us analyse data about webpage traffic and improve our website in order to tailor it to customer needs. We only use this information for statistical analysis purposes and then the data is removed from the system.</p>
<p>
Overall, cookies help us provide you with a better website, by enabling us to monitor which pages you find useful and which you do not. A cookie in no way gives us access to your computer or any information about you, other than the data you choose to share with us.</p>
<p>
You can choose to accept or decline cookies. Most web browsers automatically accept cookies, but you can usually modify your browser setting to decline cookies if you prefer. This may prevent you from taking full advantage of the website.
</p>
<p><strong>Links to other websites</strong><br />
Our website may contain links to other websites of interest. However, once you have used these links to leave our site, you should note that we do not have any control over that other website. Therefore, we cannot be responsible for the protection and privacy of any information which you provide whilst visiting such sites and such sites are not governed by this privacy statement. You should exercise caution and look at the privacy statement applicable to the website in question.
</p>
<p><strong>Controlling your personal information</strong><br />
You may choose to restrict the collection or use of your personal information in the following ways:</p>
<ul>
<li>whenever you are asked to fill in a form on the website, look for the box that you can click to indicate that you do not want the information to be used by anybody for direct marketing purposes</li>
<li>if you have previously agreed to us using your personal information for direct marketing purposes, you may change your mind at any time by <a href="http://blog.flashgen.com/contact/">emailing us</a></li>
</ul>
<p>We will not sell, distribute or lease your personal information to third parties unless we have your permission or are required by law to do so.</p>
<p>
If you believe that any information we are holding on you is incorrect or incomplete, <a href="http://blog.flashgen.com/contact/">please email us as soon as possible</a>. We will promptly correct any information found to be incorrect.</p><p>The post <a href="https://blog.flashgen.com/privacy-policy/">Privacy Policy</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://blog.flashgen.com/privacy-policy/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>New year, new beginning</title>
		<link>https://blog.flashgen.com/2012/01/the-road-goes-ever-on/</link>
					<comments>https://blog.flashgen.com/2012/01/the-road-goes-ever-on/#comments</comments>
		
		<dc:creator><![CDATA[Mike Jones]]></dc:creator>
		<pubDate>Tue, 03 Jan 2012 09:15:00 +0000</pubDate>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[consultant]]></category>
		<category><![CDATA[evangelist]]></category>
		<category><![CDATA[job]]></category>
		<category><![CDATA[mike_jones]]></category>
		<guid isPermaLink="false">http://blog.flashgen.com/?p=1236</guid>

					<description><![CDATA[<p>It doesn&#8217;t seem that long ago that I announced that I&#8217;d be joining Adobe as a Platform Evangelist. As a lot of you are probably aware, due to the change in focus at Adobe a measure of restructuring was needed.&#8230; <a href="https://blog.flashgen.com/2012/01/the-road-goes-ever-on/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://blog.flashgen.com/2012/01/the-road-goes-ever-on/">New year, new beginning</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>It doesn&#8217;t seem that long ago that <a href="http://blog.flashgen.com/2010/05/04/im-an-adobe-platform-evangelist/">I announced that I&#8217;d be joining Adobe as a Platform Evangelist</a>. As a lot of you are probably aware, due to the change in focus at Adobe a measure of restructuring was needed. Sadly my role at Adobe was one such casualty of that restructuring.</p>
<p> Even though I knew my role was at risk back in November, yesterday was officially my last day, hence my somewhat delayed announcement. Don&#8217;t get me wrong, I&#8217;m not bitter, I had a great 18 months working and meeting with some truly amazing people and companies. I want to thank everyone I worked with at Adobe for making it a really enjoyable, enlightening and inspiring time &#8211; like Flash, you guys ROCK!</p>
<p>So what next? Well, you&#8217;ll just have to watch this space :)</p><p>The post <a href="https://blog.flashgen.com/2012/01/the-road-goes-ever-on/">New year, new beginning</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://blog.flashgen.com/2012/01/the-road-goes-ever-on/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>Rendering Sprites With Starling</title>
		<link>https://blog.flashgen.com/gaming/starling/rendering-sprites-with-starling/</link>
					<comments>https://blog.flashgen.com/gaming/starling/rendering-sprites-with-starling/#respond</comments>
		
		<dc:creator><![CDATA[Mike Jones]]></dc:creator>
		<pubDate>Wed, 09 Nov 2011 11:17:57 +0000</pubDate>
				<guid isPermaLink="false">http://blog.flashgen.com/?page_id=1190</guid>

					<description><![CDATA[<p>I thought I&#8217;d explain how to get started with Starling and an obvious place to start would be how to animate content using Starling and the GPU (via Stage3D). Fortunately Starling abstracts the necessity for you to interact with Stage3D&#8230; <a href="https://blog.flashgen.com/gaming/starling/rendering-sprites-with-starling/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://blog.flashgen.com/gaming/starling/rendering-sprites-with-starling/">Rendering Sprites With Starling</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>I thought I&#8217;d explain how to get started with Starling and an obvious place to start would be how to animate content using Starling and the GPU (via Stage3D). Fortunately Starling abstracts the necessity for you to interact with Stage3D directly &#8211; it handles that in the background. The other benefit you get using Starling is that it implements an API that you are already familiar with as it closely follows the same API that is used when targeting the traditional Flash Display list. MovieClip, Image, Sprite, Button etc.</p>
<p><strong>Diving In</strong><br />
<br />
So let&#8217;s look at how you start adding, and animating, content with Starling. The first thing you need to do once you&#8217;ve created an ActionScript project with Starling support (if you&#8217;re not sure how to achieve this <a href="http://blog.flashgen.com/gaming/starling/setting-up-starling-in-flash-builder-4-5/">check out this article</a>), is create an instance of the Starling core engine.</p>
<pre lang="actionscript" line="1">
var _st:Starling = new Starling(AnimationExample, stage);
_st.start();
</pre>
<p>As you can see, when creating the main <span style="font-family: 'Courier New';  font-size: 14px;">Starling()</span> instance you need to provide it with two parameters (it does takes additional parameters but we&#8217;ll skip over those for the time being). The first parameter is the root class you want to instantiate when Starling starts up, in this case it is <span style="font-family: 'Courier New';  font-size: 14px;">AnimationExample</span>. The second parameter is the location where you want to attach the root class instance. In this example we&#8217;re just going to target the main <span style="font-family: 'Courier New';  font-size: 14px;">stage</span> instance.</p>
<p/>
<p>With that done all that is left now is to tell Starling to actually run, and you have probably already worked out how that is done. You just call the <span style="font-family: 'Courier New';  font-size: 14px;">start()</span> method on your Starling instance. With those two lines of code in place your main game class is complete (well for this demonstration at least), and it should look similar to this:</p>
<pre lang="actionscript" line="1">
package
{
	import flash.display.Sprite;
	
	import starling.core.Starling;
	import com.flashgen.examples.AnimationExample;

	public class Starling101 extends Sprite
	{
		public function Starling101()
		{
			var _st:Starling = new Starling(AnimationExample, stage);
			_st.start();
		}
	}
}â€¨</pre>
<p><strong>Creating The Main Game Class</strong><br />
<br />
You may have noticed I deftly omitted anything to do with the creation of the main root class, <span style="font-family: 'Courier New';  font-size: 14px;">AnimationExample</span>, that we passed in to the <span style="font-family: 'Courier New';  font-size: 14px;">Starling()</span> constructor. That&#8217;s because I wanted to cover off a particular requirement of Starling. That requirement is that this class must inherit from Starling&#8217;s implementation of the  <span style="font-family: 'Courier New';  font-size: 14px;">DisplayObject</span> class. Now just so you are clear, this isn&#8217;t the Flash <span style="font-family: 'Courier New';  font-size: 14px;">DisplayObject</span>, it&#8217;s the Starling implementation that goes by the same name. The most common implementation is to extend your class from the Starling <span style="font-family: 'Courier New';  font-size: 14px;">Sprite</span> class &#8211; which as you might gather extends the Starling <span style="font-family: 'Courier New';  font-size: 14px;">DisplayObject</span> class. So your base <span style="font-family: 'Courier New';  font-size: 14px;">AnimationExample</span> class would look something like this:
</p>
<pre lang="actionscript" line="1">
package com.flashgen.examples
{
	import starling.display.Sprite;
	
	public class AnimationExample extends Sprite
	{
		public function AnimationExample()
		{
			super();
		}
	}
}â€¨</pre>
<p>
You now need to create a method called <span style="font-family: 'Courier New';  font-size: 14px;">init()</span>. This is where you&#8217;ll be placing the bulk of your code for this example. The reason you&#8217;re not placing it in the actual class constructor is down to the fact that we want to make sure the class has been attached to the stage before anything gets processed. To do this the only thing that needs to be added to the <span style="font-family: 'Courier New';  font-size: 14px;">AnimationExample</span> class constructor is an event listener that waits until the class has been added to the main stage.
</p>
<pre lang="actionscript" line="1">
public function AnimationExample()
{
	super();
			
	addEventListener(Event.ADDED_TO_STAGE, init);
}â€¨</pre>
<p>
One thing to reiterate here is that the event we are listening for isn&#8217;t the <span style="font-family: 'Courier New';  font-size: 14px;">flash.events.Event</span> implementation it is the Starling implementation i.e <span style="font-family: 'Courier New';  font-size: 14px;">starling.events.Event</span>. I know I&#8217;m banging on a bit about using the Starling implementations of certain classes, but if you accidentally use the Flash implementation you will get errors.
</p>
<p><strong>Adding Assets</strong><br />
<br />
Starling differs from Flash in the way you commonly animate content in a couple of ways, but the main one is that it primarily uses texture atlases and sprite sheets* to render, and animate, visual content. </p>
<blockquote><p>
<strong>Texture huh? Sprite what!?</strong><br />
Texture Atlases and Sprite Sheets are fairly similar. Both revolve around a single large image that contains numerous smaller images. However they differ mainly in the scope of the content they contain.
</p>
<p>
A sprite sheet traditionally only contains the graphical information for an individual sprite type &#8211; a soldier, for example &#8211; and includes all of the frames of animation it may need.
</p>
<p>
Texture Atlases on the other hand generally contain all of the graphical information required for an entire game, (or if the game is particularly large for each individual level), including the sprites, static assets etc. They also tend to utilize a text file (normally XML), or &#8220;atlas&#8221;, to indicate where each item is located within this single large image. By using the data in the text file it is easy to extract the items you need; and if done quickly enough you can animate something by swapping the current frame for the next frame in the sequence.
</p>
</blockquote>
<p>I&#8217;ve already created a sprite sheet and the associated XML file using an app called TexturePacker (<a href="http://www.texturepacker.com/" target="_blank">http://www.texturepacker.com/</a>). I&#8217;m not going to go into details on how to use this app in this article &#8211; I&#8217;ll save that for a dedicated post. The main thing to be aware of is how the two parts (the PNG sheet and the XML file) relate to each other. As I mentioned earlier, the XML file contains a reference to each item in the sheet and provides the x, y, width, and height of each sprite as you can see:
</p>
<pre lang="xml" line="1">
<TextureAtlas imagePath="Bilbo-walk.png">
    <SubTexture name="Bilbo0001" x="0" y="0" width="215" height="208" frameX="-33" frameY="0" frameWidth="295" frameHeight="212"/>
    <SubTexture name="Bilbo0002" x="215" y="0" width="215" height="208" frameX="-33" frameY="0" frameWidth="295" frameHeight="212"/>
    <SubTexture name="Bilbo0003" x="430" y="0" width="215" height="202" frameX="-33" frameY="-5" frameWidth="295" frameHeight="212"/>
    <!-- Additional entries removed for brevity -->
</TextureAtlas>â€¨</pre>
<p>However, before we get ahead of ourselves let&#8217;s look at how you actually reference both of these files in your game. The first thing you need to do is embed both of these files using [Embed] metadata. One thing to make sure you don&#8217;t forget is to set the correct mime type for the XML file (<span style="font-family: 'Courier New';  font-size: 14px;">mimeType=&#8221;application/octet-stream&#8221;</span>). If you forget to include this in your XML file embedding code you&#8217;ll get an error and it won&#8217;t compile. You don&#8217;t need to set the mime type for the PNG sprite sheet though. You code will now look similar to this (obviously the path to your assets may be different)</p>
<pre lang="actionscript" line="1">
public class AnimationExample extends Sprite
{
	[Embed(source="assets/spritesheets/Bilbo-walk.xml", mimeType="application/octet-stream")]
	private var AnimData:Class;

	[Embed(source="assets/spritesheets/Bilbo-walk.png")]
	private var AnimTexture:Class;
		
	public function AnimationExample()
	{
		super();
			
		addEventListener(Event.ADDED_TO_STAGE, init);
	}
	
	protected function init(e:Event):void
	{

	}		
}â€¨</pre>
<p>
Once you&#8217;ve embedded your sprite assets you need to actually create a reference to them. To do this you need to create an instance of both of these within the <span style="font-family: 'Courier New';  font-size: 14px;">init()</span> method. To work with the sprite sheet you need to create an instance of the Starling <span style="font-family: 'Courier New';  font-size: 14px;">Texture()</span> class and pass the data from the sprite sheet to this variable:
</p>
<pre lang="actionscript" line="1">
protected function init(e:Event):void
{
	var _t:Texture = Texture.fromBitmap(new AnimTexture());
}â€¨</pre>
<p>Notice that you use the static method <span style="font-family: 'Courier New';  font-size: 14px;">Texture.fromBitmap()</span> to grab the PNG file instance and assign it. The Starling Texture() class has other &#8220;from&#8230;&#8221; methods, which we&#8217;ll be exploring in later articles. Creating an instance of the XML file is pretty simple, you just need to make sure you cast the instance of the XML file as <span style="font-family: 'Courier New';  font-size: 14px;">XML()</span> &#8211; this is because we&#8217;re using the generic <span style="font-family: 'Courier New';  font-size: 14px;">Class()</span> class as the data type for both embedded files and to make sure the XML file is assigned correctly you need to cast it.</p>
<pre lang="actionscript" line="1">
protected function init(e:Event):void
{
	var _t:Texture = Texture.fromBitmap(new AnimTexture());
	var _d:XML = XML(new AnimData());

}â€¨</pre>
<p>Now that you have both of these variables you need to combine both parts to create something that Starling can work with behind the scenes. To do this you need to create an instance of the Starling <span style="font-family: 'Courier New';  font-size: 14px;">TextureAtlas()</span> class. This creates the relationship between both the sprite sheet and the XML data file that contains the positions of each sprite in that sheet.</p>
<pre lang="actionscript" line="1">
protected function init(e:Event):void
{
	var _t:Texture = Texture.fromBitmap(new AnimTexture());
	var _d:XML = XML(new AnimData());
			
	var _ta:TextureAtlas = new TextureAtlas(_t, _d);
}â€¨</pre>
<p><strong>Making It Move</strong><br />
<br />
So far we&#8217;ve just been looking at how to set up Starling ready to render content for us. Let&#8217;s now look at how you actually get it to render to the screen, so you can actually see your sprites. As I have mentioned throughout this article, Starling has implementations of common Flash API classes and one of those is the <span style="font-family: 'Courier New';  font-size: 14px;">MovieClip()</span> class. However, its set up and usage is slightly different (as you would probably expect), compared to the Flash equivalent. When creating an instance of the Starling <span style="font-family: 'Courier New';  font-size: 14px;">MovieClip()</span> class.
</p>
<pre lang="actionscript" line="1">
protected function init(e:Event):void
{
	var _t:Texture = Texture.fromBitmap(new AnimTexture());
	var _d:XML = XML(new AnimData());
			
	var _ta:TextureAtlas = new TextureAtlas(_t, _d);
			
	var _mc:MovieClip = new MovieClip(_ta.getTextures("Bilbo"), 30);
}â€¨</pre>
<p>Notice that you use your <span style="font-family: 'Courier New';  font-size: 14px;">TextureAtlas()</span> instance and call the <span style="font-family: 'Courier New';  font-size: 14px;">getTextures()</span> method to retrieve the sprites you want to associate with your <span style="font-family: 'Courier New';  font-size: 14px;">MovieClip()</span> instance. You can see that the getTextures() method takes a string that relates to the prefix used in the XML files name attribute:
</p>
<pre lang="xml" line="1">
<SubTexture name="Bilbo0001" x="0" y="0" width="215" height="208" frameX="-33" frameY="0" frameWidth="295" frameHeight="212"/>â€¨</pre>
<p>
This provides a mechanism to access elements contained within a single PNG and may relate to different parts of the games visuals. There is a second, optional, parameter you can provide on instantiation, which is the frame rate you wish the <span style="font-family: 'Courier New';  font-size: 14px;">MovieClip()</span> to render at. In this example, it is set to 30fps and this can be different to the main game frame rate. All you need to do now is add the <span style="font-family: 'Courier New';  font-size: 14px;">MovieClip()</span> instance to the Starling display list as the completed code shows, and test it out.
</p>
<pre lang="actionscript" line="1">
protected function init(e:Event):void
{
	var _t:Texture = Texture.fromBitmap(new AnimTexture());
	var _d:XML = XML(new AnimData());
			
	var _ta:TextureAtlas = new TextureAtlas(_t, _d);
			
	var _mc:MovieClip = new MovieClip(_ta.getTextures("Bilbo"), 30);
			
	addChild(_mc);
}â€¨</pre>
<p><strong>Hmm, Is This Broken?</strong><br />
Now if you tested this and Bilbo appeared on screen but wasn&#8217;t moving and you&#8217;re not sure why&#8211;don&#8217;t panic. You haven&#8217;t missed anything out &#8211; it is working as expected. You see, while the <span style="font-family: 'Courier New';  font-size: 14px;">MovieClip()</span> instance may have everything it needs to animate you need to use a different mechanism to update the frame it uses on each render cycle. To do this you need to use a <span style="font-family: 'Courier New';  font-size: 14px;">Juggler</span>. A juggler (as the name implies) juggles the frames of animation updating it each cycle. Don&#8217;t worry if this sounds a bit strange as it will become second nature once you&#8217;ve implemented it a few times.</p>
<p>
The easiest way to implement a Juggler is to use the one that is part of the main <span style="font-family: 'Courier New';  font-size: 14px;">Starling()</span> instance. To access this, you just need reference the <span style="font-family: 'Courier New';  font-size: 14px;">Starling()</span> instance and add your <span style="font-family: 'Courier New';  font-size: 14px;">MovieClip()</span> instance to the <span style="font-family: 'Courier New';  font-size: 14px;">Juggler</span> associated with it.
</p>
<pre lang="actionscript" line="1">
protected function init(e:Event):void
{
	var _t:Texture = Texture.fromBitmap(new AnimTexture());
	var _d:XML = XML(new AnimData());
			
	var _ta:TextureAtlas = new TextureAtlas(_t, _d);
			
	var _mc:MovieClip = new MovieClip(_ta.getTextures("Bilbo"), 30);
			
	addChild(_mc);

	Starling.juggler.add(_mc);
}â€¨</pre>
<p>
Now if you save the file and test it Bilbo will animate as you would expect.
</p>
<p><strong>Summary</strong><br />
<br />
In this article you&#8217;ve seen how you can start using the Starling framework and how it differs (if only slightly) from animating content using the Flash API. You also saw how Starling works with sprites and textures and the common implementation workflow when working with these asset types.
</p>
<p><strong>Related Files</strong><br />
<a href="http://com.flashgen.examples/files/gaming/STR001-AnimatingSprites.zip" class="broken_link">STR001-AnimatingSprites.zip</a></p><p>The post <a href="https://blog.flashgen.com/gaming/starling/rendering-sprites-with-starling/">Rendering Sprites With Starling</a> first appeared on <a href="https://blog.flashgen.com">That Mike Jones</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://blog.flashgen.com/gaming/starling/rendering-sprites-with-starling/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>