Skip to main content
Inspiring
October 23, 2019
Question

Converting old Flash to Animate HTML5. Is SendAndLoad available?

  • October 23, 2019
  • 2 replies
  • 471 views

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.

This topic has been closed for replies.

2 replies

GmRAuthor
Inspiring
October 23, 2019

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.

kglad
Community Expert
Community Expert
October 23, 2019

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-javascript

GmRAuthor
Inspiring
October 23, 2019

Ok thanks a lot. I'm not much of a programmer, but I'll see what I can do.

kglad
Community Expert
Community Expert
October 23, 2019

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-first-ajax-request

GmRAuthor
Inspiring
October 23, 2019

Thansk kglad, I'll have a look at that.