Is it possible to set the mouse position programatically?

Posted on 2005-04-26
Last Modified: 2006-11-18
I would like to be able to set the mouse to a specific location on a button click.  Is that possible?  
Question by:dtburdick
    LVL 27

    Accepted Solution

    Simply, (and this is good), no. You can create a fake mouse pointer, hiding the real one, and move it to a specific location, but you cannot change in any way the real mouse position.

    For example:

    var mc = this.attachMovie("fakePointer", "cursor", 10000);
    mc.onMouseMove = function()
          this._x = _root._xmouse;
          this._y = _root._ymouse;
    yourButton.onRelease = function()
          delete mc.onMouseMove;
          mc._x = yourlocationX;
          mc._y = yourlocationY;

    Author Comment


    Thanks.  Now I have to use my brain.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Suggested Solutions

    Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
    In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
    In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
    The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now