Internet Commerce

Partners & Affiliates

Developer Channel


Featured Flash FLA
Gallery Downloads 11401 Flash Movies | 5 New Flash Movies Added
What's New | Top 100

Featured FLA

»  Author: Nick Kouvaris
»  Title: Znax
»  Description: Znax is a board game. Click 4 tiles of the same color and form squares as big as you can. You will erase all the tiles inside the square and collect points. Get maximum score if you make a square with game edges.
»  More by: Nick Kouvaris


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 4941 Flash Sites | 1 New Flash Links
What's New | Top 100 Flash Site

Featured Site

»  Author Agence WOP Digital Agency
»  Title: Electricdrum
»  Description: French WOP Agency, 3D websites, Flash (Papervision, Away 3D), event or institutional projects. The agency operates on all digital projects: consulting, design, graphic design, development, online communication. The WOP agency follows you on the implementation of original, creative and optimized digital projects.


Random Links | Add your own Flash Related Links
Flash Tutorials 1481 Tutorials 7 New Tutorials Added!
What's New | Top100

» How To Make A Simple Animation Using Christmas Clips
» Simple Step by step flash game tutorial Spot the diffrence
» How To Make A Moving Text Slide
» Create Flash Banner With Text Float Effect
» How To Make Zoo Photos Slideshow
» How To Make A Dolphin Photos Slideshow
» How To Make A Fathers Day Slideshow
» How To Make A Transparent Background of Your Flash File
» Create Flash Banner With Text Disco Light Effect Today we will introduce you a Text Disco Light eff
» Unknown Tag: Title10
Random Tutorial | Add Site


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Backend

Categories Loading variables from a text field and Editing/Updating the values via Perl
Author: Jeffrey F. Hill | Website: http://www.snowvids.com |

 
Page 3
«prev 1 2 3 4 5 6 next»

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.

«prev 1 2 3 4 5 6 next»

» Level Intermediate

Added: : 2001-07-13
Rating: 8.67 Votes: 96
Hits: 3902
» Author
No details available.
» Download
Download the files used in this tutorial.
Download (19 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments