如何将按钮光标更改为手动

How to change button cursor to hand?

本文关键字:光标 按钮      更新时间:2023-09-26

我正在使用此代码创建按钮:

var button = game.add.button(0, 0, "background", this.buttonClick, this, 2, 1, 0);

创建后按钮有光标指针。之后,在中间我需要禁用按钮,所以我添加这行:

button.input.enabled = false;

在最后,为了再次启用按钮,我添加了这一行:

button.input.enabled = true;

按钮在这里启用,我可以点击它,但光标是指针,而不是手。

试图用这条线解决问题,但没有成功:

button.useHandCursor = true;

如何解决?

我现在意识到我必须使用:

button.input.useHandCursor = true;

而不是

button.useHandCursor = true;