Version#1.0#(May#14,#2009)#
calculations!(HBox,!VBox),!animation!(Effects,!Transitions),!data!loading!(Remote!
Object,!HTTPService),!user!interaction!(mouse,!keyboard),!and!your!custom!code!all!
in!a!single!pass,!every!frame.!!It!would!bring!the!player!to!its!knees!and!Flex!would!
be!totally!unusable.!
Much!of!what!the!Framework!does!is!“wait!a!frame”!for!us.!!Its!architecture!is!
designed!in!such!a!way!to!create!phases!and!steps!that!are!optimized!to!how!the!
Flash!player!works,!and!does!so!in!such!a!way!that!you!can!also!take!advantage!of!
this!if!you!adopt!and!tap!into!the!provided!(yet!often!unexplained)!API!hooks.!
The +Life+Stages+of+ a+Flex+Applicat ion+
With!any!biological!Lifecycle!we!typically!have!four!stages:!birth,!growth,!maturity!
and!finally!death.!Just!like!the!biological!Lifecycle,!the!Flex!framework!and!its!
components!follow!a!very!similar!path.!!We!will!first!examine!the!birthing!process;!
how!Components!are!created,!how!they!grow!and!mature!and!finally!what!happens!
when!its!time!to!remove!them!from!our!application.!!!
After!reviewing!components!we!will!look!at!the!Flex!Application!Framework’s!
lifecycle.!!We!will!review!how!the!Flex!framework!starts!up,!ties!into!the!Flash!
Player,!and!creates!its!Application!and!other!children!components.!!We!will!look!at!
what!happens!when!the!application!grows!and!matures!as!the!user!interacts!with!it.!!
Finally!we!will!look!at!the!death!of!the!application.!
Understanding!all!these!elements!and!the!order!they!occur!will!help!you!design!and!
build!better!components!and!potentially,!applications.!!Once!we!have!fully!examined!
these!stages!we!will!then!explore!how!to!take!advantage!of!this!knowledge!when!
creating!new!functionality!for!your!application.!
An+Introduction+Into + t h e+Component+Lifecycle+
Before!we!start!dealing!with!how!a!Flex!Application!starts!up!and!creates!its!
children!we!should!spend!a!bit!of!time!looking!at!the!general!component!lifecycle.!!
Its!important!to!understand!the!component!lifecycle!first!because!the!Flex!
application!lifecycle!is!an!extension!of!the!component!lifecycle,!with!some!important!
modifications!to!help!performance!and!other!required!application!level!
functionality.!
Component+Phases:+Overview+
A!Flex!component!goes!through!seven!distinct!phases!that!we!can!compartmentalize!
into!the!four!life!stages.!!As!the!component!goes!through!the!seven!main!phases!of!
its!lifecycle,!some!phases!are!repeated!often,!others!only!occur!once.!!The!seven!
phases!are!construction,!addition,!initialization,!invalidation,!validation,!updating!
and!removal.!!!
Comentários a estes Manuais