Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q5825 What is Remote Scripting, and how do I use it?

You are here: irt.org | FAQ | ASP | Q5825 [ previous next ]

Remote scripting is a Microsoft technology that allows you to establish a kind-of client-server connection through an ASP page with a Java Applet.

This allows you to make calls to the server without changing the state of your HTML page (re-writing it). It makes for nicer looking web pages and also allows asyncronous calls of functions. So it's a very handy way to run long scripts without making the client wait for the page to load.

See Microsoft's scripting site at the MSDN for more information:

http://msdn.microsoft.com/scripting

The following was submitted by Rick Kelsall

ASP code can be called without the need for refreshing the page by using a transparent shockwave movie to act as a live updating link between the client & server.

This is an alternative to Remote Scripting using shockwave as the client/server go-between instead of Java.

Variables are passed in and out of a swf file embedded in the HTML of your page using the setVariable and getVariable methods of the swf object.

In the swf file you have a simple loop that waits for a flash variable (Lookup) to become set. When the Lookup variable becomes set the movie file jumps to a frame where it performs a lookup with a named ASP. This is done using the Load Variables command in Flash.

When the ASP returns it's results to the flash movie - these results can then be read the client-side javascript.

The following example takes some text from an HTML form and passes it to a server-side ASP script via en embedded SWF file. The values returned by the ASP are then read from the SWF movie with client-side javascript and used to immediately update text fields in an HTML form.

function BeginASP() {
	// send the value we want to look up to our flash transparent flash movie
	// 'moviename' should be the ID of your embedded SWF file (shown in the object tag of the HTML)
	document.moviename.setVariable("Lookup",document.form1.textfield.value);
	// start waiting for the reply
	window.setTimeout("WaitASP();",1500);
}

function WaitASP() {
	if(document.movie.getVariable("ReturnValue")!="") {
		// the flash movie has set ReturnValue to something - so the ASP has returned our results
		document.moviename.setVariable("ReturnValue","");
		// read the two variables Town & County returned by the ASP
		document.form1.Town.value=document.moviename.getVariable("Town");
		document.form1.County.value=document.moviename.getVariable("County");

	} else {
		// nothing has come back yet, keep waiting...
		window.setTimeout("WaitASP();",1500);
	}
}

©2018 Martin Webb