Jump to content

text field


Recommended Posts

Hi I'm trying to put a small text field that the player can type text into and them submit the the text. I've seen so may complicated ( over my head ) ways to do this but I was hoping for a simple solution. Just need to click on a box and be able to type in it, then cluck "subScore".

this.subScore = game.add.sprite(this.game.world.centerX + 150, this.game.world.centerY + 100, 'subScore');
      this.subScore.anchor.setTo(0.5, 0.5);    

    // Enable input on the subScore button
    this.subScore.inputEnabled = true;
    // Attach a function to the input down ( click/tap)
    this.subScore.events.onInputDown.add(function() {

      var name = "";
      var score = "";
      $.ajax (

          data:{name:name, score:score},
            if (result === "success"){
              alert ('yes');
            } else {
              alert ('no');

    }, this);

 full repo: https://github.com/craftycal/vaultage


thank you in advance for you help.

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...