A neat wee time saving way to write an if () {} else {} statement in flash or javascript:
var a = true; var b = false; var c; if(a==b?c = true: c = false); trace(c);
The statements between the ? and the : are if the if evaluated to true, and after the : is for false. Ie. it is this:
if(a == b) { c = true; } else { c = false; }
and if you’re just going for an if, no else, just throw a null in the 2nd assignment
if(a==b?b=c:null);
Tech Reference: AS3, JavaScript
Leave a Reply