1 Replies - 4688 Views - Last Post: 06 August 2013 - 02:09 PM

#1 Sanye   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-June 13

Problem showing a variable in text box

Posted 27 June 2013 - 05:19 PM

I'm new with flash, and want to make a simple text based game. I created a input text box for the player choose the name of the character and store it in a variable called "nametxt", in the next page I created a dinamyc text box with the instance name "text001" and want it to show a text with the name stored in the variable, something like this "So, your name is (name), right?". I used this code:

text001.text= " So, your name is " + String(nametxt) + ", right?"

And, when I test it, the text appears like this: So, your name is <TEXTFORMAT LEADING="2"><PALIGN="CENTER"><FONT FACE="Traditional Arabic" SIZE="20" COLOR="#000000" LETTERSPACING="0" KERNING="0">(name)</FONT></P></TEXTFORMAT>, right?

What's the problem? Thanks in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: Problem showing a variable in text box

#2 lordofduct   User is offline

  • I'm a cheeseburger
  • member icon

Reputation: 2668
  • View blog
  • Posts: 4,786
  • Joined: 24-September 10

Re: Problem showing a variable in text box

Posted 06 August 2013 - 02:09 PM

How did you get the text out of the TextBox on the first 'page'? Cause it appears you're pulling out the format information with it. Are you by chance getting the 'htmlText' property or something?

Or is 'nametxt' a reference to the TextField itself on the first 'page'. In which case converting it to a string with 'String(nametxt)' does its own logic. That all depends on the type that is 'nametxt'. What you should be doing it storing the string text, not the entire TextField.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1