Skip navigation

Tag Archives: ajax

Squiggly is Adobe’s Spell Checking software for Flex and Flash applications, and it just so happens that you can use the spell check engine in AJAX Adobe AIR applications. That is if anyone out there except for me is using AJAX to make AIR Applications. Sometimes I wonder, you know.

Anyway, you obviously can’t use the Flex UI controls in your HTML and JavaScript AJAX applications, but you can use the spell check engine.

These are the general set up steps:

  1. Download the Squiggly package.
  2. Rename the SpellCheckEngine.swc to use the .zip extension and unzip it.
  3. Recover the library.swf from the package and put it in your application (maybe rename it too).
  4. Add a script tag for the library.swf resource obtained from the SpellCheckEngine as outlined in these instructions.
  5. From the Squiggly packaged find the ‘usa.zwl’ dictionary file in the Dictionary directory and place that in your application source code.

Now you should be able to use the library:

        var sp = new window.runtime.com.adobe.linguistics.spelling.SpellChecker( );
        var dict = new window.runtime.com.adobe.linguistics.spelling.SpellingDictionary( );
        var myUrl = new air.URLRequest( 'usa.zwl' );
        // the constant is air.Event.COMPLETE if you have AIRAliases.js included
        dict.addEventListener(runtime.flash.events.Event.COMPLETE, function( event ) {
          var addSuccessful = sp.addDictionary( dict );
          // log this return value to test it
          console.log("Added dict: " + addSuccessful);
          console.log("isLoaded on complete" + dict.loaded);

          console.log(  sp.checkWord( "test" ) ); //Prints  'true'
          console.log(  sp.checkWord( "testzd" ) ); //Prints 'false'
        });

        dict.load( myUrl );
        sp.addDictionary( dict );

Check out the example code included in the Squiggly package for how to get suggestions. If you want a nice UI for rich text editing think about using a div with contentEditable set to true.

Thanks goes to the Adobe Forum for Squiggly for being so responsive and helpful. If you have any questions that’s the place to go, although not many people are using it with JavaScript.