!
©!2009!DevelopmentArc!LLC,!All!rights!reserved.!
!
Figure'1')' The'Phases'of'the'Component'Lifecycle'
These!are!not!the!official!Adobe!terms,!but!we!have!organized!the!stages!into!
categories!to!help!define!what!the!component!is!doing!and!when.!Our!seven!stages!
correspond!to!the!four!life!stages!as!follows.!!The!Birth!stage!is!made!up!of!
Construction,!Addition,!and!Initialization.!!The!growth!and!maturity!phase!are!made!
up!of!Invalidation,!Validation!and!Update.!!The!death!state!is!defined!by!the!Removal!
phase.!!Let’s!look!at!the!first!phase:!Construction.!
Component+Phases:+Construction+(birth)+
The!Construction!phase!is!the!very!first!phase!of!a!component!and!is!defined!when!
we!call!the!Component’s!constructor.!!The!Adobe!Flex!documentation!uses!Button!
as!their!example!component,!so!let’s!follow!in!their!footsteps.!
var myButton:Button = new Button(); // this is our construction phase
Pretty!obvious,!right?!!What!isn’t!obvious!about!this!phase!is!that!very!little!actually!
happens.!!So!what!does!happen!during!the!Construction!phase?!!
If!we!start!at!the!Button’s!constructor!and!walk!up!the!super()!chain,!we!first!go!to!
UIComponent,!then!to!FlexSprite,!then!to!Sprite!(where!we!can!no!longer!see!the!
source!code!since!its!part!of!playerglobal.swc).!!FlexSprite!is!high!enough!up!the!
inheritance!chain!to!get!a!good!overall!picture!of!the!construction!process,!so!we!
will!start!there!for!this!example.!!!
Comentarios a estos manuales