View Full Version : If...Then... declaring variables, etc.
Bender
08-04-2003, 10:44 PM
I am familar with qbasic, and visual basic and now I am moving on to flash. I really don't know how to use actionscript well, but I am slowly learning.
How do you set up a simple:
If a = 0 then b = 2
in action script and how do you declare variables?
-Thanks ;)
Colin Campbell
08-04-2003, 11:03 PM
//typing "var" is optional, I just think its a good practice.
var a=0
var b=0
if (a==0) {
b=2
}
Look at it like this:
if (/*this condition is true*/) {
//do this chunk of code
}
For the first a==0, the == is just testing to see if it does, in this situation, it would be wrong to use a=0, because then you're declaring the variable, like above. Hope that helps.
Ricod
08-04-2003, 11:05 PM
Hello Bender, welcome to the board !
You can declare temp variables like this : var my_var_name = "myValue";
I suggest you read a few tutorials. Take a look at the tutorial section here. (http://www.actionscript.org/tutorials.shtml)
if (a==0) {
b=2;
}
awww ... man ! colin14 speed answered it before me ! :D
Bender
08-04-2003, 11:33 PM
Thank you both, appreciate the help :)
Colin Campbell
08-04-2003, 11:38 PM
BTW: I added you to my AIM list. If you ever need some help, or just want to chat, give me a shout at: colincampbell14
:D Hope to talk to you.
Ricod
08-05-2003, 07:13 PM
Anytime Bender !
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.