ActionSet

The ActionSet is used within a OnButton, OnStart or OnFinish element.

ActionSet defines the set of action elements to be executed when an event occurs. Optionally the ActionSet element can also contain FlagTest which must all evaluate to *true* for the ActionSet to be executed.

If the parent OnButton, OnStart or OnFinish element contains more than one ActionSet element, the first actionset element whose FlagTest elements evaluate to *true* is executed.

Example

The following example handles the Option1 button, when it is pressed during a wrong answer. Each time the user presses the button during the wrong answer he is told that he has selected the wrong answer and is returned to the beginning of the list of answers. However, the first time the user selects the wrong answer, he receives a hint.

In this case, the first ActionSet contains a FlagTest, while the second does not. This functions similarly to an if-else, switch-case-default, or xsl:choose-xsl:when-xsl:otherwise construct.

<OnButton Button="Option1" Action="Release">
   <ActionSet>
       <FlagTest Flag="AnsweredWrongBefore" Test="IsFalse"/>
       <PushStack>
            <Location Ref="Hint"/>
            <Location Target="Beginning" Class="Answers"/>
       </PushStack>
       <SetFlag Flag="AnsweredWrongBefore" Value="True"/>
       <Goto>
             <Location Ref="WrongAnswer"/>
       </Goto>
   </ActionSet>
   <ActionSet>
       <PushStack>
            <Location Target="Beginning" Class="Answers"/>
       </PushStack>
       <Goto>
             <Location Ref="WrongAnswer"/>
       </Goto>
   </ActionSet>
</OnButton>