The Flash question type allows you to use a flash movie, or any other client side technology like a Java applet, as a question. All question logic is done on the client side. The flash movie can save several types of data to closed- question and perform database queries that are specified in the XML. Database queries are explained below. General available data is:

answer
The answer field is for data that the user entered, or data that changed because of user actions.
data
The data field is for data that is different for each user, but not changing because of actions of the user. In math questions this is used to store the generated random numbers that the current user is seeing. Obviously you do not want these numbers to change for each answer attempt the user takes.
tries
The number of "tries" the user has made so far. This might not make sense for every type of interaction.
correct
Whether the current state of the users actions is considered to be a correct answer. The current state should be the data stored in the answer field, given the data stored in the data field. This field is stored, but not retrieved. On load the correctness of the state should be deducted from the loaded answer, given the loaded data.
onceCorrect
Whether the user has ever achieved a "correct" state. This field is retrieved, but not stored. The value of onceCorrect is the value of "tries" + 1, at the first time a non-zero value of "correct" is stored.

If after doing a set of interactions the state is considered to be a correct answer, then the state should still be considered to be a correct answer after leaving the question and coming back later.

Once the state is considered "correct", a post should be done with a non-zero value for the "correct" parameter. From this point on, the value of the "onceCorrect" parameter will be positive, to indicate that the student has reached a correct state at least once, even if the current state is no longer considered correct.

It is advisable to allow the student to continue exploring the interaction even after finding a correct answer. This allows the student to check feedback on possible incorrect actions and improves learning.

The page containing this question will respond to the following get/post variables:

Database queries.

In the XML database queries can be specified that can be executed by the client side object. Lets look at an example:

<database server="localhost" username="tester" password="secret" database="test">
  <query string="REPLACE INTO test (userid, data) VALUES (%d, '%s')">
    <param type="uid"/>
    <param type="remote" name="data"/>
  </query>
  <query string="SELECT * FROM test"/>
</database>

This snippet defines 2 queries, one to insert/update a record, and one to list all records. The first query, to insert/update, has two parameters. In the SQL of the query these parameters have a placeholder: %d for the first and %s for the second. The first parameter has a type of uid, meaning that the first % placeholder will be replaced with the uid of the logged in user. The second parameter is of type remote, meaning that the second % place- holder will be replaced with the content of a POST variable. The name of the variable to use is specified in the "name" attribute of the parameter.

Available placeholders are: %s for strings, %d for decimal numbers, %f for floating-point numbers and %% for the % sign itself.

Available param types are: uid for the user-id of the logged in user, uname for the user-name of the logged in user and remote for POST vars.