Alternative Implementation of Grant Skinner’s Spelling Plus library (SPL)
-
December 16th, 2009
by Bryan Elkins
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
Tags: ActionScript 3, AS3, checker, flex, Grant Skinner, gskinner.com, spell checking, spelling, Spelling Plus Library, SPL
« This ‘Aint No Heavy Metal 360 Flex »
This entry was posted on Wednesday, December 16th, 2009 at 11:15 am and is filed under development, flash, flex. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.