Question

in AS3, I'm making this dynamic textfield that is populated from an XML file based on where the user clicks.

The dynamic textfield has a custom scrollbar to it. My problem is that if the text inserted into the textfield is less than the previously displayed text, you can still scroll the dynamic textfield as far as the previous one.

Is there a way to reset the textfield autoSize?

Many thanks,

Was it helpful?

Solution

I think this link will tell you exactly what to do.

Are you using any of the standard flex controls? Or, is this flash?

You can set the width of the field to the string length + some space (by binding the width to the string's length/event handling etc). This may be of interest. Of course,

OTHER TIPS

If you are talking about Flash ( I have very little experience in Flex ) then the textField.autosize property would probably get you in the right direction.

Try this, wrap the xml elements text in

<text><![CDATA[<span class="someClass">Some Text Here</span>]]></text>

If the prior wasn't wrapped in CDATA, flash would have taken the <span class="someClass"> and attempted to drop it down a line and indent it as you would with XML hierarchy; CDATA tells flash to ignore those characters and literally treat them as a string. The result of not using this process is that there are many odd spacings in your textfield.

Also be sure that your TextField is set to Multiline and wordwrap, as well as autoSize such as TextFieldAutoSize.LEFT;

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top