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 // TheserializeObject( )anddeserializeObject( )functions are the exact same code // as theserializeObject( )anddeserializeObject( )methods of the
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access