MACROMEDIA FLEX - DEVELOPING COMPONENTS AND THEMES Uživatelský manuál Strana 13

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 36
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 12
UNDERSTANDING+THE+FLEX+3+COMPONENT+AND+FRAMEWORK+LIFECYCLE!
13!
!
©!2009!DevelopmentArc!LLC,!All!rights!reserved.!
!
Figure'3')' Invalidation'/'Validation'Cycle'
Earlier!in!this!paper!we!talked!about!how!the!Flex!Framework!does!the!“wait!a!
frame”!for!us!to!manage!and!mitigate!performance!within!our!applications.!!The!
Invalidation‐Validation!cycle!is!the!first!place!in!the!component!lifecycle!that!really!
demonstrates!the!power!the!Flex!Framework!provides!us.!
The!Invalidation‐Validation!cycle!provides!a!decoupling!process.!!One!that!separates!
changing!of!values!(invalidating,!i.e.!making!the!old!values!no!long!valid)!from!
processing!values!(validating,!i.e.!applying!the!new!values).!!By!decoupling!this!
process!we!get!a!lot!of!added!benefits,!such!as!postponing!processor!heavy!
computation!until!the!last!possible!code!execution!stage!(just!before!the!player!
draws!to!the!screen)!and!preventing!unnecessary!code!from!being!executed!over!
and!over.!Let’s!look!at!an!example.!
myButton.width = 20;
myButton.width = 25;
Figure'4')' Setting'Width'Multiple'Times'Example'
In!the!code!above,!let’s!imagine!that!calling!the!width!setter!did!all!the!calculations!
to!update!the!component’s!size!right!away;!this!change!would!set!the!components!
Zobrazit stránku 12
1 2 ... 8 9 10 11 12 13 14 15 16 17 18 ... 35 36

Komentáře k této Příručce

Žádné komentáře