Skip to main content
Inspiring
January 13, 2013
Answered

How to restrict the custom mouse cursor area

  • January 13, 2013
  • 2 replies
  • 941 views

Dear Friends,

i have an swf loaded in another frame, i want to show a custom cursor (hand pic). iam using the following code. its working fine in the loaded swf. when i move the mouse to the bottom of the screen that is navigation area in actual frame the cursor has to go back to flash arrow cursor.

var hide_m:Boolean = true;

stage.addEventListener(MouseEvent.MOUSE_MOVE, handmove);

function handmove(event:MouseEvent) {

    trace(mouseY);

    if (hide_m && mouseY<138) {

        Mouse.hide();

        hand.gotoAndStop(1);

        hand.x = mouseX;

        hand.y = mouseY;

    } else {

        showmouse();

    }

}

function showmouse() {

//hide hand pic and show mouse....

    hand.gotoAndStop(2);

}

it is not working, it shows the hand pic in the stage. but when i move the bottom area that is more than 138, the normal cursor is not coming back pls help me.  to restrict the area to show the custom cursor....

Thanks in advance,

Syed Abdul Rahim

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer kglad

unless there is a Mouse.show() in frame 2 of hand, that's not going to work.  to remedy, execute Mouse.show() in showmouse() and remove hand from the display list (removeChild).

use addChild() and Mouse.hide in the first conditional branch of handmove

2 replies

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
January 13, 2013

unless there is a Mouse.show() in frame 2 of hand, that's not going to work.  to remedy, execute Mouse.show() in showmouse() and remove hand from the display list (removeChild).

use addChild() and Mouse.hide in the first conditional branch of handmove

rahimhajiAuthor
Inspiring
January 16, 2013

Thks Mr.kglad, its working fine! when i click on the particular button and hide my custom mouse and show my actual mouse. its shows the computer mouse in the same place where i click, is there any way to show or move the mouse to some where else in the stage?

Thanks in advance,

Regards,

Syed Abdul Rahim