There are some pretty commonly held standards among the professional Flash community. The ones I pointed out are probably the most important. Most of the other things I'd mention aren't as important (at least in *my* opinion).
Just remember these things:
functions:
ONLY the Constructor starts with an upper-case letter
NEVER start a function name with an underscore. Always a lower-case letter.
constants:
ALL letters are upper-case, with words separated by underscores.
variables:
NEVER start with an upper-case letter.
If
private or protected, start with an underscore.
If
public, do NOT start with an underscore.
get/set accessors for private/protected variables ALWAYS have the same name as the variable *without* the underscore.
Code:
private var _foo:String = "foo";
public function get foo():String{
return _foo;
}
public function set foo(value:String):void{
_foo = value;
}
It's pretty common to place variable declarations at the top. It's also fairly common to place
static variables and functions before everything else, but not universal. Something like this is the most common that I see day-to-day...
Code:
class declaration
static CONSTANTS
static variables
static accessors (get/set)
static functions
local CONSTANTS
local variables
local accessors (get/set)
Constructor
local functions
Honestly, as long as all the constants and variables are declared at the top, that's enough for most people.
On the subject of
onEventName vs. eventNameHandler
I don't think it's important which one you choose, as long as you stay consistent. This makes it easier on you when you (or someone else) use find/replace to search out function names. I favor the first in code I write, but it's really not a big deal.
I'm sure someone will completely disagree with what I consider to be readable and acceptable, and furthermore will find my own practices almost unreadable.