Categories
Featured jobs
» More ActionScript, Flash and Flex jobs.
» Advertise a job for free
Our network
Advertisement

 »  Home  »  Tutorials  »  Flash  »  Beginner  »  Variables to hold a data

Variables to hold a data

By BAHRAMI BAHRAMI | Published 09/9/2005 | Beginner | Rating:
Page 1 of 1
Written by: BAHRAMI
Time: 15 minutes
Difficulty Level: Beginner
Requirements: Flash 4 or 5. DOWNLOAD FLA

Fill in the text boxes and press the go button

Variables are used to hold data (information).

"A variable is simply a container, a bucket if you will. However this bucket can only contain one piece of information at any one time, no matter how small or big." Derek Franklin, Author of Flash 4!

I think that the best way to get a grip of variables is to start playing with them. This tutorial is on a newbie level and shows the basics of dealing with variables. A great start if you ask me.

Step 1 - First of all make two graphic symbols and draw your characters on the first frame on each one of them. In this case I drew a girl in "symbol 1" and a boy in "symbol 2"

Step 2 - Go to your main timeline, add a keyframe at frame one and make four input text boxes using the "text options panel" (ctrl+T) or window>panels>text options. Give all the boxes a variables name. In this case:

box1 = nameboy
box2 = namegirl
box3 = dialogue1
box4 = dialogue2
Step 3 - Asign a stop action to this frame, and the last thing to do on frame 1 is to add a button with this action asigned to it.

on (release) {
gotoAndPlay (2);
}

Step 4 - Go to frame two, make a dynamic text box ("ctrl+T" or window>panels>text options) and give it a variable name (in this case "balloon"). Add this action to the frame.



frame1 ---- stop();
frame2 ---- balloon = "hi ! " add nameboy add " how do you do today? ";
frame10--- balloon = "thank you "add namegirl add " ";
frame20--- balloon = dialogue1;
frame30--- balloon = dialogue2;
frame40--- stop ();

A final note -What you have done now is that you simply stored information in a input textbox (step2), and then revealed that data with the help of a dynamic text box in (step 4). Add some necessary graphics and now you have done the first dialogue. It's very easy. Download the FLA and see how you with minimal scripting can create a nice graphic-conversation that the user totally controlls.
How would you rate the quality of this article?
1 2 3 4 5
Poor Excellent

Verification:
Enter the security code shown below:
img


Add comment

Spread The Word / Bookmark this content

Clesto Digg it! Reddit Furl del.icio.us Spurl Yahoo!

Comments



Search Entire Site
Add to Google
Advertisements
Article Options
Latest New Articles
Set up a simple IIS Server for Flash
by Peter McBride

Day 1 at FITC Toronto 2008
by Anthony Pace

Simple reflection effect with AS2
by Jean André Mas

ActionScript.org Meets Josh Tynjala (aka dr_zeus)
by ActionScript.org Staff

Rapidly Create Online Flash Movies to Help Users Market, Sell and Support Software and Hardware
by Sabrina F

mailing list
Enter your email address:
mailing list
Subscribe Unsubscribe
© 2000-2007 actionscript.org! All Rights Reserved.
Read our Privacy Statement and Terms of Use...
Our dedicated server is hosted and managed by WebScorpion Webhosting.