Flex的SpinnerList - 如何制作动画旋转?动画、Flex、SpinnerList

2023-09-08 15:11:38 作者:气质担当よ

如何以编程方式设置组件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?

解决方案 flash如何制作小动画 转动的风车

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();

}

} }