Personal and Professional Blog of Rich Hauck

Disable TextField scrolling on selection

December 29, 2010

Flash has a pesky issue when you dynamically populate a selectable TextField–when a user highlights the text, the content scrolls because it’s slightly larger than the autoSized height.

I’d solved this exact problem ages ago, but couldn’t find the code. After some fiddling, here’s an ActionScript 3.0 solution that allows selectable text–while eliminating selectable scrolling.

Code:
label_txt.autoSize = TextFieldAutoSize.LEFT;
label_txt.htmlText += "<p>My text goes here</p>";
var tempHeight:Number = label_txt.height;
label_txt.autoSize = TextFieldAutoSize.NONE;
label_txt.height = tempHeight + 10;

Here, you allow autoSize to let the content define the height, next you save the height, then you disable the autoSize. Finally, you re-assign the TextField’s height with a bit added on to prevent scrolling.

Categories: ActionScript, Flash, flex

Christmas 2010 Card

December 27, 2010

I forgot how time-consuming drawing up a Christmas card is! This year, I started out on my iPad with a Sketchbook Pro and a Boxwave stylus (below). Ultimately, though, I took it back into Flash with my Cintiq, as the vectorized illustration tools felt cleaner.

Yup, my son actually did take a ballpoint pen to our furniture. Guardsman won’t cover it (I feel like the salesperson over-promised on the insurance). At least it makes for a card concept.

Categories: art

About Me

Rich HauckI'm a designer, developer, and teacher based in Harrisburg, Pa. I run Hauck Interactive, Inc.




Archives