cast String to LinkageId
Here in Belgium we have to build most of our flash projects in different languages, so most text is loaded from xml or databases. But sometimes its not possible to use dynamic text so we have different movieclips in our library displaying the same content but in an other language.
example: Home_nl, Home_fr, Home_en
It would be easy if we can create an actionscript function that will automatically display the right movieclip.
I found following solution:
function addHome(language:String):void{
var classLinkage:Class = flash.utils.getDefinitionByName(”home_”+language) as Class;
var home:MovieClip = new classLinkage() as MovieClip;
addChild(home)
}
addHome(”nl”);
To use my example you need in your library a mc with linkage class name: home_nl
