Hi,
i’m trying to load some text from XML, the ‘trace’ is correct, but the text doesn’t show up on screen. I created a movieMaterial, with a textField into it, and if i test the code with a random text it works, but not with my text from the XML. Do you know why? i’m a bit stuck ... Thanks for your help
mc = new MovieClip();
textfield = new TextField();
textfield.setTextFormat(new TextFormat("Arial", 50, 0xff0000));
//load xml
myXMLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("texteXML/texte.xml"));
myXMLLoader.addEventListener(Event.COMPLETE, processXMLduTexte);
//textfield.text = "allodsqkjflmsdjfmlqsjdflmqkdjflmdkj";
textfield.autoSize = "left";
mc.addChild(textfield);
var text_movie : Plane = new Plane({width:TEXT_WIDTH, height:TEXT_HEIGHT});
text_movie.material = new MovieMaterial(mc);
text_movie.bothsides = true;
text_movie.rotationX = 90;
view.scene.addChild(text_movie);
}
function processXMLduTexte(e:Event):void {
//load text from xml
var myXML:XML = new XML(e.target.data);
var my_texts:XMLList = myXML.elements("titre");
//show text from xml
textfield.text = myXML.titre[0].@nom;
trace (myXML.titre[0].@nom);
myXMLLoader.removeEventListener(Event.COMPLETE, processXMLduTexte);
myXMLLoader = null;
}