Skip to main content
February 27, 2007
Question

setSize of dynamic text field based on contentsize

  • February 27, 2007
  • 7 replies
  • 473 views
I want to set height and width to textfield based on the content size of which is not known before

I want his done when creating many text fields through loop.

Can anyone help me.
This topic has been closed for replies.

7 replies

February 27, 2007
Thanks for all of you, I get this issue solved
February 27, 2007
You can definitely do this when you have ample space to assign to the text fields.....

but as Simhanature is creating several textfields i think the main problem resides in positioning the next textfields x y coordinate depending on the previous one's height and width.......

any way i think Simhanature has his issue solved ......

cheers
February 27, 2007
That is quite simple assign the text to a dummy textfield whose autosize property is true and then apply that height and width to the just created textfield...

But the process has to be done each time the text change......
February 27, 2007
See when you are creating the textfields you need to have the text value....so that you can set differeny size of that textfields ......

and whenever the value changes you need to run the same loop of creating and assigning text........

Inspiring
February 27, 2007
Hey. He would like to calculate the Required Height of the textField when he assigning Text.

What is the Text Format? Is it a HTML Text or Dynamic Text with different FontStyle or dynamic Text with Same FontStyle?

Here is a Simple implementation of Dynamic Text height
February 27, 2007
I want to display the content from Flash Remoting
And the text will be displayed through loop by creating newTextField
And each content will be of different size.
Marghoob Sulemaan
Inspiring
February 27, 2007
It is not necessory to have text value for the text filed on creating time. you could set it later 2. and if you set the property textfieldInstance.autoSize = true; it will automatically set your text width to your text value.

see an example.. creating a text field with 0 height and 0 width.
Marghoob Sulemaan
Inspiring
February 27, 2007
you can use following method.
textfieldInstance.autoSize = true;
February 27, 2007
Your question is totally obscure......try to give us a detail description......

how can you define some property to some value which you do not know......
quite philosophic.......