AS3 TextField metrics bug

Just a quick reminder for myself. There are a few interesting metrics functions in the AS3 TextField API like getCharBoundaries(), but if you have an autoSize field the methods won’t work properly. Just set the height of the field before calling the method to fix that.

...
textfield.height = textfield.height;
textfield.getCharBoundaries(charIndex);
...



2 Responses (Add Your Comment)

  1. Hey Martin, very useful TextField tips on your blog, thanks for sharing! I am also fighting with it, check them out at http://play.blog2t.net/tag/textfield+as3 if you’re interested

  2. hi,
    please note that every textfield has a default width and height of 100 pixel each :)

    regards,
    daniel

Leave a Reply

Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Other Entries

About

Martin Rädlinger is an Interactive Developer & Designer. He specializes in interactive coding predominantly with ActionScript, but every new challenge is welcome. If you like his work feel free to get in touch with him. At the moment he's available for freelance work.

Contact

Martin Rädlinger
mail: mr [at] formatlos.de
web: www.formatlos.de
xing: Martin Rädlinger
linkedin: Martin Rädlinger
skype: martinraedlinger