Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Nov 2007
    Posts
    72
    Thanks
    0
    Thanked 1 Time in 1 Post

    Physical Width of Text

    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?

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by aWishResigned View Post
    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

  • #3
    New Coder
    Join Date
    Nov 2007
    Posts
    72
    Thanks
    0
    Thanked 1 Time in 1 Post
    I've never tried using em increments in Actionscript. How would you go about doing that?

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by aWishResigned View Post
    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

  • #5
    New Coder
    Join Date
    Nov 2007
    Posts
    72
    Thanks
    0
    Thanked 1 Time in 1 Post
    Well, thanks for answering anyways.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •