07.08AS3 - Yahoo Spelling Suggestions
Hi Everyone,
this is a quick post on getting spelling suggestions from Yahoo. I created a tiny client, (Singleton). It dispatches 2 events:
- YahooClientEvent.SPELLING_SUGGESTION_READY -- when the suggestion is ready
- YahooClientEvent.SPELLING_SUGGESTION_FAILED -- when the request failed
Sample usage:
Actionscript:
-
package com.yahoo.tests
-
{
-
import com.yahoo.YahooClient;
-
import com.yahoo.YahooClientEvent;
-
import flash.display.MovieClip;
-
-
public class YahooClientTest extends MovieClip
-
{
-
protected var _ws:YahooClient;
-
-
public function YahooClientTest()
-
{
-
_ws = YahooClient.getInstance();
-
_ws.addEventListener(YahooClientEvent.SPELLING_SUGGESTION_READY, doSpellingReady);
-
_ws.addEventListener(YahooClientEvent.SPELLING_SUGGESTION_FAILED, doSpellingFailed);
-
_ws.suggestSpelling("alkalyne tryo");
-
}
-
-
protected function doSpellingReady(evt:YahooClientEvent):void
-
{
-
trace("spelling suggestion:" + evt.suggestion);
-
}
-
-
protected function doSpellingFailed(evt:YahooClientEvent):void
-
{
-
trace("spelling suggestion failed");
-
}
-
}
-
}
The source is here. You will need to put your YahooAppId in the com.yahoo.YahooClient.as file. Right now it uses "YahooDemo".
Cheers!

[...] night I wrote a quick AIR application that uses a Singleton written by Martin Legris. Basically you type in a word and if the spelling is incorrect, it will [...]
September 11th, 2008 at 5:08 pm