Detecting mouse gestures in Flash with AS3 – Fixed

Emanuele Feronato Actionscript 3, Flash

This is the reprise of an old post about detecting mouse gestures. Since I am making a quick game for my daughter using mouse (or finger gestures), I took the old algorithm and fixed a bug which prevented to correctly detect the up-right movement. Moreover, I optimized a bit the cde to avoid small movement detection.

This is the resut, draw something in the upper left sector:

The theory is fully explained in the original post, at the moment I am optimizing the code zooming the filtered mouse movement in order to achieve more precision when the user draws tiny lines.

This is the source code:

As always you can download the source code. Next time, optimized gesture detection, plus the capability of recognizing simple shapes.

Want to learn more? Learn by example!

Get the full commented source code of an actual commercial cross platform HTML5 game!!

Comments 1

  1. Pingback: Detecting mouse gestures in Flash with AS3 – Fixed – Emanuele Feronato | eaflash

Leave a Reply

Your email address will not be published. Required fields are marked *