Is there any way on earth to dynamically work out how wide any given character, of any given font, will be? Like as in physical pixel width?
Does that make sense? Basically, Im making a dynamic menu template so that a simple text file is loaded as variables, split, and used to duplicate a lone movie clip as many times as necessary, and then populate it with subcategories. I suppose some of you have heard already how much of a ***** that can be, its giving me trouble nonstop. Well, Im in the home stretch, but there is one last major issue.The movie clips are duplicated in the horizontal direction cause its a horizontal menu. Obviously, I wanted the buttons to move around either closer or further left or right depending on how long the title of each button is. So, after much ado, they do that very well. I get the variable of how long each title is, i.e. “4” for the button “Home”, then I have to work out what that means in physical pixels…so I measured a couple of upper-case characters in Photoshop, and they were 10 pixels wide.
The result is that my script went “set x of clip* to number of characters multiplied by 10”. Which sort of works well. But then I noticed strange gaps here and there…and why not, cause maybe caps letters ar 10 pixels wide, but lower case are anywhere from 4 to 10…so, in order for the dynamic menu to be truly dynamic, I need a way to say ““Home” has 4 letters, but “H” and “m” are 10 pixels wide, “o” and “e” are 7, so the total is 34”. Without having to hardcode a huge list of the respective widths of each character. It needs to work no matter what font and what font size.
It can be implemented in the Actionscript stage, or in Coldfusion, Javascript, CSS, HTML, whatever, if there is a way to do someone please tell me…
This seems highly unlikely…