MACROMEDIA FLEX - DEVELOPING COMPONENTS AND THEMES Manuale Utente Pagina 7

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 36
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 6
UNDERSTANDING+THE+FLEX+3+COMPONENT+AND+FRAMEWORK+LIFECYCLE!
7!
!
©!2009!DevelopmentArc!LLC,!All!rights!reserved.!
Sean!has!augmented!the!racetrack!by!bringing!in!the!concept!of!what!he!calls!“The!
Marshal”.!!The!core!difference!between!the!old!virtual!machine!(AVM1)!and!AVM2!is!
that!AVM1!worked!solely!on!a!split!frame!environment.!!The!AVM2’s!Marshal!!
is#responsible#for#carving#out#time#slices#for#the#Flash#Player#to#operate#on.#Its#
important#to#clarify#up#front#that#these#time#slices#are#not#the#same#thing#as#the#
framerate#compiled#into#a#swf#…#the#player#ultimately#synthesizes#a#framerate#
from#these#slices!
!
These!slices!are!broken!into!multiple!steps:!player!event!dispatching,!user!code!
execution,!pre‐render!event!dispatching,!user!code!execution!(post!pre‐render),!and!
finally!player!rendering.!!Sean!explores!how!these!steps!are!processed,!when!they!
are!executed!and!how!frame!rate!can!modify!which!step(s)!are!executed!and!when.!
We!highly!recommend!reading!both!articles!before!continuing!on!with!this!
document!because!we!will!consistently!refer!to!frames!and!how!the!Flex!Framework!
leverages!this!system.!
4
!
Managing+the+Racetrack+
The!code!execution!and!display!rendering!of!content!can!take!a!lot!of!time!to!
complete,!and!the!more!complex!the!code!and/or!the!display!changes!are,!the!longer!
the!frame!may!take!to!render.!!One!of!the!most!common!undesirable!developer!
experiences!with!the!elastic!racetrack!is!animation!performance!lagging!as!large!
amounts!of!data!is!being!processed.!
For!example,!on!a!client!project!DevelopmentArc!created!a!loading!animation!that!
was!using!Flex’s!Tween!system.!Running!by!itself!the!loading!animation!looked!
great,!but!as!soon!as!we!made!our!call!to!load!server!data,!the!animation!became!
extremely!choppy.!!The!cause!of!this!performance!issue!was!that!we!were!asking!the!
player!to!parse!a!large!amount!of!XML!data!coming!back!from!the!server!and,!at!the!
same!time,!attempting!to!programmatically!make!an!animation!move!across!the!
screen.!
What!we!had!done!was!overload!the!players!code!side!of!the!racetrack!(frame),!
therefore!causing!the!player!to!spend!too!much!time!calculating!per!cycle!and!not!
enough!time!rendering.!This!meant!that!the!player!couldn’t!meet!the!frame!rate!
required!to!display!a!smooth!animation!because!most!of!the!time!was!dedicated!to!
calculation.!!Ted’s!final!comment!from!the!racetrack!post!says!it!all:!
As#it#has#been#said#many#times#before,#"Just#wait#a#frame!"#
This!leads!us!back!to!the!Flex!Framework.!!Due!to!the!shear!complexity!of!the!Flex!
Framework,!imagine!how!it!would!perform!it!if!had!to!handle!nested!layout!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
4
#For#simplicity#we#will#consider#a #frame#and#slice#to #be#interchangeable,#even#though #on#a#technical#
level#this#may#not# always#be#true.#
Vedere la pagina 6
1 2 3 4 5 6 7 8 9 10 11 12 ... 35 36

Commenti su questo manuale

Nessun commento