Tag Archive for 'Coding'

Code hints and escape shortcuts (”two simple things to help you become a better coder”)

Here is a mini cheat sheet to better and faster coding.

By naming your Object types with the corresponding Variable suffix you will add code hinting when you have not strong typed your Object types as well making your code more readable.

Use escape shortcuts for redundant typing of the same code. (”it’s kinda like snip-its of premade code”)

================
AS3 code hint triggers

Object type:
Variable suffix:

Array
_array

Button
_btn

Camera
_cam

Color
_color

ContextMenu
_cm

ContextMenuItem
_cmi

Date
_date

Error
_err

LoadVars
_lv

LocalConnection
_lc

Microphone
_mic

MovieClip
_mc

MovieClipLoader
_mcl

PrintJob
_pj

NetConnection
_nc

NetStream
_ns

SharedObject
_so

Sound
_sound

String
_str

TextField
_txt

TextFormat
_fmt

Video
_video

XML
_xml

XMLNode
_xmlnode

XMLSocket
_xmlsocket

======================
Escape shortcuts for AS3

with (Escape + wt)
while (Escape + wh)
var (Escape + vr)
throw (Escape + th)
switch (Escape + sw)
return (Escape + rt)
if (Escape + if)
function (Escape + fn)
for..in (Escape + fi)
for (Escape + fr)
else (Escape + el)
do (Escape + do)
default (Escape + dt)
continue (Escape + co)
class (Escape + cl)
case (Escape + ce)
break (Escape + br)
// ( Escape + //)