7 Replies Latest reply on Sep 18, 2006 7:24 AM by Newsgroup_User

    Loading Variables from Text file

    Level 7
      I am workin in a quiz that i will load the questions from variables in a
      text file and i have passed this mission.
      The problem is that i have input txt fields in my movie that the user will
      put answers and i want to compare these answers with variables in a txt file
      too :) is that valid and how can i please anybody reply me sooooon

      Thank you


        • 1. Re: Loading Variables from Text file
          kglad Adobe Community Professional & MVP
          you can use the flash string methods to compare the variables/values from your text file with the text property of your textfields.
          • 2. Re: Loading Variables from Text file
            Level 7
            How Please give me an example

            "kglad" <webforumsuser@macromedia.com> wrote in message
            news:eejo0m$4sd$1@forums.macromedia.com...
            > you can use the flash string methods to compare the variables/values from
            > your text file with the text property of your textfields.


            • 3. Re: Loading Variables from Text file
              kglad Adobe Community Professional & MVP
              if you use a LoadVars() object with instance name yourLV and if your text file contains variables/values like:

              &answer1=this is the answer to the first question&
              &answer2=this is the answer to the2ndquestion&
              etc

              you can use something like:


              • 4. Re: Loading Variables from Text file
                Level 7
                ok this my situation and try to help me simpler than this
                i have 3 input test fields named
                name_txt , emailTxt , phonetxt.

                and i have a text file named "question.txt" at the same folder.
                i have three dynamic textfields that load &ques1 , &ques2 and &ques3
                and i want to do the following:
                i want to compare between the answers the user input and the answers at the
                txt file &answer1,&answer2 and &answer3.

                For example:
                _root.submit_btn.onRelease = function(){
                if ( _root.nametxt.text = = My variable ????){
                gotoAndPlay(2);
                } else{
                gotoAndPlay(3);
                }
                }

                Please help me that way and thank you for your efforts in advance
                "kglad" <webforumsuser@macromedia.com> wrote in message
                news:eejr3e$82f$1@forums.macromedia.com...
                > if you use a LoadVars() object with instance name yourLV and if your text
                > file
                > contains variables/values like:
                >
                > &answer1=this is the answer to the first question&
                > &answer2=this is the answer to the2ndquestion&
                > etc
                >
                > you can use something like:
                >
                >
                >
                >
                > function checkAnswersF(questionNumber,tf){ // questionNumber is the
                > question
                > number, tf is the input textfield that should contain the answer to the
                > question
                > if(yourLV["answer"+questionNumber].indexOf(tf.text.toLowerCase())){
                > trace("answer is correct");
                > } else {
                > trace("incorrect");
                > }
                > }
                >
                >


                • 5. Re: Loading Variables from Text file
                  kglad Adobe Community Professional & MVP
                  what code do you use to load your text file's variables/values and what answer (1,2 or 3) do you want to text against when your submit_btn is released?
                  • 6. Re: Loading Variables from Text file
                    Level 7
                    The Code is


                    _root.loadVariables("ques.txt");
                    and my input txts named as following
                    name_txt
                    email_txt
                    phone_txt

                    and the text file ques.txt read as following:

                    &firstQ=What is your name?
                    &secondQ=What is your email?
                    &thirdQ=What is your mobile number?
                    &answer1=Essam
                    &answer2= my email
                    &answer3=0124613121

                    and i want to make a condition to compare between text input in the
                    name_txt,email_txt and phone_txt and &answer1, &answer2 , &answer3 and
                    that if ok gotoAndStop(where the next ques is) ;
                    Thank you Kglad

                    "kglad" <webforumsuser@macromedia.com> wrote in message
                    news:eek0b7$dni$1@forums.macromedia.com...
                    > what code do you use to load your text file's variables/values and what
                    > answer (1,2 or 3) do you want to text against when your submit_btn is
                    > released?
                    >


                    • 7. Re: Loading Variables from Text file
                      Level 7
                      Can any body Help
                      "Essam Maccar" <essam_maccar@hotmail.com> wrote in message
                      news:eek17l$eic$1@forums.macromedia.com...
                      > The Code is
                      >
                      >
                      > _root.loadVariables("ques.txt");
                      > and my input txts named as following
                      > name_txt
                      > email_txt
                      > phone_txt
                      >
                      > and the text file ques.txt read as following:
                      >
                      > &firstQ=What is your name?
                      > &secondQ=What is your email?
                      > &thirdQ=What is your mobile number?
                      > &answer1=Essam
                      > &answer2= my email
                      > &answer3=0124613121
                      >
                      > and i want to make a condition to compare between text input in the
                      > name_txt,email_txt and phone_txt and &answer1, &answer2 , &answer3 and
                      > that if ok gotoAndStop(where the next ques is) ;
                      > Thank you Kglad
                      >
                      > "kglad" <webforumsuser@macromedia.com> wrote in message
                      > news:eek0b7$dni$1@forums.macromedia.com...
                      >> what code do you use to load your text file's variables/values and what
                      >> answer (1,2 or 3) do you want to text against when your submit_btn is
                      >> released?
                      >>
                      >
                      >