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);