1 2 3 Previous Next 96 Replies Latest reply: Sep 2, 2012 9:42 AM by kglad Go to original post RSS
      • 40. Re: S.O.S.
        CRAAZYGENIUS

        this actionscript doesnt work at some of my buttons..i dont know why..

         

        var tl:MovieClip=this;

        vector_btn.onRelease=function(){

        tl.loadMovie("VECTOR_001.swf");

        }

        • 41. Re: S.O.S.
          kglad CommunityMVP

          use the trace function to see if that code is executing.  if it's not, check your button names.

          • 42. Re: S.O.S.
            CRAAZYGENIUS Community Member

            It's now working. it just turned out that i was putting the codes on the wrong frame. Now all i have to figure out is how to use the code you told me for the score. I don't quite get it.

            • 43. Re: S.O.S.
              kglad CommunityMVP

              add:

               

              this._parent.completeF(1)

               

              to the last frame of a question swf when answered correctly and

               

              this._parent.completeF(0)

               

              to the last frame of a question swf when answered incorrectly.

               

              and, to your main swf, add:

               

              var scoreVar:Number=0;

              completeF(scoreVar);

              // create a score dynamic textfield (say score_tf) to display your score.

               

              function completeF(n:Number):Void{

              scoreVar+=n;

              score_tf.text=scoreVar;

              }

              • 44. Re: S.O.S.
                CRAAZYGENIUS Community Member

                Ok. I'll try to apply that later. Now sir, you taught me the proper way to load external files using buttons without behaviors. Also, please teach me to make my quiz in the most systematic way. For example, when the user chooses the correct/wrong answer. How do i do the response "Correct" and "Wrong" because i want it to be animated. Like there would be lights shining when the answer is correct. Can i do that with my quiz still being systematic? And by systematic, i mean that everything is still organized. For example in question # 1 choices A B C D. The correct answer is A. When i choose letter A the screen immediately displays animated CORRECT! While choices B C and D displays animated WRONG. Will i still be able to count the scores for each subtopic this way?

                • 45. Re: S.O.S.
                  CRAAZYGENIUS Community Member

                  Also, i'm a bit confused with this.

                  add:

                   

                  this._parent.completeF(1)

                   

                  to the last frame of a question swf when answered correctly and

                   

                  this._parent.completeF(0)

                   

                  to the last frame of a question swf when answered incorrectly.


                  DOES IT MEAN THAT MY LAST FRAME SHOULD DISPLAY "CORRECT"

                   

                  if it does, then where should be my "WRONG" response be?

                   

                  OR SHOULD I CHANGE MY RESPONSE LIKE THIS:

                   

                  I will create two swfs. 1 CORRECT and 1 WRONG

                   

                  1. When i choose A it will load the external movieclip CORRECT containing this._parent.completeF(1) and

                  2. When i choose B C or D it will load the external movieclip WRONG containing

                  this._parent.completeF(0)

                  • 46. Re: S.O.S.
                    kglad CommunityMVP

                    no.

                     

                    depending on the quiz taker's response, you know whether that response is correct or incorrect.  use that to determine which value to pass to this._parent.completeF().

                    • 47. Re: S.O.S.
                      CRAAZYGENIUS Community Member

                      Will you show me how to do it sir? In an illustrative way sir. Please.

                      • 48. Re: S.O.S.
                        kglad CommunityMVP

                        explain the setup of a typical question swf.

                        • 49. Re: S.O.S.
                          CRAAZYGENIUS Community Member

                          The letters A B C and D are flash buttons. When the user clicks button A (Which is correct) the Screen will display "CORRECT!" (Which is animated too. Like with confettis.) When they answer B C or D the Screen will display "WRONG". the "CORRECT" and "WRONG" response maybe inside the question swf. or into an external movieclip (DEPENDS ON YOUR RECOMMENDATION) and on the top right corner of the screen, the word "Score" is visible for the user to see how he is doing along the quiz. When the user is done with the quiz, the final score will appear. When the user decides to take another quiz, the score goes back to zero. I hope I made it clear sir. It's hard to speak English. Hehe. I'ts ok if you have MAJOR RECOMMENDATIONS. I'LL FOLLOW THEM FOR SURE.

                          • 50. Re: S.O.S.
                            kglad CommunityMVP

                            will the wrong animation be the same for every question?

                            will the correct animation be the same for every question?

                            • 51. Re: S.O.S.
                              CRAAZYGENIUS Community Member

                              yes. so that it'll be easier.

                              • 52. Re: S.O.S.
                                kglad CommunityMVP

                                then create a wrong.swf and a correct.swf.  your scoreF can load the appropriate swf.

                                 

                                you alread have created the question swf's, true?

                                 

                                if yes, do you have something in each swf that determines what is the correct option that a user should click?

                                • 53. Re: S.O.S.
                                  CRAAZYGENIUS Community Member

                                  Yes. I already created the question swfs. It depends upon the question on what the letter of the correct answer would be.

                                   

                                  For example

                                   

                                  .........................................................Score: 0

                                   

                                  Question 1: What is the capacity to do work?

                                   

                                  A. Power                         B Energy
                                  C. Force                         D Speed

                                   

                                  The correct answer is letter B. When the user clicks the B button, it will load the Correct swf. In the correct swf is the "next" button. When the user clicks the next button. He will load question2 swf.

                                   

                                  .........................................................Score: 1

                                   

                                  Question 2: What is blah blah blah?

                                   

                                  A. Power                         B Energy

                                  C. Force                         D Speed

                                   

                                  Now when the user got all the way to question15 swf or whatever the last question swf is, the next swf that will appear will tell the final score of the user.

                                   

                                  Also please give me instructions how to use this script, where to put them EXACLTY, and what are they for?

                                   

                                  this._parent.completeF(1)

                                  this._parent.completeF(0)

                                  • 54. Re: S.O.S.
                                    kglad CommunityMVP

                                    for question1, how does flash know B is the correct choice?

                                    • 55. Re: S.O.S.
                                      CRAAZYGENIUS Community Member

                                      I don't know.

                                      • 56. Re: S.O.S.
                                        kglad CommunityMVP

                                        is there anything in question swfs that make each different other than the question, the choices and the answer?  ie,are there graphics in that differ in the different question swfs?

                                        • 57. Re: S.O.S.
                                          CRAAZYGENIUS Community Member

                                          Yes. Each question has different choices and answers. Also I forgot to mention that once a user answers a question and gets the answer, he may choose to view the explanation why it became the answer. He may choose to view the explanation or move on to the next question.

                                          • 58. Re: S.O.S.
                                            kglad CommunityMVP

                                            then you'll need to hardcode the correct answer into each question swf.

                                             

                                            if your buttons are named, A,B,C,D, you can use:

                                             

                                            for question1 swf:

                                             

                                             

                                            var correctAns:Button = B;

                                             

                                            A.onRelease=checkAnsF;

                                            B.onRelease=checkAnsF;

                                            C.onRelease=checkAnsF;

                                            D.onRelease=checkAnsF;

                                             

                                            function checkAnsF():void{

                                            if(this==correctAns){

                                            this._parent.completeF(1);

                                            // use attachMovie to display "correct.swf"

                                            } else {

                                            this._parent.completeF(0);

                                            // use attachMovie to display "wrong.swf"

                                            }

                                            }

                                            • 59. Re: S.O.S.
                                              CRAAZYGENIUS Community Member

                                              Wow. Where will i put those codes. I'll be eternally grateful to you sir.

                                              • 60. Re: S.O.S.
                                                kglad CommunityMVP

                                                attached to the first frame where those buttons exist.

                                                • 61. Re: S.O.S.
                                                  CRAAZYGENIUS Community Member

                                                  Ok sir. There is an error when i test scene. It says:

                                                   

                                                  **Error** Scene=Scene 1, layer=Layer 2, frame=1: Line 8: type

                                                  identifier is excpected after the ':'.

                                                       function checkAnsF () :void{

                                                   

                                                  Total Actionscript Errors: 1          Reported Errors: 1

                                                  • 62. Re: S.O.S.
                                                    kglad CommunityMVP

                                                    void should be Void

                                                    • 63. Re: S.O.S.
                                                      CRAAZYGENIUS Community Member

                                                      The error was gone. But nothing happens when i click the buttons.

                                                      • 64. Re: S.O.S.
                                                        kglad CommunityMVP

                                                        what's the trace function show:

                                                         

                                                        var correctAns:Button = B;

                                                         

                                                        A.onRelease=checkAnsF;

                                                        B.onRelease=checkAnsF;

                                                        C.onRelease=checkAnsF;

                                                        D.onRelease=checkAnsF;

                                                         

                                                        function checkAnsF():Void{

                                                        trace(this+" "+correctAns+" "+this._parent);

                                                        if(this==correctAns){

                                                        this._parent.completeF(1);

                                                        // use attachMovie to display "correct.swf"

                                                        } else {

                                                        this._parent.completeF(0);

                                                        // use attachMovie to display "wrong.swf"

                                                        }

                                                        }

                                                        • 65. Re: S.O.S.
                                                          CRAAZYGENIUS Community Member

                                                          What trace function? I dont know how to locate that.

                                                          • 66. Re: S.O.S.
                                                            kglad CommunityMVP

                                                            var correctAns:Button = B;

                                                             

                                                            A.onRelease=checkAnsF;

                                                            B.onRelease=checkAnsF;

                                                            C.onRelease=checkAnsF;

                                                            D.onRelease=checkAnsF;

                                                             

                                                            function checkAnsF():Void{

                                                            trace(this+" "+correctAns+" "+this._parent);

                                                            if(this==correctAns){

                                                            this._parent.completeF(1);

                                                            // use attachMovie to display "correct.swf"

                                                            } else {

                                                            this._parent.completeF(0);

                                                            // use attachMovie to display "wrong.swf"

                                                            }

                                                            }

                                                            • 67. Re: S.O.S.
                                                              CRAAZYGENIUS Community Member

                                                              What am i supposed to do with that?

                                                              • 68. Re: S.O.S.
                                                                kglad CommunityMVP

                                                                put that code in your first question swf attached to the first frame where those buttons exist.

                                                                 

                                                                then click one of your buttons in the test environment.

                                                                • 69. Re: S.O.S.
                                                                  CRAAZYGENIUS Community Member

                                                                  I did what you said. Nothing still happened.

                                                                  • 70. Re: S.O.S.
                                                                    kglad CommunityMVP

                                                                    what's this show:

                                                                     

                                                                    trace("test");

                                                                    var correctAns:Button = B;

                                                                     

                                                                    A.onRelease=checkAnsF;

                                                                    B.onRelease=checkAnsF;

                                                                    C.onRelease=checkAnsF;

                                                                    D.onRelease=checkAnsF;

                                                                     

                                                                    function checkAnsF():Void{

                                                                    trace(this+" "+correctAns+" "+this._parent);

                                                                    if(this==correctAns){

                                                                    this._parent.completeF(1);

                                                                    // use attachMovie to display "correct.swf"

                                                                    } else {

                                                                    this._parent.completeF(0);

                                                                    // use attachMovie to display "wrong.swf"

                                                                    }

                                                                    }

                                                                    • 71. Re: S.O.S.
                                                                      CRAAZYGENIUS Community Member

                                                                      what am i going to do with this?

                                                                       

                                                                      trace("test");

                                                                      • 72. Re: S.O.S.
                                                                        kglad CommunityMVP

                                                                        again

                                                                         

                                                                        put that code in your first question swf attached to the first frame where those buttons exist.

                                                                         

                                                                        then click one of your buttons in the test environment.

                                                                        • 73. Re: S.O.S.
                                                                          CRAAZYGENIUS Community Member

                                                                          Still nothing happens sir.

                                                                          • 74. Re: S.O.S.
                                                                            kglad CommunityMVP

                                                                            then that code is not executing.  ie, you're not testing the file with that code or you have not added that code to a frame that plays.

                                                                            • 75. Re: S.O.S.
                                                                              CRAAZYGENIUS Community Member

                                                                              I did. Are you sure it works on as2? Correct swf and Wrong swf are external movieclips. Not just movieclips.

                                                                              • 76. Re: S.O.S.
                                                                                kglad CommunityMVP

                                                                                at this point it doesn't matter whether they are external swfs. 

                                                                                 

                                                                                that code needs to be in the same swf as the one that contains your answer buttons.  if it were and you were testing correctly you would see trace output.

                                                                                • 77. Re: S.O.S.
                                                                                  CRAAZYGENIUS Community Member

                                                                                  I put the code in the frame where the buttons are.

                                                                                  • 78. Re: S.O.S.
                                                                                    kglad CommunityMVP

                                                                                    then if that frame played, you would see trace output.

                                                                                    • 79. Re: S.O.S.
                                                                                      CRAAZYGENIUS Community Member

                                                                                      how do i make sure of this?