0

I have to catch input from the user using cocos2d-html5. EditBox component has a glitch with zOrder. Everything that is set to be above it happens to be under it. As for the other components (TextFieldTTF, UICCTexField) - they are not visible in the layer (and/or scene) and therefore maybe were not added. Any help?

Akima
  • 121
  • 8
  • You could use an event handler, but if you need textbox-like behaviour it'd be a shame to have to reinvent the wheel.. You should really put a bug report in the issue tracker on the official cocos2d site (or in the official forums) so they can fix it. – Sebastián Vansteenkiste Aug 05 '14 at 19:17
  • I've already emailed them. They say that my issue is connected with the origin of the EditBox. It's made using DOM, not WebGL. Glitches appear in specific cases which I described them. So for now, let's hope that they will make a workaround for this in future releases. – Akima Aug 06 '14 at 08:52

1 Answers1

1

I have encountered similar problem like you, and I solved it by adding a function to EditBox.

setActive: function(isActive) {
    this._edTxt.style.display = (isActive ? "block" : "none");
}

When we need to add nodes above editBox, call editBox.setActive(false) and it would be under new added nodes, not editable. And remember to resume it by editBox.setActive(true) when new added nodes are removed.

swen
  • 341
  • 1
  • 9