Alternative Implementation of Grant Skinner’s Spelling Plus library (SPL)

-

Wednesday, December 16th, 2009

Rain recently purchased a multi-seat site license for a great tool that is certain to save a lot of time and headache: Grant Skinner’s Spelling Plus Library (SPL – info here). This post describes some aspects of the implementation.  You can view the source here.

THE WRAPPER CLASS

The quick start documentation lists three .mxml tags to test functionality from within the application’s main .mxml file. That quickly showed us that the SPL library worked well with standard Flex components. However, due to the large scale of our application, we wanted to make sure that the functionality was available from more than just within the main .mxml file. The target property for the SpellingHighlighter.as class is bindable on the tag. So one option would be to make that property universally accessible. However, since we needed some specific behavior modification in our implementation, a wrapper class (SpellChecker.as in the .zip file below) seemed like the best option.

COMPATIBILITY WITH OUR CUSTOM TEXT FIELDS

Many of our text components are instances of Flash’s TextField class deep within custom containers rather than standard Flex text components. SPL, however, only checks the first generation of children within a container to find a TextField. The getBiggestTextField() method in the included code digs recursively to find all available TextFields within the referenced container, grabbing the biggest one for checking.

All the rest of what the class does is contained within the inline documentation. For the robustness, ease of implementation, and extensibility of gskinner.com’s Spelling Plus Library, I’d recommend it to anyone.  The only real issue right now is that it doesn’t work with Flash’s new text layout framework; I contacted them about it and they told me that that would soon be remedied.

Here’s the link:

http://blog.mediarain.com/wp-content/uploads/2009/12/splExample.pdf

This ‘Aint No Heavy Metal

-

Tuesday, December 15th, 2009

Those who’ve worked closely with Rain knows we’ve been a fan of using frameworks to bootstrap our development process. They have oodles of advantages over the re-invent-the-wheel approach, and our involvement with the PHP framework world has been intimate. I currently lead the documentation efforts for one of the most popular PHP frameworks available, CakePHP.

I’m also a founding member of the team for a new project called Lithium (aka Li3). The project is based on some experimental code in the CakePHP sandbox. Anyone familiar with CakePHP should feel at home in Lithium&emdash;the framework was based on CakePHP concepts and conventions, and many of the same developers who brought you CakePHP are now actively working on Li3.

I’d like to invite you to dive it and check things out by walking along with me through this quick tutorial, which covers the creation of a über-simple blogging application. After having walked through it, you should have a good idea of how Li3 is shaping up, and how to create your own simple applications with it. (more…)

Showing Progress for Multiple Loaders

-

Wednesday, December 9th, 2009

A common thing to do in most any rich application is to show progress while loading remote assets. In ActionScript, the bytesLoaded and bytesTotal properties of classes such as LoaderInfo and URLLoader provide the needed information to show a fancy percentage-based progress indicator. The bytesLoaded property is updated as more and more of the asset is loaded in. Divide that by the bytesTotal and you have the percentage loaded.

Easy enough. How about multiple loaders? Lets say you have a group of 10 images and you’d like to show progress for all the images collectively. Because you have 10 different images you also have 10 different URLLoader instances (or Loader instances, whatever suits your fancy)–one for each image. Math would say that you divide the sum of bytesLoaded by the sum of bytesTotal and that gives you the percentage complete. Two issues arise: (more…)