Bright Hub
 
Matthew Casperson's Hubfolio

Away3D Lite Programming Tutorials - Mouse Gestures

RSS

Mouse gestures haven't made big inroads into mainstream UI design. None of the major development environments includes mouse gestures without the use of a 3rd party library, so I guess developers find them too hard to implement. Opera introduced them to its web browser a while ago, and World Of Warcraft has the ability to register mouse gestures, but apart from that I can't think of any other application that uses gestures.

For Flash developers there is a Mouse Gesture library available that makes implementing gestures a piece of cake. You simply code in a sequence of mouse movements and the library takes care of the rest. It works out the which sequence best matches the movement of the mouse and fires off an event, which the developer can respond to like it was a button click. You can see the process in the image below.

This demo uses mouse gestures to control an Away3D Lite mesh. Press the mouse button and move in any straight line up, down, left or right and then release the mouse button. The model will flip around in the direction of the movement. Then click the mouse button and draw a circle (starting from the top). The model will spin.

Registering gestures takes only 1 line of code:

mg.addGesture("CLOCK", "67012345");

You then respond to the gestures in an event listener:

switch (event.datas)

{

case "CLOCK":

TweenMax.to(mesh, 1, {rotationZ: mesh.rotationZ + 360});

break;

}

Check out the demo here, and download the source code here.

Go back to Away3D Tutorials


Written by Matthew Casperson (4,880 pts ) in Matthew Casperson Blog
Last Edited on Sep 28 2009, 05:58 PM

Tags:
 

Bright Hub - Science & Technology Articles, Buyer's Guides, How-To Tips and Software Reviews
About Bright Hub | Contact Us | Advertise with Us | Become a Writer | RSS | Site Map | Terms of Use | Privacy Policy | Copyright Policy
©2009 Bright Hub Inc. All rights reserved. Page copy protected against web site content infringement by Copyscape