what is happening here?? TextField problem.
I'm not new to this and this is driving me crazy. Can someone please look at this and tell me what I am doing wrong. There is a Font named Arial embeded in my library, set to export for AS. This is the relevent part of my document class. All this does is create a textfield, add it to stage, set the text, load an xml file then attempt to change the text in the text field. But the text does not change.
public class Main extends MovieClip {
public static const EASE_TYPE: Function = gs.easing.Sine.easeIn;
public static const XML_PATH: String = "EventData.xml";
public static const TWEEN_TIME: Number = .5;
public var _messageField: TextField;
private var _xmlLoader: URLLoader;
private var _currentIndex: Number;
private var _messages: Array;
private var _times: Array;
private var _timer: Timer;
public function Main(): void {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.EXACT_FIT;
init();
}
private function init(): void {
_times = new Array();
_messages = new Array();
_currentIndex = -1;
_messageField = new TextField();
_messageField.selectable = true;
_messageField.width = 955;
_messageField.x = 15;
_messageField.y = 0;
_messageField.defaultTextFormat = new TextFormat( new Arial().fontName, 12, 0xFFFFFF, false, false, false, null, null, TextFormatAlign.LEFT);
_messageField.antiAliasType = AntiAliasType.ADVANCED;
_messageField.embedFonts = true;
this.addChild(_messageField);
_messageField.text = "Test 1 2 3 . . .";
// Load the xml file containing messages and times to display them.
_xmlLoader = new URLLoader();
_xmlLoader.addEventListener(Event.COMPLETE, onXMLload);
_xmlLoader.load(new URLRequest(XML_PATH));
}
private function onXMLload(e: Event): void {
trace("XML Loaded");
_messageField.text =". . . 3 2 1 tseT";
trace( _messageField.text);
}
....
At this point when I run this, I get a trace of "XML Loaded" and ". . . 3 2 1 tesT" but me text field still says "Test 1 2 3 . . ." when it should say ". . . 3 2 1 tesT" Why would this happen? It's as if the text field is not updating. I wrote this project using CS4 and it worked fine. I am now opening it/running it with CS5, if that matters...
Any help would be appreciated!