I have really been exposed a lot where I am working at right now to making Flash content truely global. At my other job, the globalization of Flash content was an afterthought. It wasn't planned for in the beginning and because of it both Flash games and applications weren't built the way that they should have been. Some of that was partially my fault, because when I was building them I didn't think of putting them into other languages.
With my new job I have been forced to conform with setting up everything that I do so that all of the text in a flash piece can be customized in XML. This has meant learning how to use Xpath in Flash, which the best solution out there is XFactorStudio's solution.
The solution from XFactorStudio allows you setup a search of an XML file for certain values or attributes. Here is an example of a search:
XPath.selectNodes(this,
"//item[@id='link']/@link")[0].nodeValue;
This simple search returns all nodes called "item" with the attributes "id" that are equal to "link". The "@link" part specifies that I want the value of the attribute named "link". This XML would be represented like this:
Selecting node [0] returns the first value. The above Xpath search would return the link:
These Xpath calls can be expensive, so you are much better off calling one node and getting the attributes off of it outside of the Xpath search.
You should end up with XML like this:
You should always wrap text in CDATA so that everything inside is igonored by the XML parser. This means any special characters will not mess up your App.
The use of XML will allow you easily change the language without having to recode your flash piece. The addition of font sizes, font colors, auto expanding text fields, and the resizing of graphical elements based on the length of the text all will make your project a success.
Trust me you should do it even if your company doesn't have a plan to make your stuff international. When your boss decides to take the site international and use other languages your work up front will pay off big time.
Many thanks to my former co-worker Brian for the idea on this article. It is something that they are having to go through now. Visit him at: http://www.remotesynthesis.com/blog/index.cfm