The Armor Games website will be down for maintenance on Monday 10/7/2024
starting at 10:00 AM Pacific time. We apologize for the inconvenience.
The Armor Games website will be down for maintenance on Monday 10/7/2024
starting at 10:00 AM Pacific time. We apologize for the inconvenience.
1 | 4410 |
Disclaimer: This is REALLY for the absolute beginner. If you know anything about Flash, this probably isn't for you.
I am making a short 101 course in Adobe Flash CS5, step by step. No one can learn to code in a day (or even in a week!), but I'm planning to make a short series that will teach some things and hopefully get you started in making Flash stuff.
Each Mini-Lesson is exactly that: mini. I am intending to only cover one thing per post in this thread, so that it doesn't overwhelm.
The first lesson is going to be extremely simple and only cover basic variables. I will use AS3 for these, mainly because I can't code in AS2.
I'll do the variables mini-lesson in the next post!
What Are Variables
Think of variables as labelled jars that contain different types of data. There are many types of variables, but we'll only look at three for now:
String
Number
Boolean
A String is a series of letters, numbers, and some characters that are contained within quotation marks. ("" and ('' can both be used. An example of string might be "Hello! I'm learning variables in Flash today!" Strings are generally used for storing text.
A Number is exactly what you would think it is: a number. You don't store them in quotation marks like strings. Instead, number variables are written as they are. An example a number might be 9. Or 10. Or 32.432. Yes, you can do decimals too.
Lastly, a Boolean is always either true or false. It is sort of like an on/off switch, so you can use a boolean variable to ask true or false questions in your code. For example, if you were making Elephant Quest, you might need to ask "Does the player have the key?" and it was true, you would then open the door.
So how do I put a variable in my code?
A variable in AS3 (Actionscript 3) looks like this:
var myVariable:String = "Hello World!"
var ArmorGames:String;
var myVariable:Number = 5;
var myString:String = "Hello World!";
var myBoolean:Boolean = false;
trace(myString);
You must be logged in to post a reply!