7 Replies Latest reply on Aug 1, 2006 7:40 AM by javichampagne

    Loading results of answers

    javichampagne
      Hello pal!

      Maybe you can help me with this issue:

      I have a lot of different questions for a test made in Flash 8, each one in a separate swf file. After going through all the test I need one file to display the results of my choices, showing the percent of good answers that I've had.

      I know that I need to store the variable in one external file and after that; the final swf will load this...

      But the problem is that I don't really know how to do this, my AS is very basic. I will REALLY appreciate if you know how to make this or previous experience in similar subject. Many thanks!
        • 1. Loading results of answers
          Level 1
          Hi,

          you dont have to store the variable in one external file. Just store it on the _root.

          Like put an array on your _root that will contain all the result of your questions. It can be numbers (if you want to give a note on 100%) or true/false.

          Example (i will use the number to give a 100% at the end):



          Hope it will help you!
          • 2. Re: Loading results of answers
            javichampagne Level 1
            Many thanks... but the problem is that I have one question per swf... so maybe storing the results in the _root will not work... right?

            As I understand, your method will only work if I use always the same swf. Please tell me if I'm wrong.
            • 3. Loading results of answers
              Level 1
              Hi,

              Youre wrong. In any swf that is loaded, the _root is always the first swf not the loaded swf. So dont worry, your data will always be accessible via the _root for any loaded swf.

              I made a mistake in my code ... the last line shoule be :

              trace("Points = " + totalPoints);
              • 4. Re: Loading results of answers
                javichampagne Level 1
                mmm... maybe I still don't understand, each swf will be completely independent to each other, I will not use loadmovie or something similar to load them.

                I'd rather prefer to do it with using an external file to store the results, maybe it will be more versatile and will have no problems in any way that I decide to use those swf. Thanks for your patience.
                • 5. Re: Loading results of answers
                  Level 1
                  Hi,

                  continu to use the loadmovie. There is no problem about it. The thing is that each swf loaded cant talk to each others if they are unload when a new one is loaded. So thats why you need to keep the results in one place that will be available for every swf.

                  When the test is complete and you load your final swf, this swf is not aware of the result of the preceding questions. But he will be able to know it by asking the _root. Once a swf is loaded, his own _root is not recognized as THE MAIN _root. The main _root is the _root of the first swf ... the one embeded in your html page.

                  So lets assume this: For each questions swf, when the user press the button to continu, you evaluate his/her answer and store in the _root the points for that question (ex: zero if false or 2 if right).Now, when test is completed, you load a final swf to show the result. When this swf is completely loaded, he ask the _root what are the results. He process those data and display them like you programed it to do.
                  • 6. Re: Loading results of answers
                    javichampagne Level 1
                    I'm making this as a part of a work and I don't know how the people who is in charge will continue developing this test, which is part of a larger work. That's why I need to make everything working by its own, without depending in the html file or main swf...

                    Loading and storing the values in an external file seemed the best to me, but many thanks anyway. I'm sure your method works OK but maybe is not appropiate for what I need now.

                    I will listen to suggestions of whoever wants to help me in some other way. Thanks a lot.
                    • 7. Re: Loading results of answers
                      javichampagne Level 1
                      Any suggestion?