FLEX中提高效果和过渡效果性能的技巧

Tips for better transition and effect performance in Flex

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:

早些时候,我曾经写过一篇关于过渡效果,效果,动画价值的文章,其优点在于能够基于桌面和网络应用创建更好的用户体验的软件。如果你是一个FLEX开发者,从事于创建高超用户体验的丰富体验因特网应用,那么这里有一些建议,在你提高你的应用的性能的时候也许能用到,特别是过渡效果

  • 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.

隐藏那些你不需要显示的东西:最后你应该将那些你不需要显示(在过渡效果播放的时候)的东西隐藏起来,这将会减轻CPU的负担因为要计算的东西少了

 

我的评价,这是一篇很短小精悍的金玉良言,总结一下其实就是两个属性(黑体),一点技巧。你掌握了吗?

 

 

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

 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值