11 Replies Latest reply on Oct 20, 2009 10:57 AM by Ned Murphy

    Input, Dynamic text boxes with different formatting?

    Andymc7 Level 1

      I have a simple problem: I need some input text to read the same in both a dynamic and input text field, but I need the input text field to be left-aligned with a smaller font size than the dynamic text field. I tried left-aligining the input text field in Flash, and it just converted it back when I tested the movie.  I have given both fields the same variable. How can I accomplish this? Thanks for any reply...

        • 1. Re: Input, Dynamic text boxes with different formatting?
          Ned Murphy Adobe Community Professional & MVP

          The first thing I'll recommend is that you get away from using the var properties of the textfields.  To have the text in one be the text in the other, assign it via the text property. Here is a link to a posting that was somewhat similar to what you asking about. Read thru it so you realize any differences.  At the end is a sample file you can download.

           

          http://forums.adobe.com/thread/508103?tstart=0

           

          You should be able to set and retain the textfield properties if you keep them as distinct/unrelated textfields.

          1 person found this helpful
          • 2. Re: Input, Dynamic text boxes with different formatting?
            Andymc7 Level 1

            Ok, I'm sure you can tell what I'm doing wrong. For a little more info,.. I'm making a Jeopardy game, and I'm making input boxes so the "host" can edit the game content/questions if he/she desires. I have an edit screen, and what I'm trying to do is simply have my 1st category input text correspond with my 1st category box on the game board. What I have below gives me an "undefined" reading on my gameboard, after I type in a category name on my edit screen. Hope this makes sense.

             

            _root.Cat1.text = String(_root.Cat1_input.text);

             

            As I've said, I simply want the two text boxes to match, but each maintain their own formatting.

            • 3. Re: Input, Dynamic text boxes with different formatting?
              Ned Murphy Adobe Community Professional & MVP

              If those textfields reside on the same timeline as that code, then the first thing to do is get rid of the _root references.  Unnecessary _root references are best avoided.  The following line of code should suffice, unless the code is not in the _root timeline.

               

              Cat1.text = Cat1_input.text;

               

              The only thing I can imagine is wrong is that you do not have the instance names assigned.  First, be sure you eliminated the var assignments in the properties panel, then make sure you entered the instance names, Cat1 and Cat1_input, in the appropriate field of the properties panel for each textfield.

              1 person found this helpful
              • 4. Re: Input, Dynamic text boxes with different formatting?
                Andymc7 Level 1

                Ok, this is just silly. I've checked over everything at least 10 times, and I'm not sure what's going on. If I paste the line of code you showed me, I still get "undefined" in the gameboard box. Gosh, how hard can this be?? I must say, for graphic designers like myself, Actionscript can be extremely frustrating at times. I really appreciate your help up to this point though, Ned.

                • 5. Re: Input, Dynamic text boxes with different formatting?
                  Ned Murphy Adobe Community Professional & MVP

                  I don't think actionscript is the issue to solve at the moment.  Are those two textfields on the same timeline, or are they inside separate objects, like one is inside one movieclip and the other in another?  Would it be possible for you to take a screenshot showing the properties panel while Cat1 is selected on the stage?

                  • 6. Re: Input, Dynamic text boxes with different formatting?
                    Andymc7 Level 1

                    Yes, the two textfields are on the same timeline. I have a separate layer called "actions". I'm placing this line of code where the playhead lines up with the "edit screen" layer (this won't show in the screenshot,.. I deleted it for the time being.. trying another method).

                     

                     

                    http://farm3.static.flickr.com/2795/4026652715_9477b7d8ae_o.jpg

                    • 7. Re: Input, Dynamic text boxes with different formatting?
                      Ned Murphy Adobe Community Professional & MVP

                      Where is the Cat1_input in that image?

                       

                      I don't have CS4, so I'm a little curious as to why the layer you have selected has a gray dot rather than a black dot.  Is that something that changes to black if you select another layer?

                      • 8. Re: Input, Dynamic text boxes with different formatting?
                        Andymc7 Level 1

                        This screenshot actually doesn't show the extra layer I added, where the Cat1_input text field is. Simply, I put Cat1_input in a new set of frames, in a separate layer called "Edit Screen". I'm actually starting to have second thoughts about the "user-friendliness" of an edit screen in the game, as players would have to sit and wait for the host to edit all the questions and catagories... still,... I need to know this process of matching text fields.. because I also am using in other areas of my project (team name text fields, for one.)

                         

                        As for the layer having a grey dot.. yes, it changes back to black when not selected.

                         

                        Again, I have the exact same problem with matching text fields with my team names. I have small scoring buttons on each of the money amount squares that I use to give either Team A, or Team B,.. the proper score, based on the square chosen. I would like if these text fields corresponded with my team names on the main stage, but of course they are in separate movie clips. I've tried many different methods to target these.. but of course.. I can't even get two text fields on the main timeline to work to begin with! . So, sorry for a long post.. but basically, I'm struggling with input and dynamic text fields in general.

                        • 9. Re: Input, Dynamic text boxes with different formatting?
                          Ned Murphy Adobe Community Professional & MVP

                          It makes total sense that Cat1_input is undefined if it isn't there.  There is no problem with the code... it appears the implementation is the issue, but you aren't able to display it.  If you looked at the file in the post I pointed you to earlier, you will have seen two textfields, one being assigned the text of the other.

                          • 10. Re: Input, Dynamic text boxes with different formatting?
                            Andymc7 Level 1

                            Yeah, I understand that their needs to be two separate text fields present, and that's what I previously had before I changed it. Your code you posted works for me now.... However, I've come accross something interesting with input and dynamic text fields...

                             

                            At least for me, the dynamic text field properly updates when I change the input text ONLY IF I place my code on the same layer and frame as my two text fields. So, The line of code you gave me does not work if I put it in my "actions" layer..(??).. Is this normal? Do I have to make sure from now on that I place all actions on the exact layer and frame as my textfields? If so, then how could I ever target, say, a text field on the main timeline, to a text field in a movie clip??

                            • 11. Re: Input, Dynamic text boxes with different formatting?
                              Ned Murphy Adobe Community Professional & MVP

                              Code does not have to go on the same layers as objects.  When code is trying to target objects, they need to be in the presence of the code.  So if that picture you showed is at all relevant to your design approach, it shows that you do not have the input textfield in the presence of the code, so it cannot be read to assign it to the other textfield.  If the input textfield and the other textfield are not both present when the code executes, it won't work.

                              1 person found this helpful