For Spark components you need to use SpellUIForTLF class. With this class spellcheck works fine, unfortunately TextContainerManager:getContentBounds throws the null pointer exception and I don't know why this happens.
Here is the app code:
<?xml version="1.0" encoding="utf-8"?>
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
protected function button1_clickHandler(event:MouseEvent):void
<s:Group width="100%" height="100%">
<s:TextArea id="textArea" width="200" height="200" fontSize="30" text="Spell cheecking in TextArea" />
<s:Button click="button1_clickHandler(event)" />
I'm trying to use Squiggly 0.6 with Flex SDK 4.6 Spark TextArea, exactly like Michal's example:
I am getting the null pointer exception from TextContainerManager:getContentBounds as described above.
Does anybody know if there is a fix or workaround for this problem?
The trick seems to be to make sure you use the correct Squiggly SWC file.
The release notes for 0.5 and 0.6 (http://labs.adobe.com/technologies/squiggly/releasenotes.html#new) show that Squiggly added support for the Spark components TextInput, TextArea, and RichEditableText (0.6).
What wasn't obvious to me was that support for these components is in the libs/AdobeSpellingUIEx.swc file (rather than libs/AdobeSpellingUI.swc), which seems to provide an alternative/extended version of SpellUI.enableSpelling(...).
The trick was to remove the libs/AdobeSpellingUI.swc file, which ensures that the correct version of SpellUI.enableSpelling(...) is used. I stumbled on this in abother post: http://forums.adobe.com/thread/870995
The example from intelligent is exactly correct, except that the screen shot of the libs folder shows that the AdobeSpellingUI.swc file has not been removed. If this file is removed, the example should work as desired, with Spell Checking on both Spark and MX components.
To summarise, to support Spark components (as well as MX components):
- Use SpellUI.enableSpelling(...) as documented, not SpellUIForTLF.enableSpelling(...).
- Make sure you are using libs/AdobeSpellingUIEx.swc (by removing libs/AdobeSpellingUI.swc).