Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Archived:Using Bing translator API in Flash Lite

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived. Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.

Article Metadata
Code ExampleArticle
Created: manikantan (23 Dec 2009)
Last edited: hamishwillee (14 May 2013)



This article describes the usage of Bing Translation API in your Flash Lite client. This application can translate in various international languages, using the Bing translation engine (version 2.2) provided by Microsoft. Bing Translator (previously Live Search Translator and Windows Live Translator) is a service provided by Microsoft as part of its Bing services which allow users to translate texts or entire web pages into different languages.

Tip.pngTip: The author recommends reading google translator API article before this article. Both articles share common characteristics, UI design.


Here are the keys steps -

1. Request a Bing API Key from Bing site. Like any other API key, it is used to track the request made for a service or in simple terms, it is an identifier of the requesting party to Microsoft.

2. Understand the various types of communication methods available, for communicating with the server. This can be found at the site They are of three major types - JSON, XML, SOAP.

3. Process the result obtained.

Making the Request

I have already discussed how a JSON based client has to be implemented in Flash Lite in google translator api article. SOAP type of web-services 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.

Result Processing

In addition after some testing I found that some further processing of text was needed after unescape(). Quotation marks, apostraphe characters has 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.



Note.pngNote: 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 screen-shots shown are taken from Adobe device central CS3 on a Nokia 5800. The client is built for touch devices. This article is a sequel to the Google Translation API article and certain steps like creating an language -lookup table, escape() and unescape() of the strings are common to both cases and are not discussed in this article.


The associated FLA is attached in this file. Media:Bing


--manikantan 19:49, 23 December 2009 (UTC)

This page was last modified on 14 May 2013, at 06:15.
32 page views in the last 30 days.