Copy link to clipboard
Copied
Hi,
I am new to this. I have downloaded the Squiggly package from adobe labs. But i am not sure how to implement it.
Kindly guide me to achieve.
to override the default right-click behaviour with your spell suggestions you have to publish to at least Flash 11 (or higher, google it).
then write a function
stage.addEventListener(MouseEvent.RIGHT_CLICK, showSpellingAlternatives);
and show the list you get from Squiggly.
Copy link to clipboard
Copied
Have you considered migrating your project to as3, like discussed in this thread?
1.Copy the downloaded AdobeSpellingEngine.swc in your libs folder
2.Download the ASdocs and extract them
3.Look for the SpellChecker class, it contains an example for Flex that you should have no problem adapting to FlashPro
Copy link to clipboard
Copied
already i started to migrate teh project to as3
Copy link to clipboard
Copied
Wise decision 😉
Copy link to clipboard
Copied
Hi,
I have used the example code to check. I have a text area in my stage with instance name inp_txt. when i compile i am getting this error. Could you please help me out.
Scene 1, Layer 'Layer 1', Frame 1, Line 2 | 1172: Definition mx.controls.textClasses:TextRange could not be found. |
This is my code :
import com.adobe.linguistics.spelling.*;
import mx.controls.textClasses.TextRange;
var _newdict:HunspellDictionary = new HunspellDictionary();
var sp:SpellChecker;
function init():void
{
_newdict.addEventListener(Event.COMPLETE, handleLoadComplete);
_newdict.load("dictionaries/en_US/en_US.aff", "dictionaries/en_US/en_US.dic");
}
function handleLoadComplete(evt:Event):void
{
sp = new SpellChecker(_newdict);
}
function checkText():void
{
var wordPattern:RegExp = /\b\w+\b/;// match next word...
var inputValue:String = inp_txt.text;
var offset:int, curPos:int;
for ( ; ; ) {
var res:Array = inputValue.match(wordPattern);// lookup word by word....
if ( res == null )
{
break;
}
if (! sp.checkWord(res[0]))
{
offset = inp_txt.text.length - inputValue.length;
curPos = inputValue.indexOf(res[0]);
var currentRange:TextRange = new TextRange(inp_txt,false,offset + curPos,offset + curPos + res[0].length);// mark mispelled word.
currentRange.color = "red";
}
inputValue = inputValue.substr(inputValue.indexOf(res[0]) + res[0].length);
}
}
inp_txt.addEventListener(KeyboardEvent.KEY_UP,handler);
function handler(event:KeyboardEvent)
{
// if the key is ENTER
if (event.charCode == 32)
{
// your code here
checkText();
}
}
init();
Copy link to clipboard
Copied
TextRange is a Flex only class.
from the ASDOCs:
The TextRange class provides properties that select and format a range of text in the Label, Text, TextArea, TextEditor, and RichTextEditor controls.
you should be able to emulate its functionality with the setSelection function
Copy link to clipboard
Copied
I am getting the selection for the wrong word. But i am not getting any suggesting for spell error.. kindly advise me how to achieve this.
http://labs.adobe.com/technologies/squiggly/demo/
this is my exact request..
Copy link to clipboard
Copied
to override the default right-click behaviour with your spell suggestions you have to publish to at least Flash 11 (or higher, google it).
then write a function
stage.addEventListener(MouseEvent.RIGHT_CLICK, showSpellingAlternatives);
and show the list you get from Squiggly.
Copy link to clipboard
Copied
Thanks for your extrodinary support
Find more inspiration, events, and resources on the new Adobe Community
Explore Now