hide side navigation
    5 most recent
    Web Services
  Flash Spell Checker  Company information and news  LinkToMe  Flash Google MX  Flash Currency Conversion  Language Translation  Flash Server Inspector  Stock Quotes in Flash  Flash 2D and 3D charts
    Library's
    Component's
    Applications
    Articles
A must have for any Flash based Text editor. Use this simple service example to add spell checking to any flash movie. This service use's the Google spell checking web service.


The following assumes that you have Flash Remoting up and running, either AMFPHP or other.

If your using AMFPHP and have not installed nusoap yet, you may want to read over - Consuming Web Services with Flash and AMFPHP. In short download the latest version of nusoap and place this in a folder called 'lib' inside the flashservices directory (flashservices/lib). And that's it! Your now ready to consume webservices in flash.

AMFPHP in combination with Nusoap was used in this example, but the same actionscript code and services should work with any remoting software package (coldfusion, .net, etc).

The above example use's the following web service:
The actual code is included in the download, however the most important part of the code is posted below. The following should be enough to get you started. The NetConnection debugger will make everything really easy, so make sure you've downloaded the macromedia remoting components.

Flash Spell Check Web Service

#include "NetServices.as"
#include "NetDebug.as"

// create result handler for results and error messages.
serviceResult = new Object();
serviceResult.onResult = function(result){
    
output_txt.text result;
}
serviceResult.onStatus = function(status){
    
output_txt.text status.description;  // onStatus handles returned errors
}

// sets up the gateway connection.
var serverConn     NetServices.createGatewayConnection("<PathOnServerToYourGateway>");

// sets up the service.
var service serverConn.getService("http://api.google.com/GoogleSearch.wsdl"serviceResult);


// sets the onPress event handler for the submit button, which calls the doSpellingSuggestion method.
submit_btn.onPress = function() {
    
    
output_txt.text "checking spelling, please hold";
    
    
// Set the params and call the service
    // You will need to obtain a key from www.google.com/apis/ to use this service
    // google will allow you to use it 1000 times per day with this key.
    
params = { 
        
key:"<YourGoogleKeyGoesHere>"
        
phrase:input_txt.text 
    
}
    
    if (
input_txt.text != "") {
        
        
// calls the method.
        
service.doSpellingSuggestion(params);
        
    } else {
        
output_txt.text "Please enter a word or phrase to spell check.";    
    }
}

And that's it. Hopefully enough to play around with.

 Download the Source Files
- be sure to check the message board for help/support.