8 years ago
I decided to learn how to use WiiFlash after seeing the WiiSpray and a number of other videos a while ago. Turns out it is surprisingly easy! The only problem I had was trying to get a MovieClip to move around the stage as a mouse… I couldn’t find anything anywhere that clearly expained how to do this. Then I found that you can access the raw point data from the sensor bar through properties such as:
wiimote.p1.x; // x position between 0 and 1
wiimote.point1; // Point object with x and y values
So below is what I came up with. Very simple although with no smoothing but it still seems to work pretty good. (I hope it works because I am writing this from memory!)
var myWiimote:wiimote = new wiimote();
//note: Box is a symbol in the library
var box:Box = new Box();
//my x values were reversed so I multiplyed it by negative stageWidth and then
//subtracted from normal stageWidth to get a value on stage.
Box.x = stage.stageWidth – (myWiimote.p1.x * stage.stageWidth;
Box.y = myWiimote.p1.y * stage.stageHeight;
The main problem that I came across was Flash getting (i think) confused between the two points on the sensor bar, so I covered up one of the LEDs and it worked great.
Soon I will post up an example if a simple Wiimote Grafitti app I made, inspired by WiiSpray.