Skip to content

unic8 Studios

Documentations Tutorials FAQs Links Advanced search
You are here: Home arrow News arrow Labs arrow Flash/Flex + Wiimote = Virtual Mouse
Flash/Flex + Wiimote = Virtual Mouse
Tuesday, 26 February 2008
flex_wiimote_cursor.jpg

As we already implemented these functionality in our project I decided to build a sample Flex project and share it. Wiimote in combination with the WiiFlash project let's you easily communicate between Flash (Flex) and the controller. Trevor McCauley released a VirtualMouse class that is able to virtually create a Mouse which supports all functionalities of a real one: movement and event triggering. These things combined are absolutely cool... a Wiimote controlled mouse!

Features

  • Move mouse via roll/pitch your Wiimote or use the stick (up/down/left/right).
  • Toggle between sensors and stick with the "Home"-button
  • Single-click (press & release) with the "B"-button or double-click with the "A"-button

NOTE: The virtual mouse is only available inside you Flash/Flex movie. It is not able to control you system so there are no risks at all. Enjoy!

Video

Technical requirements

Instructions

  1. Download and unpack source code
  2. Get WiiFlash and run it on you local system
  3. Open the project with Flex 3 or run the WiiMouse.swf in the bin-release directory

Source code

Flex 3 project files: WiiMouse (851.08 Kb)

Trackback(0)
Comments (18)add comment

phpnuke said:

 
Wiimouse seems like a great project. I am downloading it right now. By the way this video presentation was better than the previous one. The last video was not clear enough to understand what was going on the whole time.
2008-02-26 19:16:02 | url

erik said:

 
Yes, it is not that easy to show all the functionalities in a video. There are several factors which influence the final output.

- Video platforms reduce the quality by re-encoding the videos
- Blog layouts like ours can only handle a slim width (e.g. 500px)

The best experience for our videos is to view them in fullscreen. Just click "menu" in the player and then "fullscren" button at the top.
2008-02-26 19:27:43 | url

anthony said:

 
Hello,
i'm french student and i would work and developp an application which use Flex and Wiimote in order to create a lot of 3D animations!
Do you use a Sensor Bar or not?Because a lot of applications in the web use it but I don't understand the goal of this Sensor Bar.
Congratulations for your video.
2008-04-15 09:02:05

dougi said:

 
Hi,

thanks for this usefull example. Have u made some try with papervision3D ? At this time, i can't click any pv3d object or objects materials. Any help would be appreciated.
2008-04-16 09:40:46

erik said:

 
@ anthony: This is example is done without the SensorBar. For your information WiiFlash 0.4 is released since a few days and the IR capabilities have been much extended (http://wiiflash.bytearray.org/?p=66). The goal of the SensorBar is to get a relation of the user to the output device (e.g. monitor, tv or even projector). The motion sensors only allow to detect changes but the IR sensors give a center of reference to the position (with some math you are also able to measure the distance).

@ dougi: Our project G-Nero (http://www.g-nero.com/index.php/preview) is an online 3D modeling application based on Papervision3D. You can even find the VirtualMouse classes inside the core of PV3D - they also use it since 2.0. There are two things that have to be setup to make sure that interactivity is possible. 1) materials got an attribute called "interactive" that has to be set "true", 2) you have to add the event listeners. These can be added via the InteractiveSceneManager of a ViewPort.

Hope this helps!
2008-04-16 10:09:21 | url

dougi said:

 
Thanks for your response. I agree with u but it does not work. Essentially, here is what i have made.

viewport = new Viewport3D(0,0,true, true);
....
stage.addEventListener(Event.ENTER_FRAME, loop);
...
var bitmapMaterial:BitmapMaterial = new BitmapMaterial( new ImageClass().bitmapData );
bitmapMaterial.interactive = true;
bitmapMaterial.doubleSided = true;

plane = new Plane(bitmapMaterial, 1000, 1000, 4, 4);
plane.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, onPress);
scene.addChild(plane);
...

private function onPress(event:InteractiveScene3DEvent):void
{
Alert.show("Pefect! po3D was cliked. ");
}

private function loop():void
{
// newx&newy are calculated from my wiimote new location
cursor.x = newx; cursor.y=newy;
ism.virtualMouse.setLocation(newx, newy);
...
}

// my wiimote button handlers
private function bPressHandler(event:ButtonEvent):void
{
ism.virtualMouse.press();
}

private function bReleaseHandler(event:ButtonEvent):void
{
ism.virtualMouse.release();
}

I have also noticed that a button inside an alertbox is captured with senocular virtualMouse but not with the virtualMouse provided with pv3d. A mix of the two is perhaps needed.

have u any idea?
2008-04-16 11:00:27

anthony said:

 
thanks for your answer...
Do you think that we can reprogam the vibrator and speaker of Wiimote??In fact i would developp this in order to allows my applications to be more fun!!!
2008-04-16 13:24:08

erik said:

 
@dougi: I try to build an example which has interactivity on objects with PV3D.

@ anthony: I think WiiFlash has it in it to be the "standard" for Wiimote and Flash communication. Joa and Thibault did an outstanding job on that. It wouldn't be that good to see all as many solutions as we currently got with tweening/animation systems. It is hard enough right now for developers to choose the best tweening engine but the WiiFlash server is handed out to the users. So I think it would be very bad to force the user to download many different "Wiimote Flash communication servers". I would prefer to try to join the WiiFlash team on Google Code or submit a feature request at least. I also would like to see a support for the internal speaker of the Wiimote. I already found an article which is very interesting and shows the complete binary data sequences (http://wiihacks.blogspot.com/2...ation.html).
2008-04-16 13:51:28 | url

anthony said:

 
Thanks for your answer erik..
.Even if I don't speak and understand English verry well, I sense to your ideas and outlines...I known the article who explain the complete binary data sequences but such as i'm french i haven't understood 100% of this article
2008-04-16 14:19:20

dougi said:

 
thank you Erik.

@Anthony. You can find helpful informations about wiimote/sensorbar and as3 developpment on this website http://udon.nudoru.com/.
2008-04-16 14:22:07

anthony said:

 
Thanks dougi.
2008-04-16 14:39:20

erik said:

 
@ anthony: smilies/wink.gif It's also not that easy for me to explain my thoughts in English because I'm from Germany. I think it would be much more efficient to support or join the WiiFlash team and extend the project with such fantastic ideas like Sound, etc. Because the WiiFlash server is handed out to end-users it would be easier for developers to point them to this single project instead of having the choice between many different solutions (e.g. better install 1 Flash Player instead of choosing between 20 different versions/projects). The guys from WiiFlash got a lot of work to do but maybe it is possible to join their team.

btw I failed to get v0.4 (also failed with any version higher then 2.0) working with my system so one of the primary goal of WiiFlash should be a stable and guaranteed connectivity on different os (Windows, Mac & Linux). Hopefully Thibault will have some time to fix that smilies/tongue.gif
2008-04-16 14:43:54 | url

anthony said:

 
Thanks erik...Don't be afraid, I understand the outlines, it's the principal....I'll join Wiiflash team in order to explain my ideas...Have you any adress for me please???
2008-04-16 15:02:06

anthony said:

 
Good Morning everybody.
I'm enjoy to explain you that I've found script wich permit to control vibration and sound of Wiimote with analogic panel...Now I'm ready to work on my project (Wiimote Lex(Flash)) with WiiFlash Server.
2008-04-17 09:58:29

dougi said:

 
can u make me know the url of the site. Thanks
2008-04-17 13:17:52

anthony said:

 
Hello...http://www.wiidows.fr/cariboost1/crbst_6.html this is the adress...download glove pie with differents scripts wich I spoke yesterday....Now I have to adapt with flex....smilies/wink.gif
2008-04-17 14:51:16

dougi said:

 
Hi Erik,
have u find some time to build an example with some interactivity on PV3D objects ?
Thanks anymore.
2008-05-06 08:37:02

erik said:

 
Hi dougi,

sorry... I had to finish a project but it's done right now and I post an example with a new article the within the next few days. Thanks for the notice.
2008-05-07 09:06:41 | url

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley

security image
Write the displayed characters


busy
 
< Prev   Next >

Polls

Which data exchange technology do you prefer?