ted).
//Frame10
If (cookies eq "true")
Set Variable: "cookietest" = "Cookies can be set"
Stop
Else
Set Variable: "cookietest" = "Cookies not allowed. Please enable."
Go to and Stop ("nocookies")
End If
In Frame 10 a different message is displayed in the status field depending on the result of the cookie
test.
If cookies are not accepted, Flash jumps to the label 'nocookies', stops there and will not accept any
input but another cookie test. In the if-condition cookies eq "true" is set in quotes as the server does
not really return the boolean values of true or false, but a string which is immediately tested as such.
Also note that the string comparison requires 'eq' instead of '='.
The 'stop' command forces Flash to wait for a click event of the 'SEND DATA' button. Sending the cookie
data to the server happens as follows:
//Frame11, Label step2
Load Variables ("/setcookies.asp?cookiename="&name&"&"&
"cookiemail="&email&"&"&"cookietelephone="&telephone, 0)
In this script, a query string containing the user entries is sent to the file ' setcookies.asp'. For the
composition of the query string, refer to the article 'Data Exchange between ASP and Flash' (German only).
//Frame19, Label step3
Load Variables ("/getcookies.asp", 0)
The data read from a cookie by ASP is loaded into the Flash file.
//Frame 28
Stop
The loaded data is displayed in the text fields after a short animation of a line.
//Frame 35, Label nocookies
stop
If the test in frame 10 determines that no cookies are allowed, the Flash time line branches to this frame
and the user has the opportunity to perform another test.
The Scripts of the ASP files
The 3 files testcookies.asp, setcookies.asp and getcookies.asp are called by Flash for the following
actions: Checking whether the browser accepts cookies (testcookies.asp), setting cookies (setcookies.asp),
reading cookies(getcookies.asp).
Checking whether the browser accepts cookies
The file testcookies.asp checks whether the browser permits cookies. The technique is the same as in the
article "Simple Browser Cookie Test" (German only). The variation of this script used here is as follows:
<%
strTest = Request.QueryString("CookieTest")
If UCase(strTest) <> Ucase("true") Then
' First call
' Set session variable
Session("__FlashCookieTest") = True
' Redirect with QueryString
strURL = Request.ServerVariables("SCRIPT_NAME")
strQueryString = "?CookieTest=true"
Response.Redirect(strURL & strQueryString)
Response.End
Else
' Redirect already happened
//Frame10
If (cookies eq "true")
Set Variable: "cookietest" = "Cookies can be set"
Stop
Else
Set Variable: "cookietest" = "Cookies not allowed. Please enable."
Go to and Stop ("nocookies")
End If
In Frame 10 a different message is displayed in the status field depending on the result of the cookie
test.
If cookies are not accepted, Flash jumps to the label 'nocookies', stops there and will not accept any
input but another cookie test. In the if-condition cookies eq "true" is set in quotes as the server does
not really return the boolean values of true or false, but a string which is immediately tested as such.
Also note that the string comparison requires 'eq' instead of '='.
The 'stop' command forces Flash to wait for a click event of the 'SEND DATA' button. Sending the cookie
data to the server happens as follows:
//Frame11, Label step2
Load Variables ("/setcookies.asp?cookiename="&name&"&"&
"cookiemail="&email&"&"&"cookietelephone="&telephone, 0)
In this script, a query string containing the user entries is sent to the file ' setcookies.asp'. For the
composition of the query string, refer to the article 'Data Exchange between ASP and Flash' (German only).
//Frame19, Label step3
Load Variables ("/getcookies.asp", 0)
The data read from a cookie by ASP is loaded into the Flash file.
//Frame 28
Stop
The loaded data is displayed in the text fields after a short animation of a line.
//Frame 35, Label nocookies
stop
If the test in frame 10 determines that no cookies are allowed, the Flash time line branches to this frame
and the user has the opportunity to perform another test.
The Scripts of the ASP files
The 3 files testcookies.asp, setcookies.asp and getcookies.asp are called by Flash for the following
actions: Checking whether the browser accepts cookies (testcookies.asp), setting cookies (setcookies.asp),
reading cookies(getcookies.asp).
Checking whether the browser accepts cookies
The file testcookies.asp checks whether the browser permits cookies. The technique is the same as in the
article "Simple Browser Cookie Test" (German only). The variation of this script used here is as follows:
<%
strTest = Request.QueryString("CookieTest")
If UCase(strTest) <> Ucase("true") Then
' First call
' Set session variable
Session("__FlashCookieTest") = True
' Redirect with QueryString
strURL = Request.ServerVariables("SCRIPT_NAME")
strQueryString = "?CookieTest=true"
Response.Redirect(strURL & strQueryString)
Response.End
Else
' Redirect already happened
| 对此文章发表了评论 |
