Emerging Technology and the Future of Education

Download Report

Transcript Emerging Technology and the Future of Education

Flash Database Access
Passing Variables to Flash
and
Storing Flash Interaction
Results in an Access Database
Flash Database Access
Storing Flash interaction results is a fourstep process.
First, you identify the user whose results
you will be saving.
Second, you send this user to the page in
which the Flash interaction is embedded.
Third, you program the Flash interaction to
post the results to an ASP page.
Fourth, you make the ASP page receive the
results and save them in the database.
Identifying the User
FlashQuizIdentifyUser.htm
The simplest way to identify the user
is to use an HTML form to prompt for
some kind of identification, such as
an e-mail address
You save this ID in a session variable
so the browser knows who the user is.
You should also pass this ID to Flash
in order that your Flash code will
know who the user is.
Session Variable Coding
FlashQuizAskQuestions.asp
You embed the Flash movie on an ASP page upon
which you can write ASP code to receive and
forward the data from the ID form.
To save the user’s email address in a session
variable, the ASP code is:
<% Session("email_address") = Request.Form("email").Item; %>
To pass this data to the embedded Flash movie
object, you modify the object’s movie parameter as
follows:
<param name="movie" value="FlashQuiz.swf?username=
<%= Session("email_address") %>">
Posting the Quiz Results
FlashQuiz.fla
At the end of the Flash quiz, you provide
the user with a button which, when clicked,
posts the quiz results to the ASP page to
which you will take the user upon
completion of the quiz.
The format of this ActionScript is as
follows:
report_btn.onRelease = function() {
score = (iNumberCorrect / iNumberAsked) * 100;
getURL(“FlashQuizStoreResults.asp", "_self", "POST");
}
Displaying the Data
FlashQuizStoreResults.asp
On the page to which Flash posts the data,
you create a binding to Request(“score”)
and to Request(“email_address”).
Now you can use these bindings to display
the data onscreen. For example:
The result of the quiz was <%= Request("score") %> for
<%= Request(“email_address") %>
At runtime, this writes a message in the
form of:
The result of the quiz was 33% for [email protected].
Storing the Results in the DB
FlashQuizStoreResults.asp
To store the results in the database,
you create a Dreamweaver connection
to your Access database.
On the page that will store the quiz
results, you use the Application
toolbar’s Command component to
create the SQL command that will
insert the data into the database.
Configuring the SQL Command
FlashQuizStoreResults.asp
Viewing the Quiz Log
FlashQuizViewHistory.asp
On the ASP page that displays the
quiz log, you use the DW application
toolbar’s Recordset component to
create a recordset consisting of the
data in the Results table.
Then you use the DW application
toolbar’s Dynamic Table component to
display the Recordset in a table
onscreen.
Creating the Recordset
FlashQuizViewHistory.asp
Creating the Dynamic Table
FlashQuizViewHistory.asp