Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript CreateJS对象可见性_Javascript_Html5 Canvas_Createjs - Fatal编程技术网

Javascript CreateJS对象可见性

Javascript CreateJS对象可见性,javascript,html5-canvas,createjs,Javascript,Html5 Canvas,Createjs,我希望有人能帮忙 我在CreateJS中有一个游戏运行良好,为暂停按钮添加了功能,也运行良好,除了暂停按钮不可见,但我的所有其他对象都是:(如果我单击我知道暂停按钮的位置,则功能正常,但我就是看不到按钮 下面的代码:一旦点击我的角色,它就会进入函数pauseGame(这正在工作,暂停游戏)。这应该会使pause.visible=true。我想可能是这样,因为如果我点击暂停(我知道它存在的坐标),游戏会重新启动(进入函数startGame),问题是当我单击暂停游戏时,它会暂停,但我看不到我的按钮,

我希望有人能帮忙

我在CreateJS中有一个游戏运行良好,为暂停按钮添加了功能,也运行良好,除了暂停按钮不可见,但我的所有其他对象都是:(如果我单击我知道暂停按钮的位置,则功能正常,但我就是看不到按钮

下面的代码:一旦点击我的角色,它就会进入函数pauseGame(这正在工作,暂停游戏)。这应该会使pause.visible=true。我想可能是这样,因为如果我点击暂停(我知道它存在的坐标),游戏会重新启动(进入函数startGame),问题是当我单击暂停游戏时,它会暂停,但我看不到我的按钮,上面写着“游戏暂停,单击此处继续游戏”,但如果我单击它,游戏会重新启动。这是与zindex放置有关,还是其他原因导致对象不可见

function pauseGame(event) 
{
   if(exportRoot.gameOver.visible == false) 
   {
exportRoot.pause.visible = true;
    console.log("Pausing");
    inPlay = false;
    }
}
function startGame(event) 
{
   if (exportRoot.gameOver.visible == false) 
   {
    inPlay = true;
    exportRoot.pause.visible = false;
}
}

您应该检查的几件事:

- Opacity, just try: console.log(exportRoot.pause.alpha); if it's not 1, something might be wrong.
- Visibility: console.log(exportRoot.pause.visible), if false, something is wrong.
- last thing: try addChild(exportRoot.pause) to see if the button is under some other element.