Skip to main content
Participant
September 11, 2013
Answered

How to make an input text for user to type name in?

  • September 11, 2013
  • 1 reply
  • 598 views

I'm making a game in which the user can type their name, and later in the game it'll say something like:

"Oh, Kaitlyn, how was your day?" But all I really know how to do is make it so the name will appear but NOT be in an actually sentence. The problem with that is the spacing and punctuation. I tried following a tutorial which gave me this to put in the actionscript for the output box:

output_txt.text = "Hello "+myText+"!";

Here's the tutorial:

http://www.danfergusdesign.com/classfiles/oldClasses/VCB331-richMedia1/exercises/inputOutputText.php

I think it's because it's for as3 that it doesn't work, but I'm kinda new to flash and it doesn't seem too difficult. Please give very discriptive instructions.

This topic has been closed for replies.
Correct answer Ned Murphy

What you show will work in AS2 as well as AS3.  Have you assigned an instance name to the textfield (it shows as ' output_txt ' in your example)?  Instance names are assigned by selecting the object on the stage and entering the name in the Properties panel.

You need to store the name that the user enters into a variable.  This can be done a couple different ways.  Do you have something in place for that?

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
September 12, 2013

What you show will work in AS2 as well as AS3.  Have you assigned an instance name to the textfield (it shows as ' output_txt ' in your example)?  Instance names are assigned by selecting the object on the stage and entering the name in the Properties panel.

You need to store the name that the user enters into a variable.  This can be done a couple different ways.  Do you have something in place for that?