...

View Full Version : Physical Width of Text



aWishResigned
01-15-2008, 05:29 PM
Hey guys, I was just wondering, what method (if any) do you use to gauge the length of a dynamic text field?

To give an example, say I had a category object and when you roll your mouse over it, a bar extends the length of the category name. To set the width of this bar, I've taken the average length of a character of text at the font size (about 5-7px) and multiplied it by the total number of characters. Sadly, I don't know how to account for an abundance of extra wide or thin letters and sometimes, the bar comes up short or overshoots the letters.

Does anyone happen to have a better way to do this?

oesxyl
01-15-2008, 05:45 PM
Hey guys, I was just wondering, what method (if any) do you use to gauge the length of a dynamic text field?

To give an example, say I had a category object and when you roll your mouse over it, a bar extends the length of the category name. To set the width of this bar, I've taken the average length of a character of text at the font size (about 5-7px) and multiplied it by the total number of characters. Sadly, I don't know how to account for an abundance of extra wide or thin letters and sometimes, the bar comes up short or overshoots the letters.

Does anyone happen to have a better way to do this?

you can try using em and ex units instead of px, is more acurrate but still remain a problem to keep proportion as you if you must mix with px. :)

best regards

aWishResigned
01-15-2008, 05:46 PM
I've never tried using em increments in Actionscript. How would you go about doing that?

oesxyl
01-15-2008, 05:50 PM
I've never tried using em increments in Actionscript. How would you go about doing that?

sorry, I see now that is "Flash and ActionScript" section, I thought is HTML and CSS.

best regards

aWishResigned
01-15-2008, 05:58 PM
Well, thanks for answering anyways.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum