Karl DeSaulniers wrote: > Is there a document or website or page on adobe that I can go to that has > "all" the best practices for coding in AS2 and AS3?
There are a couple on the Adobe Web site. ActionScript 2 best practices are at <http://www.adobe.com/devnet/flash/articles/as_bestpractices.html>. ActionScript 3 best practices are at <http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001090.html>. If you Google "ActionScript best practices" you'll find a variety of blogs and articles. I can give you a couple that will speed up your code. First, use the ActionScript classes as much as possible. They are compiled to native code, and will run anywhere from 10 to 400 times as fast as any code you can write, simply because the code your write gets compiled to tokens, or bytecode, which then have to be interpreted at run time. AS3 has a just-in-time compiler that helps, but there is still nothing like native code. In loops, always store the end condition in a register variable. For example, instead of this: for (var i:int = 0; i<myArray.length; i++) { do stuff; } do this: var arrLen:int = myArray.length; for (var i:int=0; i<arrLen; i++) { do stuff; } I know that runs faster in AS2. I haven't run tests in AS3, but I would guess the JIT compiler would speed up either way of doing it, but the second would still be faster. Cordially, Kerry Thompson _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders