I’ve loaded a text from an .xml file into a flash animation. The .xml file
can contain different translations of the text in several languages.
However during development the text is initially written in English inside flash. Once the language.xml file is loaded the text changes into the proper language.
The .xml file is loaded through a document class script.
The problem is though, as soon as i start to animate the text, to move it, then the text loses its translation which it loaded from the xml file and reverts back to the initial english text.
I’d like to know how to fix this, but i don’t know why it happens in the first place.
Here’s the document class, which loads the translation from the xml file into the text. Not sure if the document class script is even the problem though, because it works initially. The problem starts when animating the text.
package {
import flash.display.*;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.*;
import flash.text.TextField;
public class LoadLanguage extends MovieClip {
private var languageText:XML;
public function LoadLanguage() {
loadLanguageFile();
}
public function loadLanguageFile() {
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("language.xml");
loader.addEventListener(Event.COMPLETE, completeLoadingLanguageFile);
loader.load(request);
}
public function completeLoadingLanguageFile(event:Event) {
var loader:URLLoader = URLLoader(event.target);
languageText = XML(loader.data);
replaceText();
}
public function replaceText(){
weat.text = languageText.website.indexPhp.flashElement.frame5.weAt;
}
}
}