我的图层上有一个EditBox。
var ebox = new cc.EditBox(cc.p(200, 30));
ebox.setPosition(size.width / 2 - 50, size.height / 2);
ebox.setPlaceHolder("Password");
ebox.setInputFlag(cc.EDITBOX_INPUT_FLAG_PASSWORD);
ebox.setDelegate(this);
ebox.setFontColor({"r": 0, "g": 0, "b": 0});
ebox.setFontSize(20);
ebox.initWithBackgroundColor(cc.size(200, 30), {"r": 0, "g": 255, "b": 0});
ebox.init();
this.addChild(ebox, 1); //this - is a main layer然后我必须在主层上显示某种形式的覆盖
this.getParent().addChild(overlayLayer, 100);overlayLayer -使用颜色填充的图层
问题是editbox总是在覆盖图的上方。为什么zOrder不和EditBox合作??
发布于 2014-08-13 13:46:44
我在你的代码中遇到了同样的问题。我的解决方案是一种变通方法。您可以使用精灵作为背景。然后它就起作用了。
var ebox = cc.EditBox.create(cc.size(170, 50), cc.Scale9Sprite.create("res/extensions/green_edit.png"), cc.Scale9Sprite.create("res/extensions/orange_edit.png"));
ebox.setPlaceHolder("Password");
ebox.setInputFlag(cc.EDITBOX_INPUT_FLAG_PASSWORD);
ebox.setPosition(cc.p(size.width/2,size.height/2));
ebox.setFontColor({"r": 0, "g": 0, "b": 0});
ebox.setDelegate(this);
this.addChild(ebox,1);https://stackoverflow.com/questions/25080591
复制相似问题