Chapter 11. Server-Side ActionScript (SSAS)

Server-side ActionScript (SSAS) is just like Macromedia Flash ActionScript except it exists on the server. Just as Flash ActionScript is based on the ECMAScript-262 specification, SSAS also uses the standard as a foundation. SSAS closely follows the implementation of Server-Side JavaScript 1.5 (SSJS) used by the SunONE Server and the Netscape Enterprise Server. You will find it interesting to review more about SSJS presented in Netscape's Developer pages ( SSAS does not include the SSJS LiveWire objects used for direct database access, nor does it include the object to connect to email server and the file system. This was done to ensure SSAS's security model was tight. SSAS cannot access the file system or database server directly. SSAS can handle databases and external servers through Flash Remoting MX and compatible application servers. Flash Remoting MX will be discussed in detail in Chapter 13, "Accessing External Data."

SSAS cannot directly control Flash elements such as MovieClips, buttons, or objects with this script. However, it can invoke methods within the Flash movie that can alter the elements of the movie. SSAS acts like a facilitator between multiple Flash movies and other servers. SSAS is the communication hub. You can build objects to store data, or methods to handle communication events.

There are two important things you should remember before you start working with SSAS:

  • Any change made to SSAS in ASC files requires a reload of the application.

  • SSAS is CaSe seNSitiVe, unlike its Flash MX counterpart. For example, the following two variable definitions would create two different variables:

    var myVariable = 123; 
    var MYVARIABLE = 456;

This chapter will step you through the objects available to you with SSAS including SharedObject, Stream, Application, Client, and NetConnection. You will review some SSAS that you can use for a simple authentication system using an ActionScript array. The chapter will also handle techniques you can use to help debug SSAS. Each object's methods, properties, events, and information objects are presented in the Quick Reference appendices in the back of this book.

    Part I: 10 Quick Steps for Getting Started