FlagTest

FlagTest is used within an ActionSet element to conditionally control execution of that actionset.

Flags are set within other event handlers using the SetFlag action. Flags are scoped within the parent Package container.

Attribute Description
Flag The unique identifier of the flag. These IDs are scoped within the Package container.
Test The test to apply to the flag value. Valid values are "IsTrue", and "IsFalse". If a flag has not been assigned a value, it is assumed to be false.

The example is a Block that contains a multiple choice question. If the user clicks the Option button during the playback of correct choice (between 45 and 53 seconds in the audio track), the "CorrectChoice" flag will record that they answered correctly. The OnFinish event handler will tell them whether they answered correctly.

<File Href="question23.mp3" Class="Question">
     <OnStart>
          <ActionSet>
                <SetFlag Flag="CorrectChoice" Value="false"/>
          </ActionSet>
     </OnStart>
     <OnFinish>
           <ActionSet>
                  <FlagTest Flag="CorrectChoice" Test="IsTrue"/>
                  <PushStack>
                        <Location Class="Question" Target="Next"/>
                  </PushStack>
                  <Goto>
                        <Location Ref="YouAreCorrect"/>
                  </Goto>
           </ActionSet>
           <ActionSet>
                  <PushStack>
                        <Location Class="Question" Target="Next"/>
                  </PushStack>
                  <Goto>
                        <Location Ref="ImSorryThatIsNotCorrect"/>
                  </Goto>
            </ActionSet>
     </OnFinish>
     <Block Offset="45000" Length="8000">
          <OnButton Button="Option1" Action="Release">
                <ActionSet>
                     <SetFlag Flag="CorrectChoice" Value="true"/>
                </ActionSet>
          <OnButton>
     </Block>
</File>