Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Multiple mouse cursor objects - is this possible?

Community Beginner ,
Dec 15, 2020 Dec 15, 2020

Is it possible to create different mouse cursor objects on separate frames within one scene? I want to have at least 3 different objects to serve as the mouse cursor depending on what is happening in the frame. I want to swap out the "greendot1" for different artwork and I found that swapping out the instance name alone does not work with the active buttons in the movieclip. Can I do this? If so, how..?

 

stop();
stage.addChild(greendot1);
greendot1.mouseEnabled = false;
greendot1.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor_5);
function fl_CustomMouseCursor_5(event:Event)
{
            greendot1.x = stage.mouseX;
            greendot1.y = stage.mouseY;
}
Mouse.show();

272
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 16, 2020 Dec 16, 2020

yes, you can even use different "cursors" (more appropriately, moveiclips behaving as cursors) in the same frame if you wanted.

 

but for different cursors on different frames:

 

frame "cursor1":

stop();

// you may need to remove the other "cursors" depending on your possible navigations
stage.addChild(greendot1);
greendot1.mouseEnabled = false;
greendot1.addEventListener(Event.ENTER_FRAME, gd1F);
function gd1F(event:Event)
{
            greendot1.x = stage.mouseX;
            greendot1.y = stage.mouseY;
}

Mouse.hide();

 

frame "cursor2":

stop();

if(greendot1.stage){

stage.removeChild(greendot1);

}

// you may need to remove the other "cursors" depending on your possible navigations
stage.addChild(greendot2);
greendot2.mouseEnabled = false;
greendot2.addEventListener(Event.ENTER_FRAME, gd2F);
function gd2F(event:Event)
{
            greendot2.x = stage.mouseX;
            greendot2.y = stage.mouseY;
}

Mouse.hide();

 

frame "cursor3":

stop();

if(greendot2.stage){

stage.removeChild(greendot2);

}

// you may need to remove the other "cursors" depending on your possible navigations
stage.addChild(greendot3);
greendot3.mouseEnabled = false;
greendot3.addEventListener(Event.ENTER_FRAME, gd3F);
function gd3F(event:Event)
{
            greendot3.x = stage.mouseX;
            greendot3.y = stage.mouseY;
}

Mouse.hide();

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 16, 2020 Dec 16, 2020

Thank you so much kglad, I will try that! 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 16, 2020 Dec 16, 2020
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines