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(  ))##FORM.name#.so" 
   output="#FORM.data#" 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(  ))##URL.name#.so" 
     variable="data">
<cfoutput>#data#</cfoutput>

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:

#initclip

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

Get Actionscript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.