• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

TextField Not Displaying

Participant ,
Oct 07, 2015 Oct 07, 2015

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?

TOPICS
ActionScript

Views

189

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Oct 07, 2015 Oct 07, 2015

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

Votes

Translate

Translate
Enthusiast ,
Oct 07, 2015 Oct 07, 2015

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 07, 2015 Oct 07, 2015

Copy link to clipboard

Copied

LATEST

All right, it works!

Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines