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

Part III - Setting up the Flash Movie to work on your server

Basic Theory and Necessary Changes for the Flash Movie

The first thing the Flash movie does is load the variables contained in the text file that you have already uploaded.  In this example the actionscript for doing that is located in one of the first frames of the movie.  Here is the example code: 

loadVariablesNum ("http://www.snowvids.com/PerlTut/Ex2TextFile.txt?Ran="+random(999), 0);

You will have to change this in the Fla (It's clearly marked when you open it up) to the url path where the text file is located on Your server.  In the example movie this Frame ActionScript is located on frame number 10 in the first layer.  After you have changed this in the example Fla you can run it on your server and it will load the default values in the text file into your movie.  One not on the above ActionScript - Notice the ?Ran="+random(999) portion, this just adds a random number onto the end of the text file so that the browser loads a new file each time, ie it's not in the cache.  The default values are shown below.

Title=Default Title&Contact=jfhill1@aol.com&About=About Default&News=Default News&
Products=Default Products&Link=http://www.snowvids.com

In the movie there are dynamic text fields with variable names corresponding to what you see in the text file.  For example the text field named "Title" will have the value "Default Title" when you load the variables from the text file and so on.  If this part is not working you don't have the url path set correctly.  This part will work independent of the Perl Script. 

Edit / Update Variable Values

There is a link from the example movie to this part of the movie.  In most cases however you will not want everyone editing your movie.  You can avoid this by either making it a secret spot within the movie, have this area password protected or make the Edit/Update part of the example into it's own movie - that only you know the path to.  The last way is probably the best and easiest way. 

The update/Edit area contains the same text fields with the same name as the 1st part, with the exception that they are now input fields instead of dynamic fields.  

You only need one button to update/Edit the text file.  This button contains the ActionScript

on (release) {
loadVariablesNum ("http://www.snowvids.com/cgi-bin/UpdateVars.cgi", 0, "POST");
Status = "Updating Variables - Please Wait till you see the Update Success Message";
gotoAndPlay (35);

You need to change the url Path to the url path to "UpdateVars.cgi" on your server.  This will execute the cgi file and update your text file.  The Status variable is just something extra I put in to tell the user when the update process begines.  The cgi file will pass back a variable to tell you when it's Complete.

» 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.