Flex的SpinnerList - 如何制作动画旋转? [英] Flex SpinnerList - how animate spin?
本文介绍了Flex的SpinnerList - 如何制作动画旋转?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何以编程方式设置组件SpinnerList(Flex移动)的旋转,以便它可以旋转几秒钟,然后停在选定的指数?
解决方案
私有函数scrollToIndex(索引:INT,animationDuration:INT = 1000):无效{
如果((指数= -1)及!&安培;!(list.layout =空)){
VAR spDelta:点= list.dataGroup.layout.getScrollPositionDeltaToElement(指数);
如果((spDelta =空)及!&安培;!(spDelta.y = 0)){
VAR目标:DataGroup的= list.dataGroup;
VAR动画:的animateProperty =新的animateProperty(目标);
animation.property =verticalScrollPosition的;
animation.duration = animationDuration;
animation.toValue = target.verticalScrollPosition + spDelta.y;
animation.play();
}
} }
How to programmatically set the spin of component SpinnerList (Flex mobile) so that it can spin for a few seconds and then stopped at selected index?
解决方案
private function scrollToIndex(index:int, animationDuration:int = 1000):void {
if ((index != -1) && (list.layout != null)) {
var spDelta:Point = list.dataGroup.layout.getScrollPositionDeltaToElement(index);
if ((spDelta != null) && (spDelta.y != 0)) {
var target:DataGroup = list.dataGroup;
var animation:AnimateProperty = new AnimateProperty(target);
animation.property = "verticalScrollPosition";
animation.duration = animationDuration;
animation.toValue = target.verticalScrollPosition + spDelta.y;
animation.play();
}
} }
这篇关于Flex的SpinnerList - 如何制作动画旋转?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文