quicky AS2.0
- Started
- Last post
- 15 Responses
- Cenitgrade
why is this not working? And how to fix it? Please do tell.
optin = 1;
optinbut.onPress = function(){
if (optin = 0){
optin = 1;
}else if (optin =1){
optin = 0
}
}I just want to alternate between two values.
- gabe0
you're setting option to 0 (one equal sign) instead of evaluating (two equal signs).
if( option == 0 )
- Cenitgrade0
Record response time. Thanks people. Back to the pixels!
- CyBrain0
If you don't mind making optin a boolean instead of a number, you can use one line.
optin != optin;- need to be a number for PHP script. But cheers!Cenitgrade
- rosem0
var optin:Boolean;
optinbut.onPress = function(){
if (!optin){
optin = true;
} else {
optin = false;
}
}
- NONEIS0
var optin:Number = 1;
optinbut.onPress = function(){
if (optin == 0){
optin = 1;
}else {
optin = 0
}
}you dont need an if else, there are only 2 options right, 1 and 0.
- noiseisthis0
can you explain line 3 fyoucher?
like what does the '?' and ':' do?
- Autokern0
var optin:Number =1
optinbut.onPress = function(){
optin = (optin == 0) ? 1: 0
}For one liners if-then use the conditional operator
http://en.wikipedia.org/wiki/%3F…- << What he says. I'm retarded right now.fyoucher1
- i learned something new today :)
thanksnoiseisthis
- Cenitgrade0
The ball is out of the park.... that was way more educational than I imagined it would be.
- monNom0
var optin:boolean = true;
optinbut.onPress = function(){
optin = !optin;
}
- Cenitgrade0
monNom takes it by a hair.