azerion / phaser-input

Adds input boxes to Phaser like CanvasInput, but also works for WebGL and Mobile, made for Phaser only.
MIT License
203 stars 64 forks source link

The cursor does not appear #16

Closed as573991874 closed 8 years ago

as573991874 commented 8 years ago

The cursor does not appear,Because update function are not performed, so i code like this, "this.game.time.events.loop(Phaser.Timer.SECOND/3, this.update, this);", it is right?

ghost commented 8 years ago

Agree, no cursor for me. need docs on this.

AleBles commented 8 years ago

Without any code example on how you add the input to the game I'm gonna asume here you are using a custom object, and the addChild method to add the InputField to the game, because in a situation like this, it is indeed possible that update is not called.

This is, however, default Phaser behaviour as stated in the Phaser docs

as573991874 commented 8 years ago

@AleBles i see phaser docs about this: Remember if this Game Object has any children you should call update on those too.

my code: this._password = game.make.inputField(395, 1190, { font: '50px Arial', fill: '#FFFFFF', cursorColor : '#FFFFFF', fillAlpha: 0, width: 600, height : 80, placeHolder: '请输入登录密码', placeHolderColor: '#999999', textAlign: 'left', focusOutOnEnter:true, type: Fabrique.InputType.password }); c.addChild(this._password);

so, i must call this._password.update() ? or use game.add.existing(this._password);

AleBles commented 8 years ago

Ideally, in the update function of your custom Phaser object, you call this._password.update()

as573991874 commented 8 years ago

@AleBles thanks, it's work;

leach-chen commented 2 years ago

should add update,then the cursor will show update() { this.input_account.update() }