Copy link to clipboard
Copied
We are converting the flash areas of our website to HMTL5. Our site features instructional swf movies that require user authentication. They use the LoadVars() function to call in the session status, and also track user status by sending updates from the Flash movies.
For example,
// Submit the data to check user status
. sendData.sendAndLoad("flash_session_check.asp", replyData, "POST");
If the script does not return a success, we redirect user to new url, and also do an unloadMovie -- (is this still an option?)
How should I do this with Animate CC, in javascript? Here's some more code if that's helpful.
//-------------------------------------
// USER AUTHENTICATION VIA ASP
//-------------------------------------
// Updates Activity Log (if required) and returns UserName
sendData = new LoadVars();
replyData = new LoadVars();
function sessionActivity(str) {
// -----------------------------------------
// SEND FORM DATA TO SERVER VARIABLES
// -----------------------------------------
sendData.flashActivity = str;
// -----------------------------------------
// REPLY FROM SERVER VARIABLES
// -----------------------------------------
replyData.student = "Authenticating user...";
replyData.goFlash = "";
//
// Define a callback handler
replyData.onLoad = handleReply;
// -----------------------------------------
// SEND THE FORM
// -----------------------------------------
// Submit the data and tell the user.
sendData.sendAndLoad("session-check.asp", replyData, "POST");
// -----------------------------------------
function handleReply(success) {
if (success) {
if (replyData.goFlash != 1) {
_root.statusTxtmc.statusTxt.text = "Session Not Authenticated.";
topMessage= "Sorry, your session is not authorised";
getURL("user-not-authorised.asp", "_parent");
unloadMovie(this);
}
} else {
// go to asp error page
getURL("user-not-authorised.asp", "_parent");
topMessage= "Sorry, your session is not authenticated";
unloadMovie(this);
}
}
}
Many thanks for any help offered. I don't do much programming.
Cheers.
Copy link to clipboard
Copied
you'll need to use ajax or something similar to load data. google "javascript ajax".
here's sample code, https://openclassrooms.com/en/courses/3523261-use-javascript-in-your-web-projects/3759261-make-your-...
Copy link to clipboard
Copied
Thansk kglad, I'll have a look at that.
Copy link to clipboard
Copied
Is it possible to directly read a server session variable, such as:
var Variable = '<%= ServerVariable %>';
from within the HTML5 canvas? If so, can I also set the value of a session variable from within the Canvas?
Thanks.
Copy link to clipboard
Copied
yes.
html5/canvas uses javascript. it has some specialized javascript (createjs, https://www.createjs.com/docs/easeljs/modules/CreateJS.html) to make working in animate easier, but for stuff not included in that api, just use javascript (or, if you add jquery - my favorite), use jquery.
for example, to find session variable info, google "session variables javascript".
here's one link, https://stackoverflow.com/questions/15519454/how-to-access-session-variables-and-set-them-in-javascr...
Copy link to clipboard
Copied
Ok thanks a lot. I'm not much of a programmer, but I'll see what I can do.