Easiest way to get a TextField in my game?


(Nate ) #1

I would like my FlashPunk game to have an input field where the player can enter their name. I am not sure how to do this. I tried using the flash.text library but am getting all sorts of errors when trying to make the text field appear on the screen. I am guessing it has something to do with Entities vs Sprites.


(David Williams) #2

FP.stage.addChild(sprite) should work.

override public function begin():void
{
    FP.stage.addChild(TextBox);
}
override public function end():void
{
    FP.stage.removeChild(TextBox);
}

(Nate ) #3

Nice that worked great! Thank you!


(Nate ) #4

How do I go about getting the information from the textfield now? I am currently trying to set the textfield.text value to another name.text value and it is not letting me do so.


(Nate ) #5

Nevermind I think I figured it out!