Skip to main content
Participant
July 13, 2013
Answered

I need help for input-dynamic text

  • July 13, 2013
  • 1 reply
  • 1022 views

I'm currently developing a game and I have a problem with my  input-dynamic text. I'm trying to make my input text appear on other frame whenever I click the button, well, I tried some solutions that I saw here but it really did not well.
This is the first code I used:

stop();

function handleClick(pEvent:MouseEvent):void {

          var myfirstVariable = box1.text;

          welcome.text = "Welcome to the game " + myfirstVariable;

          }

          enter_button.addEventListener(MouseEvent.MOUSE_UP, handleClick);

it does work but only on one frame. and this is the code that i am trying to use now:

stop();

var enteredText:String;

   welcome.addEventListener(Event.CHANGE, updateString);

   function updateString(evt:Event){

       enteredText = welcome.text;

   }

   enter_button.addEventListener(MouseEvent.MOUSE_UP, handleClick);

and on the other frame:

stop();

enteredText = welcome_2.text;

thank you very much for the help ^^

This topic has been closed for replies.
Correct answer kglad

if you change frames and have another textfield on that new frame, you need to assign its text property:

//enteredText = welcome_2.text; <-comment out this line and use:

welcome_2.text=enteredText;

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
July 13, 2013

if you change frames and have another textfield on that new frame, you need to assign its text property:

//enteredText = welcome_2.text; <-comment out this line and use:

welcome_2.text=enteredText;

Participant
July 13, 2013

oh i see. thank you very much! and another thing, I always get this undefined property enteredText on the other frame. Is it the source of the problem? since the input text is still not showing on the dynamic textbox.

kglad
Community Expert
Community Expert
July 13, 2013

are you seeing an error message?  if yes, copy and paste it after ticking file>publish settings>permit debugging. 

also copy and paste the code in the other frame and indicate the line of code mentioned in the error message.