02.02.2013 Views

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 14: Quizzes<br />

the query string. The recordset is made using the SQL query ‘SELECT * FROM’ the table<br />

‘Quiz’ ‘WHERE category=’ the value of the variable category. Then we create a string from<br />

the records <strong>to</strong> pass back <strong>to</strong> <strong>Flash</strong>. The value of the columns in a record can be accessed using<br />

‘Fields.Item(x)’ where ‘x’ is the number of the column. To set up the string suitable for <strong>Flash</strong><br />

the variable data must be in the MIME-encoded form of variable name equals variable value<br />

connecting each assignment pair with the ampersand character. To move through the records in<br />

the recordset object use the ‘moveNext’ method. So that <strong>Flash</strong> knows how many records have<br />

been sent, the value of the variable ‘questionTotal’ is added <strong>to</strong> the string and a ‘loaded=1’ value<br />

so that <strong>Flash</strong> knows that the data has been passed. An alternative method for passing data is <strong>to</strong><br />

use the ‘LoadVars’ object which has something called a call back function, <strong>to</strong> inform the program<br />

when the data has been correctly received. You will learn more about the ‘LoadVars’ object in<br />

Chapter 19.<br />

1 <br />

2<br />

3 <br />

15 <br />

16

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!