5 Replies Latest reply on Jun 26, 2009 7:13 AM by Ned Murphy

    Dynamic text issue




      I've got a minor issue i'm sure but i cant work it out.

      I've got an input text box with some font styling and a var of "nameInput".

      I also on another frame have a dynamic text box with the var "nameOutput".


      if i use:    "trace (nameInput);"


      I get the following in the output:

      <TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="18" COLOR="#CC0000" LETTERSPACING="0" KERNING="0">Whatever I Write in the Input</FONT></P></TEXTFORMAT>

      I use...:


      onEnterFrame = function () {

      nameOutput = nameInput;



      ...to display the text... and that brings up the above text with the styling as well.



      Which i dont want... I just need the actual writing... not the styling.
      eg: Whatever I Write in the Input
      Any ideas of how i filter out the stuff that i don't want?


        • 1. Re: Dynamic text issue
          Ned Murphy Adobe Community Professional & MVP

          Your best bet is to avoid using the variable feature of textfields and assign to/read from them using an instance name with the text property.  The problem you are having will be fixed going that route.  I'd recommend forgetting that the variable option of textfields even exists and always use the instance name / property approach.

          • 2. Re: Dynamic text issue
            Yakamazi Level 1

            Cheers for the quick reply Ned


            So in this case i should give them instance names of "nameInput" and "nameOutput"


            and in the actions layer write something like:


            _root.nameInput = ""; for input




            _root.nameOutput = _root.nameInput; for output?


            This is all guess work :S



            • 3. Re: Dynamic text issue
              Ned Murphy Adobe Community Professional & MVP

              You use the text property in all cases (it may seem like extra work, but it's a reliable method compared to the var route)...


              _root.nameInput.text = ""; for input




              _root.nameOutput.text = _root.nameInpu.textt; for output



              Another thing you might want to avoid is constantly using the _root as a targeting mechanism.  It may get you into trouble later in life if you try importing files.  If you don't need to use it, don't use it.  If you are in the _root timeline, you don't need to use it.  And if you are in a child movieclip, and want to talk to the parent timeline, you are safer to use _parent instead of _root.

              • 4. Re: Dynamic text issue
                Yakamazi Level 1

                It's not liking it too much at the mo


                The empty input field brings up:    _level0.nameInput    in the output after i use a trace (nameInput);

                and when i fill it in and hit the enter button to move to the next load of frames the trace (nameInput); brings up undefined.


                I'm thinking that if i was doing this right, it should say undefined first, and then give me the name i type in when i hit the button...


                My button uses the following code:




                if(nameInput.text != ""){





                } else {



                • 5. Re: Dynamic text issue
                  Ned Murphy Adobe Community Professional & MVP

                  As I just said... if you want the text of the textfield, use the text property


                  trace (nameInput.text);


                  You probably need to familiarize yourself with objects in general and their various attributes... primarily their properties, methods, and events... all objects (classes)  have them.  Understanding this is key to understanding actionscript.  If you look up the textfield class in the help documents, you will find all of the properties, methods, and events that are associated with them.  These are what you use to both interact with them and acquire information from them.