|
-
TextField not showing as htmlText when using addChild
I have an odd predicament that I'm trying to wrap my head around. I have a textField, that is populated by data from an xml file. It contains simple line html line break tags, and when I use the htmlText option, it doesn't seem to recognize those tags, even though they don't show up when I view it online. Here is my code:
Code:
//FLASHVARS CODE
var varName:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (varName in paramObj) {
myFlashVar = String(paramObj[varName]);
}
//INIT VARIABLES
var myFlashVar:String;
var showX:XML;
var showList:XMLList;
var output:String = "";
var outputTxt:TextField;
var showTxt:TextField;
//TEXTFIELD PROPERTIES
showTxt = new TextField();
outputTxt = new TextField();
showTxt.x = 9;
showTxt.y = 52;
showTxt.width = 344;
showTxt.height = 242;
showTxt.wordWrap = true;
showTxt.autoSize = TextFieldAutoSize.LEFT;
showTxt.textColor = 0xFFFFFF;
var style:StyleSheet = new StyleSheet();
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onComplete);
loader.load(new URLRequest(myFlashVar));
function onComplete(e:Event):void
{
showX = new XML(loader.data);
showList = showX.song;
for(var i:uint = 0; i<showList.length(); i++)
{
var track:Number = (i + 1);
if(i<9) {
output += "0" + track + ". " + showList[i].number + " " + showList[i].artist + " - " + showList[i].title + "<br>"; }
else {
output += track + ". " + showList[i].number + " " + showList[i].artist + " - " + showList[i].title + "<br>"; }
}
showTxt.htmlText = output;
addChild(showTxt);
}
I can't figure out how to make it render properly. If I choose a dynamic text field already on the stage it works fine, but then the scrollbar doesn't work. I read that a TextField automatically uses a scrollbar when it gets too long. Can anyone suggest a possible work around for this? I feel the answer is staring me in the face and I just can't see it. Thanks
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|