A variable declaration is processed before statements. Therefore, it does not matter if it is inside or outside a loop.

myClass = new MyClass();
trace(myClass);  // Output: [object MyClass]
while (false) {
        var myClass:MyClass;
}
_____
Piers Cowburn wrote:
AFAIK, using implicit casting rather than explicit in this case is faster, so 
A1 in your examples is faster than A2. Also, it's better to move your variable 
declaration outside the loop:

var i:int = myArray.length;
// Variable is declared once here and then reused
var myClass:MyClass;
while (i--)
{
   myClass = myArray[i];
}

Good luck,
--
Fumio Nonaka
http://www.FumioNonaka.com/
My books<http://www.FumioNonaka.com/Books/index.html>
Flash community<http://F-site.org/>
English blog<http://blog.jactionscripters.com>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to