Possible bug? Textfield returning wrong "height" with autosize.

  • Hi there

    I'm using autosize to set the size of a textfield, but it is displaying some strange behaviour: although the textfield IS resized and the text is shown, the background is not adjusted to its size.
    This wouldn't be much of a problem, but when I try to access its "height", the value returned is that of the background, and not the entire text. I was trying to use this value to stop downscrolling when the text reaches the end. If I change the text size, the background is also resized, but still doesn't match. Any thoughts?

    Here's the code for the textbox:

    <plugin name="m_desc-box" url="plugins/textfield.swf" alpha="0.7"parent="m_desc-stubParent"visible="true"align="lefttop"    width="200" autosize="left"wordwrap="true"y="0"background="true"

    And a couple of example results:

    Values traced:
    get(plugin[m_desc-box].height) = 289

    stageHeight = 500

    Values traced:
    get(plugin[m_desc-box].height) = 124

    stageHeight = 500


  • Hey

    The problem can be seen in this very simple example:

    In 1.0.8 beta 9, all the text is displayed (it can be seen when you select it), but the background only has around half the size of the text. Let me know if you can't reproduce the problem with this.


  • Hi emediquei,

    Following the way you already fixes the autosize problem *thumbup* , I found that your code above can be fixed also in this way:

    onloaded="set(html,get(html))" without the delayedcall()...


  • Hi..

    great solution, but a question,
    if in the html data i have a code of image

    html="blabla bla bla  <img src="hello.jpg" /> bla bla"

    this not work ,because de quotes

    how write this??


  • Hi mnovoa,


    this not work ,because de quotes

    Not only because the quotes... also because the < and /> used inside the html attribute...
    Have a look to the Textfield html attribute :

    HTML code
    write direct HTML code, but NOTE - using HTML chars like '<' and '>' is not possiblie, because of XML limitations, so you can use '[' and ']' instead!

    So your code will be:

    html="blabla bla bla [img src='hello.jpg' /] bla bla"

    Also, have a look to this thread: Disabling image text wrap

    Hope this help.


  • I've also struggled with this, and had to resolve it by a combination of delaying changing the .html, and forcing a redraw with lookto( get(view.hlookat), get(view.vlookat)); There was different behaviour on Mac from Windows (Win got the height wrong consistently unless there was a delay)

    Would it be better if instead of setting a property on the textfield component, there was a changehtml method which would definitely change the HTML, AND then internally force the autosize to recalculate?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!