cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.13k stars 7.05k forks source link

cocos2d-js editBox.touchDownAction is not function #16438

Open raksa opened 8 years ago

raksa commented 8 years ago

Steps to Reproduce:

  1. i want make the editbox is automatically be focus and open keyboard (in mobile device)
  2. try method touchDownAction

var editBox = new cc.EditBox(...);

editBox.touchDownAction(editBox, cc.CONTROL_EVENT_TOUCH_UP_INSIDE);

it not work on Web browser

in mobile device show error message "editBox.touchDownAction is not function"

pandamicro commented 8 years ago

Hi, touchDownAction have been added in latest version, but unfortunately, it's empty implemented, the reason is that we simply can't open the keyboard automatically without user interaction, it's forbidden by most browsers. It's by design and I don't think it's possible to have a walk around here.

ref: https://www.quora.com/Mobile-Safari-iPhone-or-iPad-with-JavaScript-how-can-I-launch-the-on-screen-keyboard

raksa commented 8 years ago

because i see in some game eg. Clash of Clans, they use this technique to make input chat more interactive. just click on a button and then keyboard opening with input box i just want to make my game like so and currently i'm testing on Android phone