3 Replies Latest reply on May 24, 2007 5:25 AM by neeena

    HELP:flash questionnaire

    neeena
      Hi All.
      I'm new to Flash and am trying to create a Flash questionnaire using checkboxes. The idea is that a user has a 70 questions to answer and each question belongs to a group e.g linguistics, music etc. There are 7 groups, 10 questions in each group.
      Once the questions are completed the user clicks on the submit button to caculate scores in each group. I have created the page to display the questions and checkboxes but am having trouble on the actionscript part of the checkboxes. How do I get it to recognise whether the box is ticked or not? If it isn't then the score is 0 for that question, if it is then the score is 1 for that question.

      I have attached the code but am unsure on how to proceed. I do not know much actionscript. Any help would be appreciated Text
        • 1. Re: HELP:flash questionnaire
          michaeltowse Level 1
          First off it seems that your comparison code is actually assigning the values not checking them. Ensure all your

          if (Q2 = true){

          type stuff is

          if (Q2 == true){

          :-)
          • 2. Re: HELP:flash questionnaire
            Gorka Ludlow Level 1
            To see if a checkbox is selected you merely need to check the selected property:

            if(checkbox_instance.selected==true)
            trace('Is is selected');
            else
            trace('Is is not selected');

            Cheers
            Gorka
            • 3. Re: HELP:flash questionnaire
              neeena Level 1
              Hi Guys,
              Thanks for your help.I still can't get it to work.
              The file runs with no actionscript errors. However the code to display the results eg starting from:
              ling_result_txt.text= ling; is not calculating the correct amount of checkboxes ticked. It is set to 3 and does not reset. I don't think it is returning the value of whether the check box is ticked or not.

              This is my new code:
              stop();

              var ling:Number = 0;
              var maths:Number = 0;
              var spatial:Number = 0;
              var musical:Number = 0;
              var bodily:Number = 0;
              var interpersonal:Number = 0;
              var intrapersonal:Number = 0;




              submit_btn.onRelease == function (){




              if(Q1.selected==true){

              ling += 1;}

              if (Q2.selected==true){
              musical += 1;}


              if (Q3.selected == true){
              spatial += 1;}

              if (Q4.selected == true){
              bodily += 1;}

              if (Q5.selected == true){
              maths += 1;}

              if (Q6.selected == true){
              bodily += 1;}

              if (Q7.selected == true){
              interpersonal += 1;}

              if (Q8.selected == true){
              intrapersonal += 1;}

              if (Q9.selected == true){
              ling += 1;}

              if (Q10.selected == true){
              intrapersonal += 1;}

              if (Q11.selected == true){
              ling += 1;}

              if (Q12.selected == true){
              bodily += 1;}

              if (Q13.selected == true){
              musical += 1;}

              if (Q14.selected == true){
              spatial += 1;}

              if (Q15.selected == true){
              maths += 1;}

              if (Q16.selected == true){
              interpersonal += 1;}



              gotoAndStop (2);

              ling_result_txt.text== ling;
              maths_result_txt.text== maths;
              spatial_result_txt.text== spatial;
              musical_result_txt.text== musical;
              bodily_result_txt.text== bodily;
              interpersonal_result_txt.text== interpersonal;
              intrapersonal_result_txt.text== intrapersonal;

              }

              Thanks

              neena