6 Replies Latest reply on Jan 4, 2010 2:41 PM by Anne Tuohy

    Input fields

    Anne Tuohy
      I am using a blank textfield to input information, I am using an if /else statement which works fine. But I set up another blank text field to do the  same the process does not work properly you have to input the write word twice before it works properly this is the code I am using and I have this code  on the sprite. on keydown   if the key = return or the key = enter then     moveon   else     pass   end if end on moveon me   if member("input").text = "house" then         member (155).font = "terminal"     member ("input").text = "well done!"     sound (1). play(member("VO WELL DONE"))        else         member (155).font = "terminal"     member ("input").text = "try again"         sound (1). play(member("VO TRY AGAIN"))        end if end
        • 1. Re: Input fields
          robdillon Most Valuable Participant

          If I'm reading this correctly, I think that the problem is that you have two instances of a behavior and both of those are testing the text in a cast member. Keep in mind that cast member's, and particularly the content of a text member, is a global object in Director. Cast members and their content are always available to the movie. This means that if you input text in one frame and then test the content of that text member in another frame, you may not be getting the result that you expect. To try and solve this you might want to use two input text members.

          1 person found this helpful
          • 2. Re: Input fields
            Anne Tuohy Level 1

            Hi Rob, thanks for your rerply, It makes sense alright, but I am using 2 seperate input fields. I have discovered what is causing the problem .

             

            After the user types into the inputfield and moves on to a different frame, I have set the input field to an empty string and this is what is causing the problem. I have tried setting the input field to an empty string in a movie script and on individual sprites and the first right answer is not excepted.I have to type in the right answer twice to get get a right response. I am actually using three seperate input fields in total, each with a different name and behavior. Even If I use one input field I still have the same problem. Its driving me crazey. Any Ideas.

             

            Anne

            • 3. Re: Input fields
              robdillon Most Valuable Participant

              Without seeing the behavior code I'm just guessing but... From your description, It sounds like you are setting a variable's value to the text of the input field before there is anything in the field. Check the order of the steps in your code and be sure that you aren't testing an empty field.

              1 person found this helpful
              • 4. Re: Input fields
                Anne Tuohy Level 1

                Hi Rob, thanks again for that. It is a bit difficult to explain.

                This is the if/else statement I have on the text input cast

                 

                on keydown

                  if the key = return or the key = enter then

                    moveon

                  else

                    pass

                  end if

                end

                 

                on moveon me

                  if member("input").text = "house" then

                    member(155).font = "terminal"

                    member ("OUTPUT").text = "well done!"

                    sound(1). play(member("VO WELL DONE"))

                  else

                    member(155).font = "terminal"

                    member ("OUTPUT").text = "try again"

                    sound(1). play(member("VO TRY AGAIN")) 

                  end if

                end

                 

                This is the lingo I am using: set the text of member(23) = " " .

                You see what I am doing is interactive so it may not always be in sequence. The frame in question has three buttonl/links from the page. I tried what you suggested and I am still getting the same problem. I have put it on all three together and individually but same result. I even tried using an  input field instead of text field. When I put the above behavior on a sprite, I have to type the right answer 2 or 3 times before it accepts it, when I take it off ,it accepts the right answer immediately and the if/else statement works fine There is no logic to it, it should work or not at all. I have an assignment to hand in for next Friday so this is really taking up so much time for such a small thing.

                 

                Anne

                • 5. Re: Input fields
                  Sean_Wilson Adobe Community Professional

                  Would you mind not creating new threads and sticking to one of your existing ones until the problem is resolved - it makes it very difficult to try and follow when a completely new thread refers to something you started elsewhere.

                   

                  If your file is small, can you attach it so that someone can have a look and see if there's something simple you're doing wrong? It's impossible to tell which sprite/member the code you posted is attached to, and how members 23, 155, "input" and "OUTPUT" relate to it

                  • 6. Re: Input fields
                    Anne Tuohy Level 1

                    Sorry about that, Sean  I am not too familiar with forums. I have attached the director file. I took out a huge chunk as it was too large. As you will see I am using 4 text fields, three for input and one for the out.

                    The 1st field is called input and its is no 23

                    The 2nd field is called input Horse and its is no 24

                    The 3rd field is called input Hay and its is no 31

                    The 4th field is called OUTPUT and its is no 155. There is no problem setting this field to empty string(Obviously), but if I set any of the others,I have a problem,

                    This the code that is causing the problem. set the text of member(23)  = " ". it`s the same for 24 or 31

                    I don’t have it on at the moment.

                     

                    Thanks a lot

                     

                    Anne