!
©!2009!DevelopmentArc!LLC,!All!rights!reserved.!
information!as!bytes!are!being!loaded!to!give!feedback!to!our!users!or!to!know!when!
the!target!content!is!loaded!into!our!application.!!In!the!case!of!the!SystemManager,!
the!SWF!isn’t!being!loaded!as!a!child!of!our!application;!it!is!being!loaded!by!the!
Flash!Player!itself.!!The!root!DisplayObject!is!given!reference!to!the!Flash!Player’s!
loaderInfo!therefore!we!are!essentially!able!to!watch!our!own!SWF!load!(very!
meta,!isn’t!it?).!
One!of!the!features!of!the!LoaderInfo!Class!is!that!it!dispatches!an!Event.INIT!
event,!when!all!the!properties!and!methods!associated!with!the!loaded!SWF!are!
accessible,!the!constructors!of!the!first!frames!child!objects!are!constructed!and!
when!all!the!ActionScript!in!the!first!frame!has!been!executed.!!This!is!important,!
because!the!SystemManager!registers!to!its!own!loaderInfo,!listening!for!when!the!
Event.INIT!is!dispatched.!!When!this!event!is!dispatched,!the!SystemManager!knows!
that!all!its!important!information!required!for!initialization!and!other!configuration!
details!are!now!loaded!and!available.!
Flex+Application+Ph a s es:+Initialization+
Once!the!SystemManager’s!Event.INIT!is!dispatched,!the!SystemManager!begins!the!
Initialization!phase!of!our!Application.!!The!SystemManager!first!does!some!more!
parenting!checks!to!see!if!it’s!the!root!or!not
23
,!registers!for!the!Event.ENTER_FRAME
event!
24
!(which!is!dispatched!at!the!beginning!of!every!new!Flash!frame),!and!then!
calls!it’s!own!initialization() method.!!
Inside!the!initialization() method,!the!SystemManager!sets!its!own!width!and!
height!to!the!encapsulating!widowed!application’s!size!and!then!creates!an!instance!
of!the!Preloader Class.!!Before!we!can!start!creating!our!Application,!we!need!to!
load!any!required!external!libraries!and!resource!bundles!to!make!our!application!
function.!
Managing+Externalization+
One!of!the!powerful!features!of!Flex!3!is!the!ability!to!externalize!functionality!in!
Remote!Shared!Libraries!(RSLs)!and!localized!content!in!Resource!Bundles.!
25
!!
There!are!many!reasons!why!we!may!want!to!externalize!content;!such!as!download!
size,!sharing!resources,!targeted!languages,!etc.!!!
One!of!the!technical!challenges!with!creating!externalized!content!is!to!make!sure!
that!it!is!all!available!when!the!application!requires!it.!!The!loading!of!required!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
23
#If#the#SystemManager#is#not#the#r oot#mana ger#t hen#this#method#is# responsible#for#setting#up#
communication#paths#with# the#root#SystemManager#and#sandbox#constraints.##This#only#oc curs#when#
Flex#App licati ons#load#Flex#Applications.#
24
##It’s#important#to #note#that#the# ENTER_FRAME#even t#will #not#be#dispatched#right#away.##The#
constructor#of#the#SystemManager#calls#stop()#to#make#sure#tha t#the #next#frame#is# not#entered#
until#other#configuration#requirements#are#met,#we#will #talk#more#about#this#a#little#bit#later. #
25
#For#more#information#about#RSLs#and#Resour ce#Bundles#we#recomme nd#readin g#the#Adobe#Fl ex#3#
Help#to#learn#how#you#can#create#cus tom#external#content#and#leverage#it#in#your#applications.#
Komentáře k této Příručce