At 1/5/08 07:35 PM, El-Presidente wrote:
1. You don't need the new Number (or whatever new you have) if you ALREADY have var and :Number (or again, whatever you have there). It slows the code down and is repetitive.
wrong. its all going to be compiled into bytecode. you have no basis for saying that its "slow" or "repetitive". in fact, its a BETTER practice to do it this way. not necessary, but better.
2. Put your opening brackets on new lines, so _root.onEnterFrame = function () { .. but closers still keep their own lines...
this is a style choice. please dont criticize things that are generally irrelevant. there are many different "schools of thought" that recommend one way or another. there is no difference.
3. You need &&, because & doesn't work if you just put it alone.
correct, but it WILL work. & is the bitwise-and, which will work in this case.
4. Why time -= 100 instead of just making it 100 timer and -= 1.
again, a silly thing to criticize. doesnt make a difference but simplicity of reading.
5. Use == true or == false instead of just repeating the variable's name
unnecessary. doing "== true", in fact, requires that it do one extra check. this is, possibly, the worst of your advice. but hey, lets see what else youve got...
6. I would avoid even using &&'s, because you should just make it two openings, so heres an example:
again, i contend that you have no clue what you are talking about. when the entirety of the AS is converted to bytecode, the two versions you proposed will be converted to the EXACT SAME bytecode. consider the following example:
var nt:Number = 1;
if (false && ++nt);
trace(nt); // output: 1
youll see that the number does not increment because the second portion of the if-statement is never invoked. this will effectively work the same as if you divide it in your asinine way.