mike chambers | about

Finding more info on the CF object in ServerSide ActionScript

Friday, May 10, 2002

Joey Lott sent the following information to me.

When using ServerSide ActionScript there is an object available called CF with includes methods to make database queries and http requests. However, it also contains a number of other properties and methods which are undocumented, but could prove to be useful. Remember though, use undocumented features at your own risk as they may be changed or removed in future versions of the product.

Below is some code that shows how to find all of the properties and methods of the CF object on the server.

First create a file called Names.asr in the */wwwroot/com/test* directory and add the following code:

function getCF()
{
	var cfStuff = "";
	for(i in CF)
 	{
		cfStuff += i + "\n";
	}
	return cfStuff;
}

Next, create a new Flash movie and add the following code:

#include "NetServices.as"
var o = new Object();
o.onResult = function(data)
{
	trace(data);
}

var gwURL = "http://localhost:8500/flashservices/gateway";
var gw = NetServices.createGatewayConnection(gwURL);
var names = gw.getService("com.test.Names", this);
names.getCF();

Test your movie, and you should see the following output in your Output window:

removeAttribute
include
getSession
servletContext
page
setAttribute
request
response
toString
initialize
wait
getClass
exception
http
hashCode
popBody
getAttributeNamesInScope
pushBody
getException
class
notify
getRequest
getAttributesScope
release
equals
getPage
getOut
session
getAttribute
getServletConfig
forward
servletConfig
out
findAttribute
notifyAll
handlePageException
getServletContext
query
getAttribute
getServletConfig
forward
servletConfig
out
findAttribute
notifyAll
handlePageException
getServletContext
query
getResponse

Pretty cool, heh? If you find some good uses for some of the properties, post them in the comments. Thanks again to Joey Lott who figured this out.

twitter github flickr behance