First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Paul Price

The setup:

The first frame simply has three text fields that accept the user's input and a button that advances to a frame that has our controller clip in it. The text fields are named input0 to input2. Naming them in this way allows us to loop through them when we load their text into our array.

Arrays:

An array is a container for items. The following line lets Flash know you're creating an array:

myarray= new Array();

Items are usually placed into arrays in one of three ways: the first way simply throws the items in as the array is created, the second way loads items into the array in numerical order, and the last way loads them in numerically, but doesn't rely on your ability to count. The first way looks like this:

myarray= new Array("item","another item"," yet another item"); 

The second way looks like this:

myarray= new Array(); 
myarray[0]="item";
myarray[1]="another item";
myarray[2]=" yet another item";

The last way looks like this:

myarray=new Array();

myarray.push("item");
myarray.push("another item");
myarray.push("yet another item");
Once items are loaded into an array they can be sorted numerically or alphabetically using the the sort method.

Once items are in your array, you can manipulate them, even delete or add items on the fly, but we'll save that for another discussion. You can use loops to load items into your array. That is exactly what I did for the input-text:

messages=new Array(); 
for (c=0;c<=2;c++){ 
messages.push(_root["input"+c]);  
}
» Level Intermediate

Added: 2001-11-08
Rating: 7 Votes: 202
(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!

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.