Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试计算 textWidth,但它似乎忽略了最后的空格。文本
“你好你好 ”
返回相同的文本宽度。带 " " 的字符串返回 0。如何计算带空格的宽度?
你总是可以得到字符串的长度。
text.length
然后将其乘以角色的宽度。
例如:
var aChar:String = "A"; var textWidth:int = (text.length) * (width of aChar);