!
©!2009!DevelopmentArc!LLC,!All!rights!reserved.!
exactly!how!the!compiler!builds!the!call!stack!for!the!first!frame.!!Until!then,!we!will!
just!make!note!of!compiler!“magic”!and!try!to!explain!it!as!best!we!can.!So!for!now,!
bear!with!us!and!we!will!start!with!the!creation!of!the!SystemManager.!
At+the+Top+Sits+the+SystemManager+
Every!Flex!application!(Browser‐based!or!AIR)!has!a!SystemManager!instance!that!is!
responsible!for!managing!all!the!displayed!content!in!the!application!window.!The!
application!window,!as!described!by!the!SystemManager!ASDoc!comments,!is:!
…an#area#where#the#visuals#of#the#application#are#displayed.##It#may#be#a#
window#in#the#operating#system#or#an#area#within#the#browser.#
This!means!that!there!is!one!SystemManager!for!every!window.!
21
!!When!the!
SystemManager!is!created,!it!first!checks!to!see!if!it!is!the!first!SystemManager!in!the!
current!window!hierarchy.!!For!this!paper!we!will!assume!that!our!SystemManger!is!
the!first!SystemManager!to!be!created!in!our!windowed!application,!and!we!will!not!
explore!how!child!SystemManagers!or!sub‐applications!are!managed.!
22
!!
The!way!the!SystemManager!determines!it!is!the!default!(or!root)!SystemManager
for!the!current!application!window,!is!by!checking!to!see!if!the!stage!property!is!
defined!at!construction.!!!
A!stage!is!the!base!object!that!all!displayable!objects!hang!off!of,!including!the!
SystemManager.!!Just!like!in!the!Highlander,!there!can!only!be!one!stage!per!
windowed!application.!!The!first!DisplayObject!hung!off!of!the!stage!is!the!root!
object!and!the!root!property!of!the!DisplayObject!is!set!to!a!reference!of!itself.!!All!
other!displayable!objects!are!hung!off!the!root!object!and!their!root!property!is!a!
reference!to!the!root!DisplayObject.!!Examine!Figure!10!‐!The!Windowed!
Application!Hierarchy#below!to!see!how!this!structure!is!organized.!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21
#AIR#applications#have#the#ability#to#display#multiple#window s#at#the#same#time.##This#means#that#there#
will#be#one#SystemManager#for#every#window#being#displayed.##When#dev eloping#multi^win dowed#
applicati ons#in#AIR#it#is#important#to#understand#this#concep t#so#that#you#c an#manage#your#applic ation#
correctly.#
22
#In#certain#situations#it#is#possible#to#have#multiple#SystemManagers#in#the#same#window#instance.#
This#usually#occur s#when#a#Flex#Appli catio n#loads#a#child #Flex#Appl ication#via#a#Loader.##To#prevent#
control#conflicts,#there #can#only# be#one#root#SystemManager#that#is#responsible#for#the#window.# #
During#const ructi on,#the#SystemManager#checks#to#see#if#i t#is#the#default#manager#or#if#there#is#a#
parent#SystemManager#already.##If#there#is#a#par ent#SystemManager,#then#the#newly#constructed#
instance#delegates#most#of#i ts#responsibilities#to#the#root#manager.##
Kommentare zu diesen Handbüchern