I’m having a serious problem understanding why my dynamically created textField is not being displayed when I add it to the display list. If I preview my swf by exporting it from Flash, the textField displays just fine. However, my Flash application is loading in several swf assets and its when the swf is loaded into another swf that the textField will not display.
I am using the document class for every swf I am creating.
My structure is:
Loader
-> Main
-> Content
Where Content is removed and added as a user interacts with the application.
Here is part my code:
private var thumbTextEmbedFont:font = new font();
private var xml:XML;
private var xmlSlideList:XMLList;
private var xmlLoader:URLLoader = new URLLoader();
private var txtField:TextField = new TextField();
private var tfFormat:TextFormat = new TextFormat();
private function loadedXML(e:Event):void
{
xml = new XML(e.target.data);
xmlSlideList = xml.slide;
xmlLoader.removeEventListener(Event.COMPLETE, loadedXML);
tfFormat.font = thumbTextEmbedFont.fontName;
tfFormat.align = TextFormatAlign.RIGHT;
tfFormat.color = 0xFFFFFF;
txtField.selectable = false;
txtField.embedFonts = true;
txtField.autoSize = TextFieldAutoSize.RIGHT;
tfFormat.leading = xmlSlideList[0].txtLeading;
txtField.htmlText = xmlSlideList[0].txt;
txtField.x = xmlSlideList[0].txtX;
txtField.y = xmlSlideList[0].txtY;
txtField.width = 740;
//txtField.height = 400;
txtField.setTextFormat(tfFormat);
addChild(txtField);
}
I have even tried adding the textField to a dynamically created Sprite and that makes no difference. I know that the object is being added to the display list, but it is not visible. When I test it inside of a browser the text does not display, nor does it display if I open the Loader swf and have the content loaded in. It will only display when I launch the swf file directly.
Could someone please shed some light on what I am doing wrong?