I know that Adobe probably plans to "eliminate" another useful piece of software but I figured I'd try and find some answers anyhow. So I've updated to the latest and greatest
4.6 but I can't for the life of me get Squiggly to work with the latest Spark components (TextInput or TextArea).
Here is my small application:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955"
minHeight="600">
<fx:Script>
<![CDATA[
import com.adobe.linguistics.spelling.SpellUI;
import com.adobe.linguistics.spelling.SpellUIForTLF;
import mx.core.UIComponent;
import mx.events.FlexEvent;
protected function input_creationCompleteHandler(event:FlexEvent):void {
SpellUI.enableSpelling(input, "en_US");
SpellUI.enableSpelling(input2, "en_US");
SpellUI.enableSpelling(input3, "en_US");
SpellUI.enableSpelling(input4, "en_US");
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:layout>
<s:VerticalLayout verticalAlign="middle"
horizontalAlign="center"/>
</s:layout>
<s:TextInput id="input"
creationComplete="input_creationCompleteHandler(event)"/>
<s:TextArea id="input2"/>
<s:RichText id="input3"
text="tst"/>
<mx:TextInput id="input4"/>
</s:Application>
As you can see the only one that works is the mx:TextInput component. Am I doing something wrong here or does squiggly not work with 4.6 spark components?
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"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import com.adobe.linguistics.spelling.SpellUI;
import com.adobe.linguistics.spelling.SpellUIForTLF;
import mx.events.FlexEvent;
protected function button1_clickHandler(event:MouseEvent):void
{
SpellUIForTLF.enableSpelling(textArea.textFlow, "en_US");
}
]]>
</fx:Script>
<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)" />
<s:layout>
<s:VerticalLayout />
</s:layout>
</s:Group>
</s:Application>
I'm trying to use Squiggly 0.6 with Flex SDK 4.6 Spark TextArea, exactly like Michal's example:
SpellUIForTLF.enableSpelling(textArea.textFlow, "en_US");
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):
North America
Europe, Middle East and Africa
Asia Pacific