PDA

View Full Version : AS2 best practices


asscripter
04-16-2009, 02:20 PM
Hi,
Can anyone give me some links/tips of AS2 best practices. DO and NOT DO types of links.
Any comparison with differenct approaches of coding - which is faster, etc will be of great help.
Thanks.

kkbbcute
04-16-2009, 02:25 PM
Always organize your code properly, making a clear distinction between function names, instance names and vars. Don't just randomly name them or you will forget eventually, instead, put a var prefix in front of each variable, and a func prefix in front of each function ettc.

This is important for large complicated projects. ;)

asscripter
04-16-2009, 02:41 PM
Oh that was quick and relevant. But I am also looking for memory managment or fast code rendering options in addition to faster coding advantages.

Anyone else?

Thanks.

acolyte
04-16-2009, 07:43 PM
hi ,

another good hint could be :

work with returns , so your functions stay readable and you maybee can use the
return functions as a prebuild stack of reusable functions

like prototype without the need to write prototypes

Xegnma
04-17-2009, 06:42 AM
Thou art ask-eth and thou art shall receive...
Behold yea link below...

ActionScript 2.0 Best Practices (http://www.adobe.com/devnet/flash/articles/as_bestpractices.html)

kkbbcute
04-17-2009, 03:07 PM
Thou art ask-eth and thou art shall receive...
Behold yea link below...

ActionScript 2.0 Best Practices (http://www.adobe.com/devnet/flash/articles/as_bestpractices.html)

Thou bows down to the Godly find.

You googled "AS2 Best Practices", didn't you? :p

Xegnma
04-18-2009, 12:35 AM
Thou bows down to the Godly find.

You googled "AS2 Best Practices", didn't you? :p

Yes...around 2-3 years ago :) ...I found it so useful I bookmarked it. You should google the authors name and check out her blog, she writes about some pretty cool stuff.

kkbbcute
04-18-2009, 04:18 AM
Reminds me of how I patrol Adobe's developer center looking for new tips and tricks.

Flash Gordon
04-18-2009, 05:00 AM
I thought AS 2 best practices was to use AS 3! ;)

kkbbcute
04-18-2009, 06:08 AM
I thought AS 2 best practices was to use AS 3! ;)

Why is the whole world hining to me to use AS3, noooo! :p

But seriously, for smaller projects which are in no need of the new features that comes with AS3 or high performance, I find AS2 to be just fine.

asscripter
04-23-2009, 09:10 AM
I think we are out of track now! Let's come back....

Best practice:

Declare variables: Always choose to precede a new variable with var keyword. As AS2 is based upon dynamic classes (on the other hand, AS3 is based upon sealed classes), thus not declaring a var keyword will not through any error but doing so will definitely improve the code performance by 16-17%. Declaring a var reserves some memory in the stack and tries to utilise that memory instead of some unpredictable amount of it.

kkbbcute
04-23-2009, 10:55 AM
Declare variables: Always choose to precede a new variable with var keyword. As AS2 is based upon dynamic classes (on the other hand, AS3 is based upon sealed classes), thus not declaring a var keyword will not through any error but doing so will definitely improve the code performance by 16-17%. Declaring a var reserves some memory in the stack and tries to utilise that memory instead of some unpredictable amount of it.

Also, to add on, don't add a "var" in front of a variable that has already been defined, especially in onEnterFrame functions, half the time, the variable will just lose itself and go all awry.