开发者

Convert CharCode to Char?

What I need

ok I googled this and there are many tutorials on how to get the charCode from the character but I cant seem to find out how to get the character from the charcode.

Basically I am I am listening for the KeyDown event on a TextInput.

I prevent the char from being typed via event.preventDefault();

Later I need to add the text-char to the TextInput.

I can get the charCode via event.charCode so if I can turn that into a string I can save it for later user.

Why I need it

Basically I am making a TextInput, that that I can set to display default text in开发者_如何学Python it. When A user types into it, I want to remove the default text first then add the user typed text.

Currently I am either removing it all, or ending up with both.


It's simple:

var yourNewChar:String = String.fromCharCode(event.charCode);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜