Friday, June 19, 2009

Flash + Wii

The way Flash is advancing towards embracing different technologies and input mediums, it is apt for Adobe to make it as a platform. Adobe Flash (earlier Macromedia Flash) which was just an animation tool initially has come a long way till date. It not only provides you a platform to build dynamic website, but also a Rich Internet Application and the output devices can range from Personal computer to mobile to TV to palm top. And with the Open Screen Project by Adobe and other industry leaders of technology like Intel, Verizon, Samsung, Palm, Qualcomm. Well more details on this can be got from its site

This was just to give a brief peep into world of Flash.
What I want to post here is to document my first encounter with Wiimote and Flash. Yes there are plugins and api available today through which you can take gestural input from Wiimote to Flash.
You can easily get lot of information on it from internet but this post is a consolidation of all of them and gives a concise description.
To start with you have to download the server to communication wiimote events to flash. And yeah flash apis for capturing these events and programming required output.
Get the entire suite at WiiFlash site

The site has got entire documentation of how to go about connecting wiimote and then using it with Flash. However there are some loopholes.

Prerequirements
1. .NET 3.0 runtime
2. wiiFlash server
3. bluetooth enabled PC/laptop
4. Wiimote

Steps
1. You have to download .NET 3.0 runtime environment from Microsoft site as the latest WiiFlash server uses .NET3.0 components. On the site it mentions to download 2.0. However I dug out from internet that 3.0 is the latest requirement.



2. Now you should have a Wiimote and a bluetooth enabled PC or laptop. PC might not have inbuilt bluetooth adaptor so you have to buy a bluetooth dongle and configure the hardware. See the image below. e.g. Bluesoleil


3. Download WiiFlash server from the site. Once you download the zip, extract it and locate the server exe at WiiFlash 0.4.5\WiiFlash 0.4.5\Servers\WiiFlashServer 0.4.5.exe document. Make a shortcut of this file, as you are going to use it everytime you want to connect wiimote to flash.






We now have to connect our wiimote with our pc/laptop for bluetooth communication

4. Open bluetooth devices dialog or go to My bluetooth devices and select search bluetooth devices. As soon as it starts searching for bluetooth devices press button 1 and 2 on wiimote simultaneously (see wiimote image for reference of these buttons). Once the search is complete you should see an entry like Nintendo RVL-CNT-01. Select this device and proceed further.
5. The dialog asks for a passkey for the device to connect to computer. This is for security purpose. However our Wiimote doesn't require any passkey so just say "No Passkey/passcode" and proceed further.

6.With this you are done with making wiimote pc connection. Double click on the wiiflash server. It should look like this.


The wiiflash server shows how many wiimote are connected.
Tadaang !!!!!
It's done.
To check whether your wiimote is working or not open wiimote_demo.exe from WiiFlash 0.4.5\WiiFlash 0.4.5\Examples folder. Though different sites mention just opening .swf file will make the file working I found that making a projector of the file is better option.
You need to open the file in Flash IDE (CS3 and above) and just publish it as .swf and .exe (projector).
Click open the file and you should see different parameters changing by chagning wiimote gestures and clicking different buttons.
See the attached screenshot below.


I think this is enough to start with. You can check out other examples in the zip and and have fun.

Next post will be how to program wiimote events and make exciting stuff in few easy steps. You should have knowledge of Flash event handling. ;-)

No comments: