Using LoadVars and XML

The third way you can modify the scheduler application is to use server-side scripts that read and write to a file. The ColdFusion versions of these scripts are provided here in this example, but if you need to use another technology, it is not too difficult. You need two scripts: one to write data and one to read the data. The write script should take two parameters submitted via HTTP POST: the name of the file to which to write and the data to be written. Here is the ColdFusion example that you should name LoadVarsSharedObjectSave.cfm:

<cffile action="write" 
   file="#GetDirectoryFromPath(GetBaseTemplatePath(  ))" 
   output="" nameconflict="overwrite">

The other script should read the data from the file and return it to Flash. This script should accept a single parameter submitted via HTTP GET: the name of the file from which to read. Here is the ColdFusion example. You should name this file LoadVarsSharedObjectRead.cfm.

<cfsetting enablecfoutputonly="yes">
<cffile action="read" 
     file="#GetDirectoryFromPath(GetBaseTemplatePath(  ))" 

Finally, you should make a few changes to the client-side ActionScript code in the Schedule component. The relevant snippet of code from that component is shown here with changes in bold:


// The serializeObject(  ) and deserializeObject(  ) functions are the exact same code
// as the serializeObject(  ) and deserializeObject(  ) methods of the 

Get Actionscript Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.