Remember kids: You don’t have to please ALL your customers, just the ones you want to keep.
The first Law: conservation of users
Users are not created or destroyed, only converted to or from using a competitor’s product. Continue reading O’Donnell’s 3 Laws of User Dynamics
Improving the usability of an interface, by making it do more or less what the user actually expects of it, is a pretty good route to an overall sound user experience. Yet, there’s one key mistake almost every interface I’ve looked at makes in this regard – what I call the Spurious Stimulus Response. That is… Continue reading Wait for it…
I just tried packaging a game, written in AS3, for my iPad, PlayBook and BlackBerry 10 Dev Alpha device – works pretty well!
Worm Stomper game running on iPad, PlayBook and BlackBerry 10 from Liam O’Donnell on Vimeo.
Unlike the iPad, the BlackBerry PlayBook has rather poor international keyboard support, with no method for entering chinese characters. I like the way iOS achieves this, so went about building my own version in ActionScript. Continue reading Chinese Handwriting Recognition App
A common oversight when using Bitmaps with loaded content is that Flash will revert a Bitmap’s smoothing parameter to false when you replace its bitmapData. It’s simple enough to fix, but since you may not know if someone is going to replace the bitmapData of a Bitmap you have created – then it’s often better to code defensively around it.
This little SmoothBitmap class is for just such an occassion. Instantiate it like a regular Bitmap and, no matter what another developer does with it, smooth pixels when scaling/rotating will be ensured.
It gets scary out there sometimes. During my freelance career I’ve worked at a lot of different companies and have seen such coding horrors as you cannot imagine. So I thought I’d start immortalising some of them – so that we can all learn better coding practices, by looking at the bad.
Starter for 10 – What’s wrong with this picture?
public function doSomething(stuff:String):void
var newPixels:BitmapData = new BitmapData(someUint, someUint, true, 0);
someBitmap.bitmapData = newPixels;
Did you spot the fubar? It’s not an obvious one. Continue reading CODING WRONGS – Where do I start with the bad?
I was recently creating an API that required extending TextField and happened across the getRawText() method. I assumed this returned the text from the field without formatting or something – so I looked up the AS3 docs for flash.text.TextField.
Nothing there – gee thanks Adobe. A quick search turned up this which, it turns out, isn’t quite accurate.
So, with a tad of testing, it appears that getRawText() returns the text, stripped of any HTML tags (if you had set htmlText). I now wonder if this is faster than using a RegEx to strip the tags and why Adobe didn’t document it?
A couple of years ago, I created an object pooling utility for a games project I was building in AS3. Since then, I’ve used it quite a few times, in order to speed up apps and improve resource management, easing the load on the garbage collector by reusing objects instead of recreating them.
While object pooling isn’t a magic bullet to speed up every use case, it works especially well on things that are heavy to continually construct and destroy. A good example is my History of the World project, which uses an object pool for item renderers, instead of creating and destroying them as you navigate around – press ALT+CTRL to bring up the resource debugger, which shows a little information on its usage.
I recently updated the utility, improving its performance, adding features and putting loads of unit tests around it. It’s now hosted it over at GitHub. Using it is a simple as:
var pool:LoanShark = new LoanShark(SomeClass);
var someInstance:SomeClass = pool.borrowObject();
// Instead of nullifying an object, check it back into the pool