Bing translator in Flash Lite

by Manikantan

Its been quite a long time I put my hands on any Flash Lite coding. I now present to you Bing Translation engine’s Flash Lite client. This application can translate between international languages using the Bing translation engine (version 2.2) provided by Microsoft.

Here are the keys steps –

  • 1. Request a Bing API Key from Bing site. As any API key it is used to track the request for service or in simple terms, it is an identifier of the requesting party to Microsoft.
  • 2. Understand the various types of communication method available to communicate with the server.

This can be found at the site

They are of three major types –




  • 3. Process the result obtained.

I have already discussed how a JSON based client has to be implemented in Flash Lite in my google translator article. SOAP type of webservices are simple to implement with the webserviceconnector component.

In this article, we focus on how XML implementation is done. Before beginning to code the XML usage of the API, we need to understand the request is made as a query and the return is of XML type.

In order to request for data in the XML mode, you can use the loadvars() function in Flash


Here, toTranslate is the sentence to be translated ( after escape() ), src_lang and dest_lang are source and target languages respectively.

In addition after some testing I found that some further processing of text was needed after unescape(). Quotation marks, apostraphe characters had some trouble in getting rendered. Hence I had to handle it myself as follows.

function process(ip:String):String {
while (ip.indexOf("'") != -1) {
var arr:Array = ip.split("'");
ip = arr.join("'");
while (ip.indexOf(""") != -1) {
var arr:Array = ip.split(""");
ip = arr.join("\"");
return ip;

In order to handle the receipt of data, you will need to write a onData function that processes the incoming XML data structure. Parsing an XML tree is again quite simple and to conclude creating a translation engine client is quite simple in Flash Lite.

bing screenshot
Note: There is a need for specific fonts on the device for certain fonts to be rendered. For example for text in Chinese, Chinese font has to be supported on the target device. The screenshots shown are taken from Adobe Device Central CS3 on a Nokia 5800. The client is built for touch devices.

You can read more on the Forum Nokia Wiki page

Related posts:

  1. Connecting to Pandorabots from Flash Lite Yesterday, I authored an article at Forum Nokia, as to...
  2. Combining Python with Flash Lite and Symbian C++ This month series of papers were released by the Symbian...
  3. Getting Started with Flash Lite 1.1 Game Development I found this wonderful tutorial on how to get started...
  4. Creating a customized Ticker Component in Flash Lite The Ticker is essentially a scrolling text that can be...
  5. Packaging Flash content for million hansets I have been planning to write on this article for...

Related posts brought to you by Yet Another Related Posts Plugin.