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 in Flash projects, when using a Bitmap with loaded content is that Flash will revert a Bitmap’s smoothing parameter to false when you replace its bitmapData. That is, when the data loads into the Bitmap, anti-aliasing will get turned off. This is 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 much better to code defensively for it.
This little SmoothBitmap class is for just such an occasion. Instantiate it like a regular Bitmap and, no matter what another developer does with it, smooth, anti aliased pixels when scaling/rotating will be ensured. Enjoy 🙂
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. Continue reading Loan Shark – fast object pooling utility