First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Jei Gaither | Website: http://www.eslacker.com/

As I mentioned before, a Flash movie essentially acts as a web page when reading in values from a CGI script, in our case, a text file. The way you get the values into Flash is using the Load Variables command. Let's look at how we'd read in the values from our text file.

The Action Script above would read in the values from your text file and assign those values to your text fields, or, if there aren't any text fields with the name being passed in (i.e. Name or Email), Flash would create a variable to hold the value. This can be very helpful if you want to have values that you're not ready to use until a later point in your movie. Just be sure that you can get to your variable when you need it.

Note the Tell Target ("/Variables") statement above. Using an empty Movie Clip on the main timeline to store all of your variables helps you keep track of them and will prevent values from 'disappearing' if you remove Movie Clips.

The other thing to note here is that if you're using a CGI script instead of a text file, you'd just type the path to it where you see poll.txt above. Also, at the bottom, under the Variables section, if you're just using a text file, there's no sense in sending anything to it, but if you have a CGI script, you may want to send variables to it. Your CGI script could then process these variables or kick off another action. Flash will basically send any variables that are currently in scope to the URL you've provided.

What does that mean? Well, it means that if you're on the Main Timeline and you have a handful of variables (like Name and Email in our example above), they will be sent to your CGI script. If this Load Variables is performed somewhere else, like inside a Movie Clip, then your variables on the Main Timeline will NOT be sent. Notice that the Load Variables is inside a Tell Target block.

This means that the values that are received from your CGI script will be declared on the Main Timeline. You'd then be able to refer to them anywhere else in your movie by referring to them as /name, and /email (to follow our example). In Part II of this tutorial, we'll go into much more detail on sending variables to CGI in order to save them.

» Level Advanced

Added: 2000-12-14
Rating: 8 Votes: 73
(10 being the highest)
» Author
Jei Gaither is a web developer in Austin, TX. His projects out-weigh his spare time, but he still manages to find new uses for Flash and creative interfaces.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

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