actionscript-2textfield

Vertical scroll a textfield by pixels in Actionscript 2


Is there a way to vertical scroll a textfield in actionscript 2 by pixels instead of line by line?


Solution

  • i am afraid, the answer is simply "no" ... there is no API to expose that functionality ... you could make the textfield autosizable, so scrolling is disabled, and then mask it ... but then tracking all the user input that will cause a text field to scroll, will be a hell of a job (most notably, cursor movement ... well tracking where the cursor is, is not too hard (i.e. it's easy to track the character index), but calculating the resulting coordinates is a hell of a job) ...

    little side note: i've noticed, that you work with AS2 a lot ... i'd personally advise you to move on to Haxe or AS3 ... Haxe for the sake of it's richness as a language (and you could still be targeting flash player 8 if you need to), and AS3 for the sake of a much better API (there, you have a call to get the coords of a character) and the drastically higher execution speed ... to me, there is just one advantage of AS2, which is, that you can extend the language a lot at runtime ... compiling AS3 in ECMA compatibility mode allows you to do likewise with AS3 ... you will lose some of that speed of course, but still be faster than with AS2 ...