-
how to restrict height on a dynamic textfield
I have a textfield with autoSize = true;
I load text into it using XML and want to restrict the amount of content it can load in so it does scale out of a certain height
Any ideas how I can do this?
-
set outoSize = false and then declare the new height - myText_txt._height = newHeight
-
I've tried that when the text field reaches a certain height but that didn't work
-
Hmm.. I tried it and as expected, it works for me.
how about this:
myText_txt.autoSixe = false;
myText_txt._height = myText_txt._height>100 ? myText_txt._height : 100;
Basically this line of code says, 'if myText_txt._height is more than 100 set it to 100 if it isn't keep it the same height.'
so if your limit (100) is exceeded, it resizes the text field, if it is below the limit, it keeps it the same size.
-
well, it won't allow me to re-size the textfield. It is like the imported text overwrites the height I try to force it to go to.
basically what I have tried is:
myText_txt.autoSize = true;
the text is imported from XML file simply as:
myText_txt.htmlText = content_xml.firstChild.childNodes[i].firstChild.nodeValue;
Nothing fancy.
The I have tried to force it with a looping movieclip like this:
onClipEvent(enterFrame){
if (_root.myText_txt._height > 200){
_root.myText_txt.autosize = false;
_root.myText_txt._height = 200;
}
}
but it is like because the text in the box already goes beyond the height 200 it won't allow me to make it smaller... a bit like an HTML table, even if you specify a height it will be higher if the content is higher.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|