Re: [Flashcoders] Best Practices and optimization
I was lucky to addend Grant Skinner on FITC Amsterdam and he spoke about good/fast coding practice with Actionscript or: Quick as Flash. You can find it here: http://www.gskinner.com/talks/quickNL/ Interesting was his PerformanceTestClass. Some pre information about it I wrote on my blog: http://blog.dieanstalt.com/?p=480lang=en - Session 3 *Beatrix Kruemmer-Frau* Dipl. Ing. Designer|CEH-LPIG-1 Flash/Flex Developer Network Security Administrator Blog http://www.blog.dieanstalt.com Twitter http://twitter.com/Birikini Xing http://www.xing.com/profile/Beatrix_KruemmerFrau LinkenID http://de.linkedin.com/in/beatrixkruemmerfrau Am 02.05.2010 06:48, schrieb Karl DeSaulniers: Hello, Sorry if this is a repeat. I lost all my old emails. 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? Something that gives real life scenarios? My thought is that most of the flash sites that are memory hogs are ones that are not utilizing the best methods. I would like my sites to not be one of those. I have been to many professional flash sites that do not bog my system and video seems to play like I am watching TV. I have a less than perfect internet connection, so I know there has got to be a One way to creating a seamless flash website. The real code if you will. Something that says this is what most people do, don't do that, do this. For the laymen. OR If there is not something available like this, can it be put together? It just seems like there are way too many ways to do the same thing in AS and not all of them work well in every situation, but knowing this is a battle. Not trying to short-cut things, just wanted to know if there was something out there. If there is, then I'd like to post it everywhere under the moon. If everyone could find it and learn from it, we may have a new era of flash on our hands. :) Personally, I feel that the negative opinions about flash are actually based off this factor alone. People not knowing the Best way to code AS. Not that flash is actually that bad. If I could get a suggestion from someone at the top, that would be stellar, but all welcome. TIA, Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Best Practices and optimization
http://opensource.adobe.com/wiki/display/flexsdk/Coding+Conventions ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Best Practices and optimization
http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/ And just in general: http://lab.polygonal.de/ Michael's examples are the fastest versions of various algorithms, such as collision detection, tangent approximation, etc. There is much to learn from his blog. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Best Practices and optimization
Gold! Thanks Steve. Karl On May 3, 2010, at 2:16 PM, Steven Sacks wrote: http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/ And just in general: http://lab.polygonal.de/ Michael's examples are the fastest versions of various algorithms, such as collision detection, tangent approximation, etc. There is much to learn from his blog. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Best Practices and optimization
Gold! Thanks Steve. Karl On May 3, 2010, at 2:13 PM, Steven Sacks wrote: http://opensource.adobe.com/wiki/display/flexsdk/Coding+Conventions ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Best Practices and optimization
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_Partsfile=1090.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; imyArray.length; i++) { do stuff; } do this: var arrLen:int = myArray.length; for (var i:int=0; iarrLen; 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
Re: [Flashcoders] Best Practices and optimization
Thanks for your response Kerry. On May 2, 2010, at 4:44 PM, Kerry Thompson wrote: 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_Partsfile=1090.html. If you Google ActionScript best practices you'll find a variety of blogs and articles. Yes, I will be doing a lot of this. :) 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. I See In loops, always store the end condition in a register variable. For example, instead of this: for (var i:int = 0; imyArray.length; i++) { do stuff; } do this: var arrLen:int = myArray.length; for (var i:int=0; iarrLen; i++) { do stuff; } Perfect. I had been doing it the worng way in some of my files. I will be making this change immediately. Thanks for the laymen eg. 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. Every little bit helps. I plan on making a collection of the info I have found. Putting up a page on my website to find stuff like this. Thanks again, Best, Cordially, Kerry Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Best Practices and optimization
Hello, Sorry if this is a repeat. I lost all my old emails. 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? Something that gives real life scenarios? My thought is that most of the flash sites that are memory hogs are ones that are not utilizing the best methods. I would like my sites to not be one of those. I have been to many professional flash sites that do not bog my system and video seems to play like I am watching TV. I have a less than perfect internet connection, so I know there has got to be a One way to creating a seamless flash website. The real code if you will. Something that says this is what most people do, don't do that, do this. For the laymen. OR If there is not something available like this, can it be put together? It just seems like there are way too many ways to do the same thing in AS and not all of them work well in every situation, but knowing this is a battle. Not trying to short-cut things, just wanted to know if there was something out there. If there is, then I'd like to post it everywhere under the moon. If everyone could find it and learn from it, we may have a new era of flash on our hands. :) Personally, I feel that the negative opinions about flash are actually based off this factor alone. People not knowing the Best way to code AS. Not that flash is actually that bad. If I could get a suggestion from someone at the top, that would be stellar, but all welcome. TIA, Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders