Flex Webservices XML and Array Conversion

I'm currently working on a project involving simple webservices, the webservices return plain XML rather than using SOAP. Personally I prefer SOAP as you get a well defined interface but on this project it was felt that plain XML was less verbose, more efficient and easy to code server side.

Anyway one of the issues with returning XML via HTTPService calls is that when flex converts the XML to objects it treats it as array if there's more than one item of the same name but as a single item (ie not an array) if there's only one item of the same name.

This causes databinding to datagrids or lists to fail.

So how do you get around this issue?


ColdFusion Internationalisation

Using ColdFusion it's fairly straight forward to make web pages appear in more than one language.

First off you need to detect what language you want the page to be in, next you load the strings you want to display from a resource file and lastly display the page in the required language.


Flash Internationalization and Flash Fonts (part1)

Lets see how we can use the code in my previous article on internationalization and apply it to a flash fla.

Here's a flash file we want to convert: static fla(28K), static swf(12K), currently all of the text inside the fla is static text.

First we need to create some xml files containing the content in the languages we want English and French and Japanese.


Flash Internationalization

Flash has good support for internationalization but it does have a few restrictions such as you need to recompile your fla if you add a new language.

I've come up with a fairly simple way to load languages from XML files and to support the following:

  • Language defaults to the users language
  • Language can be set via a URL parameter
  • New languages can be added after the swf is deployed