Copy link to clipboard
Copied
var spec:TextField = new TextField();
spec.defaultTextFormat = new TextFormat('Arial', 18, 0xFF0000, true);
stage.addChild(spec);
spec.x = spec_men.x;
spec.y = spec_men.y;
spec.width = spec_men.width;
spec.height = spec_men.height;
spec.text = 'hello';
This code, for some reason, does not put the text field anywhere on the stage. All the objects referenced exist and a trace statement shows that it has text, but it is no where to be found.
I had a problem like this before where the text was behind my background image, but I checked and it's not.
What am I doing wrong?
Did you verify where it actually is? You could try something like:
var spec_men:Object = {x:0,y:0,width:100,height:30};
in order to force the loc and size.
Also, I'd remove stage from addChild
Copy link to clipboard
Copied
Did you verify where it actually is? You could try something like:
var spec_men:Object = {x:0,y:0,width:100,height:30};
in order to force the loc and size.
Also, I'd remove stage from addChild
Copy link to clipboard
Copied
All right, it works!
Thanks!