How to find text width of a TextField in Action Script Flash Professional cs6

note : In action script 2 getTextExtent() method gives width, height, ascent, descent, textFieldHeight, and textFieldWidth of text in the TextField, but in action script 3 to get above things use one of the below methods.

It is very easy to find out width, height, ascent, descent, textFieldHeight, and textFieldWidth of text in the TextField. There are two methods are there

1. Finding width and height of text in the TextField using textWidth and textHeight property of the TextField.

2. Finding width and height of text in the TextField using getLineMetrics() method of the TextField with help of TextLineMetrics class.

Here is the example code above two methods.

 Output:

how to find width and height of text in the textField in action script 3 flash professional

Second Method :

 Output :

how to find width,height, ascent and descent of text in the textField using getLineMetrics in action script 3 flash

Subscribe to get all tutorial updates, promotional offers and download links for all tutorials via E-Mail

Enter your email address:



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">