First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: Sanova
Bring up your file from the last tutorial. Add a layer in your main timeline. Name that layer 'Script'.(without the quotes) In that layer's actions put:

Health = 100;
Money = 100;


This basically means that Health is 100 and Money is 100. These are variables. Variables are meant to be changed or altered for your needs. Let's take for example, time and distance. In the real world this is the most common (I think). So let's say you're riding your bike in the Street. The street is 2 mi long and you want to ride across it and back. Your total distance is, you guessed it, 4 mi. Now, you've gone 1 mi in 5 min. If you were to take a break at 3 mi and speed up until you got back to where you started (4 mi.), then your total time would be about 15 minutes. (it's kinda hard to explain so try to follow along as best as you can.) Your time changed through out your little ride. As well as your distance. The best way to represent this would be in a graph:


As you can see, the place where you took a break will show no progress.

Now let's alter the variables in our little project. Make a button by drawing a circle and rightClick-Convert to symbol. Change the type of symbol to a button. (just name it 'button') And click 'OK' Now you have a button! Now in the button's actions, add these actions:

on (release) {
    _root.money+=10;
}


If you were to test the movie, nothing would happen(that you can see). Too see this change, add a text box, and make it a dynamic textbox. Make its variable name: 'money'. Now if you test your movie(Ctrl+Enter), if you press your button, the counter would go up! You can use what we just did so far to upgrade skills, take money, drink stuff, etc. If these tutorial seems incomplete, I hope to cover it more in the second tutorial. This may not have been very helpful to you in some ways. Don't worry in the next tutorial, I will explain how to use them in other and better ways. (I'll also explain what to do with the Health Variable)

THE NEXT TUTORIAL: HOTSPOTS AND HITTESTS!!!!

also, you can contact me at j.j.lynn@verizon.net for questions and personnal comments

HAPPY FLASHING!!!!

» Level Intermediate

Added: 2005-09-28
Rating: 6 Votes: 3
(10 being the highest)
» Author
Not much to say except that I LOVE FlashMX!
» 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: doc_chin7
» Description:

The flash's horizontal road drive was done in CS4 and was upgraded to CS6. The car responds to right/ left key and flash will auto-generate the movement of roads from left-right or right-left based on random number. Have fun driving in this virtual environment and avoid other cars... :) If you are creative, a road driving game can be created from it.

Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
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: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.