In main, I create buttons, when I press a button, I have this function call:

var TxtAbt:TextInfo = new TextInfo(); TxtAbt.AboutF(); 

In the function itself:

 public function AboutF() { var myFormat:TextFormat = new TextFormat(); var AboutText = new TextField(); myFormat.align = "center"; myFormat.font = "Tahoma"; myFormat.size = 25; myFormat.color = 0xAA00FF; AboutText.width = 120; AboutText.height = 40; AboutText.y = 5; AboutText.selectable = false; AboutText.text = "Текс будет здесь, много текста"; AboutText.setTextFormat(myFormat); addChild(AboutText); trace("ABOUT TEXT"); } 

But for some reason I do not see the text on the scene, although the trace passes, there are no errors.

    1 answer 1

    addChild(TxtAbt) have forgotten to do addChild(TxtAbt)

     var TxtAbt:TextInfo = new TextInfo(); TxtAbt.AboutF(); addChild(TxtAbt);