I am making some progress with an interactive poetry project I requested help on earlier. Unfortunately I have another problem which I can’t seem to solve. In the project I create 49 textfields in a 7x7 grid. The properties are stored in an array. The code I have to do this works as intended.
var instances:Array = [];
for (var i:int = 0; i < 49; i++) {
var j_inst:TextField = new TextField();
j_inst.text = “s”;
j_inst.width =50;
j_inst.x = (i % 7)*40+550;
j_inst.y = Math.floor(i/7)*25+100;
j_inst.selectable = false;
j_inst.border = false;
j_inst.autoSize = TextFieldAutoSize.CENTER;
var myFormat:TextFormat = new TextFormat();
myFormat.font = “Arial”;
myFormat.color = 0xFFFFFF;
myFormat.size = 24;
j_inst.setTextFormat(myFormat);
addChild(j_inst);
instances.push(j_inst);
}
The problem occurs when I try and change the text - in this case to the letter “O”. The textfield simply is cleared with nothing displayed. Here is the code for that -
function tickTock(e:TimerEvent):void {
for (var j:int = 0; j < 49; j++) {
instances[j].text=“O”;
}
}
If I trace the .text contents of the array it has been changed correctly to “O”. It just doesn’t display properly. Changing other properties such as x, y works as expected. I’ve tried with embedded and non-embedded fonts. Doesn’t make a difference. I’ve tried some different blend modes and still no success. I suspect it’s some kind of rendering issue but I’m totally stuck.
Any suggestions??
Thanks,
drkb