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

TextAreas and TextInputs playing havoc with size of parent (AIR/AS3)

Community Beginner ,
May 22, 2015 May 22, 2015

Copy link to clipboard

Copied

I'm gonna start with an example:

var testTF:TextField = new TextField();

var testTA:TextArea = new TextArea();

var testSpr:Sprite = new Sprite();

testSpr.addChild(testTF);

testSpr.addChild(testTA);

testTA.width = 400;

testTA.x = 200;

trace(testSpr.width);

Now, the trace seems like it should spit out 600, right? For whatever reason though it's only spitting out the width as though testTF were the only thing in there. It's not just trace statements that are being weird either, this is making it difficult to dynamically position things to the right of testSpr. Is there something weird about how TextAreas and TestInputs behave as children of another display object? If it makes any difference, this is part of an AIR 2.0 project. Thanks.

TOPICS
ActionScript

Views

281

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

Community Expert , May 22, 2015 May 22, 2015

apply the validateNow() method to your textarea before querying size:

.

.

.

testTA.validateNow();

trace(testSpr.width)

Votes

Translate

Translate
Community Expert ,
May 22, 2015 May 22, 2015

Copy link to clipboard

Copied

apply the validateNow() method to your textarea before querying size:

.

.

.

testTA.validateNow();

trace(testSpr.width)

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
Community Beginner ,
May 23, 2015 May 23, 2015

Copy link to clipboard

Copied

Works perfect now! 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
Community Expert ,
May 23, 2015 May 23, 2015

Copy link to clipboard

Copied

LATEST

you're welcome.

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