1203人阅读 评论(1) 收藏 举报

Tips for better transition and effect performance in Flex



Modern man is an impatient beast. When it comes to using new technology, we expect it to be fast, smooth and (mostly) efficient. Which is why few things can be more detrimental to the experience of a new digital product than slow or choppy performance.


Earlier in the week I wrote about the value of using transitions, effects and animations to create better user experiences in both web applications and desktop software. If you’re a Flex developer, like me, working to create great experiences in rich internet applications, here are a few tips that could improve your application’s performance when it comes to transitions:


  • Suspend Background Processing: The obvious performance boost. Most effect classes have a public property suspendBackgroundProcessing that when set to true will disable any background processing (measurement and layout calculations) while the effect is playing. This will also prevent your effect from being disrupted while playing, which means that if you’re waiting for an event to complete the effect, you might end up waiting a very, very, very, very long time.

暂挂后台的处理:这是最明显的性能提高,大部分的性能基类有一个称做suspendBackgroundProcessing 的共有属性,如果设置为TRUE ,那么当效果播放的时候,将暂缓任何后台的处理(测量以及布局计算),这样同样可以组织你的效果在播放的时候被打断,例如如果你在等待某个事件发生完成这个效果,你也许最后要等待很长很长的时间

  • Don’t Use Deferred Instantiation: Deferred instantiation is usually a good thing. It speeds up application launch time by preventing unnecessary instantiation of components before they are actually needed. Navigators like the ViewStack and TabNavigator use deferred instantiation automatically, loading child components only as they are needed. Unfortunately, this also gets in the way of smooth transition performance (at least for the first time that a transition is played) because instantiation will occur mid-transition. Setting the creationPolicy property to “all” on Containers and Navigators will mean an up-front hit in application load time, but better performance for transitions between views. Your call.

不要使用延迟的实例化:延迟的实例化通常是件好事情,它通过阻止不必要的组件在需要之前实例化从而能够加速程序的加载,导航器例如(VIEWSTACK,TABNAVIGAOR)自动使用延迟的实例化,只在需要的时候才去加载其子组件。很不幸的是这确实也妨碍了效果的顺畅播放,至少是效果第一次播放的时候,因为实例化在过渡效果的中途实例化,将属性creationPolicy 设置为ALL(对容器,导航器而言将意味着装载的时候全部完成实例化,转载时间也将延长,但是在不同的视图之间切换的时候获得更好的性能)你需要的

  • Hide Things That Don’t Need to Be Shown: Finally, you can and should hide any elements of your view that don’t need to be shown to the user during transition playback. This reduces the load on the CPU simply because there is less to animate.






源文档 <http://voisen.org/archives/2007/10/03/transition-tips/>


* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    • 访问:412763次
    • 积分:6684
    • 等级:
    • 排名:第3493名
    • 原创:218篇
    • 转载:17篇
    • 译文:19篇
    • 评论:68条