13 Replies Latest reply on Feb 7, 2007 6:23 AM by newmfa

    text box

    newmfa Level 1
      Hi all,
      in next dir movie .. http://www.geocities.com/newmfa/mov01.dir

      I put button called "A" and empty text box as you can see..and put a code for next action:
      when I click button A, the program write letter A on text box..
      I do that easily, but I can't repeat that every click..!
      can someone help me..?

      newmfa
        • 1. Re: text box
          budgiebird
          try
          on MouseDown
          put "A" after member("TextFieldName")
          end
          • 2. Re: text box
            Level 7
            1) It is best to not just let your movie loop. You should stop the play
            head where you want the user to interact with the program. On any frame
            in the area of your sprites, put this into a frame script:

            on exitFrame
            go to the frame
            end

            That way it will stop and wait for instructions. Your way (without the
            frame script) will work in Director, but will not work once you publish
            the movie as a projector or shockwave, since those will not loop back to
            the start unless you tell it to.

            2) You have the script called "text" on the A button twice. That will
            make things happen twice. Click on the button once to select it, go to
            the Behaviour Inspector, and remove one instance of the script, leaving
            only one there.

            3) The reason that you are always setting the text to "A" instead of
            adding an A at the end is because your script explicitly sets the text
            member's .text property to "A". If you want to add an A to the end of
            the text, then change the "text" script to this:

            on mouseUp (me)
            apText = "A"
            pMem = member("text4input", 1) -- here!
            pMem.text = pMem.text&apText
            end
            • 3. Re: text box
              newmfa Level 1
              thanks for your cares and efforts, problem fixed.
              is it easy to make the text input field limited by 10 letters only?

              regards
              newmfa
              • 4. Re: text box
                James Newton, ACP Level 3
                on mouseDown -- since that is the event suggested earlier
                vMember = member("TextFieldName")
                vText = vMember.text
                if the number of chars of vText < 10 then
                put "A" after vText
                vMember.text = vText
                end if
                end
                • 5. Re: text box
                  newmfa Level 1
                  OK.. well
                  I tried make button for deleting the text input field i used next code..

                  on MouseDown
                  vMember = member("text4input")
                  vText = vMember.text
                  clear.text = vText
                  end

                  but I got error said "operator expected"
                  • 6. Re: text box
                    Level 7
                    To clear it, you would do this:

                    on MouseDown
                    vMember = member("text4input")
                    vText = ""
                    vMember.text = vText
                    end
                    • 7. Re: text box
                      newmfa Level 1
                      if there is font cast memeber called "font", how attach it to text box to write
                      with this font and all its formats ..?

                      newmfa
                      • 8. Re: text box
                        Level 7
                        Typically, when you embed a font into Director, it gets the font name
                        with an asterisk at the end. For instance, if you embed "Arial", it
                        will be called "Arial *". Of course you could rename it to "font" if
                        you wish, but that makes things confusing. Anyway, whatever the name
                        is, just click on the text sprite and go to the text inspector and
                        change the font to the embedded one.

                        To change it with Lingo, you can user the member's .font property.

                        sprite(3).member.font="font"
                        member("someTextMember")="font"
                        • 9. Re: text box
                          newmfa Level 1

                          if I change my font in text inspector, is this font merged in director and can run
                          on any PC without missing..or I must merged it as cast member..?
                          • 10. Re: text box
                            Level 7
                            In order to embed the font into your program, you need to go to Insert,
                            Media Element, Font... Then choose the font you wish to embed and pick
                            the appropriate options on the screen that comes up. Then it will be
                            available in the Text Inspector for use in your text members. If you
                            have already created the text members, then you will need to apply this
                            new embedded font to each member that needs it.
                            • 11. Re: text box
                              newmfa Level 1

                              now, I can write different letters in text box with different buttons,
                              is there in lingo code read what I write in text box..like this event:

                              when I click button named "OK", if in text box letters "BBB"
                              go to frame "GOOD" else go to frame "WRONG"

                              regards..
                              newmfa
                              • 12. Re: text box
                                Level 7
                                put this script onto the OK button:

                                on mouseUp me
                                if member("text4Input").text="BBB" then
                                go "GOOD"
                                else
                                go "WRONG"
                                end if
                                end
                                • 13. Re: text box
                                  newmfa Level 1

                                  in next code ..

                                  on MouseDown
                                  vMember = member("text4input")
                                  vText = vMember.text
                                  if the number of chars of vText < 10 then
                                  put "A" after vText
                                  vMember.text = vText
                                  end if
                                  end

                                  is it possible to make next event:

                                  "if it is first letter in text box type it CAPITAL letter else small letters"

                                  thanks..
                                  newmfa