!
©!2009!DevelopmentArc!LLC,!All!rights!reserved.!
inform!the!Preloader when!to!update!the!display!progress!bar.!!Once!the!
Preloader!loads!all!the!RSLs,!it!dispatches!the!FlexEvent.INIT_PROGRESS!event!
informing!the!SystemManager that!it!has!loaded!in!all!the!required!external!assets.!
The!Preloader!is!responsible!for!handling!two!main!tasks,!first!loading!in!the!RSLs!
and!Resources!bundles!(as!we!just!discussed)!and!it!is!also!responsible!for!giving!
feedback!to!the!user!as!the!Flex!Application!goes!through!the!Child!Creation!and!
Child!Display!phases.!!As!we!get!deeper!into!the!process,!we!will!comment!on!when!
the!Preloader!updates!and!when!it!has!completed!its!tasks.!
Now!that!the!RSLs!and!bundles!are!loaded,!causing!the!Preloader!to!dispatch!
INIT_PROGRESS,!the!SystemManager!receives!the!event!and!advances!one!frame!via!
the!nextFrame()!method.!!During!the!Initialize!phase!the!SystemManager!registered!
to!itself!for!the!ENTER_FRAME!event!which!triggers!the!docFrameHandler()!method.!!
When!we!call!nextFrame(),!the!SystemManager!(which!extends!MovieClip)!steps!a!
frame!and!dispatches!an!ENTER_FRAME!event.!!
The!docFrameHandler()!method!begins!defining!many!of!the!Singleton!classes!
throughout!the!application,!such!as!the!BrowserManager,!HistoryManager,!
CursorManager,!LayoutManager,!etc.!Once!the!Singletons!are!defined,!the!loaded!
compiled!resource!bundles!are!then!installed!into!the!ResourceManager!instance!for!
the!application,!making!their!content!available!to!the!entire!system.!
Flex+Application+Ph a s es:+Child+Creation+
Up!to!this!point,!we!have!been!getting!our!external!data!loaded!and!the!system!
prepared!so!that!we!can!begin!creating!our!root!Application!class.!!All!this!
information!has!to!be!available!to!us!because!it!defines!the!framework!and!
implementations!required!to!run!our!application.!!Now!that!we!have!everything!
loaded!and!in!place!we!can!start!building!out!the!top‐level!Application!Class.!!To!
start!creating!the!top‐level!Applicaiton,!the!docFrameHandler()!method!calls!the!
initializeTopLevelWindow()!method!on!the!SystemManager,!which!initiates!the!
creation!process.!
First,!the!SystemManager!registers!to!the!MouseEvent.MOUSE_DOWN!for!the!window!to!
handle!focus!management!and!registers!to!the!stage’s!Event.RESIZE!event!so!that!
when!the!user!changes!the!size!of!the!window!the!SystemManager!can!track!it!and!
pass!it!on!to!its!children.!Once!this!registration!is!complete!the!Application!
instance!is!created.!
The!class!that!is!created!for!the!root!Application!is!based!on!what!was!defined!as!
the!base!Application!during!compilation.!!Its!possible!that!you!extended!
Application!in!your!project!or!in!AIR!it’s!a!WindowedApplication!instance.!!The!
SystemManager!uses!a!factory!method!called!create()!which!references!
info()[“mainClassName”]!to!determine!the!type!of!Class!to!create!(even!more!
compiler!magic).!!!
Komentarze do niniejszej Instrukcji