First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Jeffrey F. Hill | Website: http://www.snowvids.com

Line 1 - The first line contained in the script is called the shebang line.  You will notice that it has a # symbol followed by a ! symbol.  All other occurrences of the # symbol indicates a comment in a perl script.  The first line is a special case though.  It indicates the Path to a program on the server which can execute the script - Do not indent this or put it anywhere else other then the first line.  The program in most cases is something like Perl.exe.  Don't worry about that part though. Just make sure that the path is correct.  The most common path to perl is #!/usr/bin/perl On different types and different setups of servers it may be different however.  If your using an online host they should have the path to perl listed in their online documentation.  Change this line to reflect that path.

Line 3 - of the code includes the library file "subparseform.lib" into the context of the script.  All that is listed in this file is one subroutine that parses the incoming data.  You will never have to make any changes to the subparseform.lib file - It will work for any variable you can think of.  

Line 4 - Just includes a subroutine from the "subparseform.lib" file.  There is only one subroutine in this file. You can include as many others though, and use them in the script in the same fashion.  As your scripts become more complex this is an easy way to keep track of everything.  

Lines 6 to 11 - This just puts the incoming variables from the Flash movie into a form that you can work with.  It uses a function from the included "Parse_Form" subroutine.  Don't worry about this part it works - If you want more or less variables just use the same syntax and it'll work.

Line 13 -  This collects the variables and enters them into an array.  The most important thing to realize is the format their in.  They have to be listed as - FlashVariableName1=Value1&FlashVariableName2=Value2 etc. Flash can only read variables in from a text file when their in this format.  For this example it is really not necessary to enter the variable string into an Array.  You can accomplish the same thing later in the script by just printing the string to the log.  The only advantage of putting them into an array is that if the script gets more complex later on this is an easier method.

Line 15 - Opens up a log File for writing to.  This is indicated by the > symbol (If you just want to read from the log file use the < symbol or if you want to append to the data already in the text file use the >> symbol).  The path contained on this line is the most important thing you'll have to change.  This has to be the absolute path to the text file you wish to load the variables from in Flash and also to edit/update.  The easiest way to find the absolute path to the file on your server is to look at the path displayed when you use an ftp program like ws_ftp or CuteFTP and ftp to the directory in where you text file is located.

Line 16 - Prints out the variable string entered in the array to the text file.  This writes over the existing data. Basically after you've opened up the log file (in this case the text file) for writing it just prints out the new data over the existing.

Line 17 - Closes the Log.

Lines 19 and 20 - Prints out a success message which is read by the Flash movie when the script is done executing.

Lines 22 to 25 - This is just an error message that you will get if the script was unable to open the Text file for writing to.  Just an easy way to check to see if the scripts working.

» Level Intermediate

Added: 2001-07-13
Rating: 8.77 Votes: 99
(10 being the highest)
» Author
No details available.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.