开发者

Flash: cross-platform method for handling keyboard events?

Is there any cross-platform-safe method for dealing w开发者_高级运维ith keyboard shortcuts in Flash?

For example, on my Mac, pressing ctrl+f results in a KeyboardEvent where the keyCode is 6, but on Windows, the keyCode is 70.


The keyCode 70 is 'F' without the CTRL. I would guess the browser is taking priority over that combination since it's commonly used for searching the page you're on and that's why you're getting the different codes.

6 must be the command button I think, but I might be wrong, it's not included here: http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001136.html

You could try tracking them seperately, listening for Keyboard.CONTROL (const from flash.ui.keyboard) and your '6' and when have that and you receive the 70 then you have your CTRL+F.

If your flash is destined for a browser I would use a combination that's not in use already though.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜