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

mouse pointer

Explorer ,
Jun 02, 2021 Jun 02, 2021

how can i change the mouse pointer to movie clip or to object from the labrary?

596
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

correct answers 1 Correct answer

Community Expert , Jun 02, 2021 Jun 02, 2021

Here is a suggestion:

 

stage.mouseMoveHandler = function()
{
	stage.customCursor.x = stage.mouseX / stage.scaleX;
	stage.customCursor.y = stage.mouseY / stage.scaleY;
};

stage.canvas.style.cursor = "none";
stage.mouseMoveOutside = true;

stage.customCursor = new lib.YourLibSymbol(); // YourLibSymbol is the symbol's linkage name in the Library
stage.customCursor.mouseEnabled = false;
stage.addChild(stage.customCursor);

stage.on("stagemousemove", stage.mouseMoveHandler);
stage.mouseMoveHandler(
...
Translate
Community Expert ,
Jun 02, 2021 Jun 02, 2021

Hi.

 

HTML5 or AS3?

 

Regards,

JC

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
Explorer ,
Jun 02, 2021 Jun 02, 2021

html5

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 ,
Jun 02, 2021 Jun 02, 2021

Here is a suggestion:

 

stage.mouseMoveHandler = function()
{
	stage.customCursor.x = stage.mouseX / stage.scaleX;
	stage.customCursor.y = stage.mouseY / stage.scaleY;
};

stage.canvas.style.cursor = "none";
stage.mouseMoveOutside = true;

stage.customCursor = new lib.YourLibSymbol(); // YourLibSymbol is the symbol's linkage name in the Library
stage.customCursor.mouseEnabled = false;
stage.addChild(stage.customCursor);

stage.on("stagemousemove", stage.mouseMoveHandler);
stage.mouseMoveHandler();

 

 

Regards,

JC

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
Explorer ,
Jun 03, 2021 Jun 03, 2021

thank you

how i can back to the regular mouse? 

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 ,
Jun 03, 2021 Jun 03, 2021
LATEST

Hi again.

 

Please try this:

 

stage.enableCustomCursor = function()
{
	stage.canvas.style.cursor = "none";

	stage.customCursor = new lib.YourLibSymbol();
	stage.customCursor.mouseEnabled = false;
	stage.addChild(stage.customCursor);

	stage.mouseMove = stage.on("stagemousemove", stage.mouseMoveHandler);
	stage.mouseMoveHandler();
};

stage.disableCustomCursor = function() // call this method when a frame starts, in a mouse event or whenever you want
{
	stage.canvas.style.cursor = "default";

	stage.removeChild(stage.customCursor);
	stage.customCursor._off = true;
	stage.customCursor = null;		

	stage.off("stagemousemove", stage.mouseMove);
};

stage.mouseMoveHandler = function()
{
	stage.customCursor.x = stage.mouseX / stage.scaleX;
	stage.customCursor.y = stage.mouseY / stage.scaleY;
};

stage.mouseMoveOutside = true;
stage.enableCustomCursor();

 

 

Regards,

JC

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