Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.


AS3: VirtualMouse class

Posted June 30, 2007 by senocular

Yesterday I started (and today I finished) a little class that lets you create a virtual mouse in Flash ActionScript 3. This mouse, when moved around the screen, will trigger mouse events that would otherwise originate from the actual mouse controlled by the user.

Example and download
It's not perfect. Interactions requiring dragging won't work correctly because the virtual mouse cannot intercept references to mouseX and mouseY, but you could program an application with the virtual mouse in mind to know which references to use when (the stage/display object's or the virtual mouse's).

It does best with basic interactive object interaction such as rollovers and clicks - and nothing needs to be changed for the virtual mouse to work those kinds of interactions.