HOWTO use the Wiimote buttons in Flash

HOWTO use the Wiimote buttons in Flash

A while back, WiiNintendo posted the keycodes that are detectable by Javascript when the Wii’s buttons are pressed. With this ability, you can create Javascript games that will play on your Wii. Unfortunately, even though the Wii browser ships with the Flash plugin, those keycodes cannot be detected natively in the Flash environment.

Quasimondo came up with a really clever hack that solves the problem. You can create a second flash movie and use Javascript to resize it to specific widths for particular keycodes. Even though Flash cannot detect the keycodes, it does receive an onResize event. When it receives this event, it then retrieves its current width, which was set to the value of the keycode. This second swf file can then use Flash’s LocalConnection to communicate that value to the primary swf.

How to Make the Wiimote Work in Flash – Link
Aral Balkan’s discussion on using the Wiimote in Flash – Link
Wiimote Key Codes @ WiiNintendo – Link

Discuss this article with the rest of the community on our Discord server!