将 TextField 分配给影片剪辑时遇到一个奇怪的问题。
nameFormat = new TextFormat();
nameFormat.size = 14;
nameFormat.color = "0x000000";
nameFormat.border = true;
nameFormat.font = "Arial";
charName = new TextField();
charName.defaultTextFormat = nameFormat;
charName.text = value.charname;
charName.x = 92.5;
charName.y = 6.5;
charName.width = 205;
charName.height = 21;
thechars[value.charid].addChild(charName);
如果我跟踪 charName.text 它会正确跟踪,但是当显示包含的影片剪辑时,它始终是空白的,并且我的任何设置(边框、背景颜色等)都不会显示。我将其中几个影片剪辑放入另一个影片剪辑中,然后将其添加到滚动条中:
scrollContent.addChild(thechars[newvalue.charid]);
theScroller.source = scrollContent;
奇怪的是,我使用完全相同的方法将一个按钮放入每个“thechars”中,它显示出来并且工作正常。并且...如果我将鼠标悬停在 textField 应该在的位置上,我可以看到我的鼠标从指针变为文本光标,所以 textFields 出现了,它们只是空白吗?
帮助?
更新 :
我尝试了其他方法,但我更加困惑...我将以下代码放在一个框架上,并且发生了完全相同的事情...我可以用鼠标看到 textField 在那里,但它是空白的并且属性对它没有影响。我只是在这里完全错过了什么吗?我可以覆盖这个类吗?如此迷茫...
var descFormat2:TextFormat = new TextFormat();
descFormat2.color = "0x000000";
var charDesc2:TextField = new TextField();
charDesc2.defaultTextFormat = descFormat2;
charDesc2.text = "THIS IS MY TEXT";
charDesc2.x = 92.5;
charDesc2.y = 28.8;
charDesc2.border = true;
this.addChild(charDesc2);