HOWTO use the Wiimote buttons in Flash

wiimote_20070620-1.jpg
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

Posted by Jason Striegel | Jun 20, 2007 08:24 PM
Ajax, Flash, Gaming, Web | Permalink | Comments (2) Bookmark and Share

Recent Entries

Comments

Newest comments listed first.

Posted by: Shakakai on June 20, 2007 at 9:39 PM

You can also use the Flex-Ajax Bridge to pass data from Javascript to Actionscript using Flash's ExternalInterface Class.

Here's the link to the docs.

Cheers!


Posted by: Shakakai on June 20, 2007 at 9:48 PM

Whoops. Didn't realize the Wii only has Flash 7. I guess that tell you how long they had it in development.


Leave a comment



Bloggers

Welcome to the Hacks Blog!

Brian Jepson.Brian Jepson


Jason Striegel.Jason Striegel


Philip Torrone.Phillip Torrone



See all of the books in the Hacks Series!
Advertise here.

Recent Posts

www.flickr.com
photos in Hacks More photos in Hacks

Most read entries (last 30 days)