AS3 Better Practices
http://blog.eddie.com.tw
aquarianboy@ptt
eddie@adcube.com.tw
aquarianboy@plurk
eddiekao@facebook
!
(F1)
Flash/ActionScript
           RTFM, please :)
Google
         ...
flash
Designers:      Programmers:
-    logo       cup.holder = true;
-               cup.render_texture = "blue";
-    ...(   )   cup.render_logo = new Puppy();
fla
Flash              Flash   !


        Flash
             XD!
:)
!
?
!
Better
Practices
!
-http debugger : httpfox
SVN/Git/Dropbox
FLA   (   )
Preload




                               ?




http://www.prettyloaded.com/
1KB   !
Flash IDE
Fla
(   Flash    )
JPEG Quality    50~60
               OK!
function/method
Any fool can write code that a computer
can understand. Good programmers write
   code that humans can understand.
?

var       :Tank = new Tank();
      .   ();

                !
frame-based looping
Switch   if/else
listener   !(   )
Timer   interval!
(   )
var my_array:Array = [1, 2, 3, 4, 5];

// general way
for (var i:int; i<my_array.length; i++)
{
.....
}

// better way
var len_of_array:int = my_array.length;
for (var i:int; i<len_of_array; i++)
{
.....
}
uint   int
int   number
function
preloader, xml loader..etc
CPU
getter & setter
null
It is better to delete variables than to set them to null.
trace()
(      Omit Trace Actions)
(inheritance)
method call
A.swf     B.swf   B.swf
unload B.swf




delete foo.bar.CustomClass
Sprite   MovieClip
DON’T import flash.display.*
Flash
             user agent

user_agent =~ /^(Adobe|Shockwave) Flash/
Refactoring...?
That’s another story :)
Thank You!

AS3 Better Practices