Flash 开发常见性能优化几 招
description
Transcript of Flash 开发常见性能优化几 招
Adobe.com ActionScript3.cn RIATraining.net
Flash 开发常见性能优化几招叶盛飞 天地会 id: MoonSpirit
Adobe.com ActionScript3.cn RIATraining.net
Topic Preview•Interval by Enterframe or Timer•Base-display by MovieClip or Sprite•Advance-display by DisplayObjects or BitmapData
View renderer
•Creation in once or beating•Layout by relative or absolute•Refresh upon removeAll or removePart•Update by binding or push•Listener in Strong or Weak referance
View management
•Integration by UIMovieClip or MovieClip•Assets-load by each or packed
View integration
Adobe.com ActionScript3.cn RIATraining.net
Part One View Renderer
Advance-display
• DisplayObje
cts or BitmapData
Base-display
• MovieClip or Sprite
Interval
• Enterframe or Timer
Adobe.com ActionScript3.cn RIATraining.net
Interval by Enterframe or Timer
EnterFrame Timer
Adobe.com ActionScript3.cn RIATraining.net
Base-display by MovieClip or Sprite
DisplayObject
Shape Sprite
MovieClip UIComponent
Canvas
Box
Choose what fit you most!
Adobe.com ActionScript3.cn RIATraining.net
Advance-display by DisplayObjects or BitmapData
DisplayObjects BitmapData
Adobe.com ActionScript3.cn RIATraining.net
Part TwoView Management
Creation• in once
or beating
Layout• by
relative or absolute
Refresh• upon
removeAll or removePart
Update• by binding
or push
Listener• in Strong or
Weak referance
Adobe.com ActionScript3.cn RIATraining.net
Creation in once or beating
Plenty of item to show on an
e-business page Plenty of Flags or signs to
layout on a map applicationVarieties of elems to init in a
game world
Create once all
Create part
Create part
Next Interval
…
Next Interval
Adobe.com ActionScript3.cn RIATraining.net
Layout by relative or absolute
Relative layout Absolute layout
changeabletendency static
tendency
Adobe.com ActionScript3.cn RIATraining.net
Refresh upon removeAll or removePart
Inventory
refreshSign
refresh
Form list refresh
Remove ALL
at once!
Create ALL at once!
Violent!
Check reserved
Remove
unnecessary
Create necessary
remain
Elegant!
xxx
refresh
Adobe.com ActionScript3.cn RIATraining.net
Update by binding or push
Global binding• (D)Framework reliable• (D)Least efficient in
running• (A)Most efficient in
development• (A)Do not care referance
Self-binding• (D)Least efficient
in running• (D)Care
referance• (A)no
Framework reliable
Pushing• (D)Care
referance • (D)Least
efficient in developing
• (A)Most efficient in running
• (A)No framework reliable
Adobe.com ActionScript3.cn RIATraining.net
Listener in weak or strong referance
Weak referance preferred
Manually remove listener preferred
Use global event properly
Adobe.com ActionScript3.cn RIATraining.net
Part ThreeView Integration
Integration
• by UIMovieClip or MovieClip
Assets-load
• by each or packed
Adobe.com ActionScript3.cn RIATraining.net
Integration by UIMovieClip or MovieClip
Flex framwork
MovieClip
UIMovieClip UIComponent
1
2 3
CPU leak!
Adobe.com ActionScript3.cn RIATraining.net
Assets-load by each or packed
By each By packed
handler many several
bandwidth cost much subtle
preload management difficult easy
modification cost low high
preferred situation any time final release