A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: how to restrict height on a dynamic textfield

  1. #1
    Senior Member
    Join Date
    Dec 2000
    Posts
    110

    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?
    www.fransgaard.com - Online Portfolio
    www.fransgaard.net - Personal corner of the Internet

  2. #2
    FK Newb Beater
    Join Date
    Dec 2002
    Location
    Seattle
    Posts
    676
    set outoSize = false and then declare the new height - myText_txt._height = newHeight
    Just because you changed the code, doesn't mean it's yours

    Most Recent Work:
    Commercial tanning beds website

  3. #3
    Senior Member
    Join Date
    Dec 2000
    Posts
    110
    I've tried that when the text field reaches a certain height but that didn't work
    www.fransgaard.com - Online Portfolio
    www.fransgaard.net - Personal corner of the Internet

  4. #4
    FK Newb Beater
    Join Date
    Dec 2002
    Location
    Seattle
    Posts
    676
    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.
    Just because you changed the code, doesn't mean it's yours

    Most Recent Work:
    Commercial tanning beds website

  5. #5
    Senior Member
    Join Date
    Dec 2000
    Posts
    110
    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.
    www.fransgaard.com - Online Portfolio
    www.fransgaard.net - Personal corner of the Internet

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center