3 Replies Latest reply on May 21, 2006 9:17 AM by Rothrock

    A logic question

    MikeMedia2
      When I choose the correct radioButton (data value 4.76) in all three (3) radioGroups, the return is as it should be, 14.28.

      However, if I choose an incorrect radioButton (data value 0) no subsequent correctly chosen radioButton (data value 4.76) is recognized.

      The total data value thus remains the same as it was before I chose the incorrect radioButton (data value 0)
        • 1. Re: A logic question
          Rothrock Level 5
          I'm pretty good at algebra and a fairly logical person. But I really have no idea what you are talking about.
          • 2. A logic question
            MikeMedia2 Level 1
            Okay, I do get a bit wordy.

            I've got 3 questions. Each has 4 possible answers (multiple choice).
            Only one is correct of course. When the correct one is chosen the total score incrementally increases.

            You with me so far...

            What's happening is, when I select
            the right answer on question 1,
            then the wrong answer on question 2,
            and then the right answer on question 3
            I'm only getting the total score reflected by question 1. Or whatever was the score was before I made an incorrect choice.
            • 3. Re: A logic question
              Rothrock Level 5
              I see now. That would be because that is what you have told it to do. So if you don't want it to do that…

              So read your if statements – which will be easier in the actionscript window than here in the forums. Notice the stair step layout. That is saying that each step in is part of the conditional before.

              If question one is true then do the things between the opening curly brace and its closing curly brace. So add the value to the total and proceed to the next if statement.

              At the next if statement it is false so it skips everything in its curly braces. But this means it completely skips the next if statement, because it is inside those braces.

              Now there are probably lots of ways I would implement this differently, but for your way all you need to do is change your curly bracing.

              if(condition1){
              //add to the score
              }
              if(condition2){
              //add to the score
              }
              if(condition3){
              //add to the score
              }

              Notice how when this is place into the actionscript panel it doesn't do the same stair stepping. Each if is its own thing and not dependent upon the previous condition evaluating to true.

              Totally falls under headslap-d'oh, doesn't it! But we've all been unable to see the forest for the trees at one time or tother.