Interesting approach, Derek. I've actually done something similar in the past for paginating purposes, but it didn't occur to me to do it for this. Of course, it gets really hairy if you're dealing with HTML, but still doable.
Thanks! -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Derek Vadneau Sent: Monday, June 05, 2006 4:48 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] Prevent Multiline Selectable TextFieldfromscrolling? There's no simple property for this but I was able to put together an example that works (check below for the caveats): var o; var i:Number; var tf = t.getTextFormat(); var linesOfText:Number = 2; var originalText:String = t.text; for (i=0; i<originalText.length; i++) { o = tf.getTextExtent(originalText.substr(0, i)); if (o.width < 2 * t.textWidth && o.width > linesOfText * t.textWidth - 20) { t.text = originalText.substr(0, i); break; } } It's a little funky, but extending Flash textfield seems to always be like that. What it does is store the original text and populate the textfield with text only up until it would scroll. Here are the caveats: 1. The number in the if condition (20) is a guess. If I had the time to spend on this I would calculate the size before the next word. As it is now 20 seemed to work for the text that I had. 2. The text will be from the 0 character onwards. If you have a scrollbar, or other means of scrolling, the scrollPosition will not be taken into account. Again, if I had the time this could probably be made to compensate for the caveats. Hope it helps. Derek Vadneau ----- Original Message ----- From: "Tom Lee" <[EMAIL PROTECTED]> To: "'Flashcoders mailing list'" <flashcoders@chattyfig.figleaf.com> Sent: Monday, June 05, 2006 4:05 PM Subject: SPAM-LOW: [Flashcoders] Prevent Multiline Selectable TextField from scrolling? This should be a trivial problem, but for some reason I'm not seeing an obvious and clean solution (one of those Mondays). What I want to do is prevent a TextField from scrolling when the user selects the text. Essentially, have the text be selectable but locked in place, regardless of the height of the text field. I've tried: TextField.onScroller = function(tf){ tf.scroll = 0; } This works ok, but not cleanly. The text is still allowed to scroll, it just jumps back into place when the user releases the mouse. There oughtta be a TextField.scrollable:Boolean. Ideas? _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com