WiiFlash Tip #1 – A virtual Wii-mouse

I’ve been doing a lot of really cool stuff with WiiFlash at the Bank – but I can’t really share any of the code. So, to help any aspiring WiiFlash developers out there, I’ll post a few tips over time with things that would have helped me out. If you don’t know anything about WiiFlash, take a look at their site, it’s a pretty cool hack. Now that I’ve got a good working class system, I just want to sit around and create mini-games.  I wish that I had the free time!

Tip #1 -Using the Wii Controller as a mouse in Flash

The toughest problem that I’ve come across so far: “how do you use the controller as a mouse (click on buttons) in a Flash movie without relying on WiiFlash’s crappy mousemode?”The “mousemode” feature takes over control of the system mouse pointer and uses the controller to point and click. I didn’t want this – I just wanted a nice Flash sprite moving around and still allow the user to click on things with their real mouse. But I wasn’t quite sure how to have this sprite fire off mouse events.

Solution: Senocular’s VirtualMouse class.

Once you’ve figured out how to read the IR points from a sensor bar (a future tip), and have a pointer moving around the screen, just set your virtual mouse instance’s X and Y values to the same as the pointer sprite. Trap the A button press event to fire off a virtual mouse CLICK event and that’s it! Well, I guess there are a few details to fill in still – but you get the general idea. Get it working properly and you can interact with your movie/game with the mouse and the Wii controller.

TweenLite.to(speedTweeningBliss);

I can’t believe that I hadn’t heard about this tweening engine before! Originally, I was using the Boostworthy system, but that was a pain the ass for the simple animations that I needed. I started Ramen using Tweener and was pretty happy. Steven Sacks mentioned TweenLite in the Flash Tiger list and I took a look at it. It was faster than Tweener and shaved 8k off of my file sizes! Sweet!

Ramen, take 2

Ok, now I really mean that I’m going to learn AS3! In November, I started to work in a new web site framework, in AS3, as a practice exercise. I’m also trying to do it right, picking up a few design patterns along the way.

The main player is about 35k. All graphics and fonts (except for the opening preloader) are external. The content is driven from XML files and each page is it’s own reusable SWF template.

It’s got a few predefined design aids – text boxes, images, FLV player, hot spots, a transition system and event an event system for controlling other items on the page.

There is still a lot of work to do, mainly around sound – but it’s shaping up pretty nicely!

RAMEN.nudoru Player