Flex SpinnerList - 动画如何旋转?

时间:2012-08-10 07:14:24

标签: actionscript-3 flex mobile air

如何以编程方式设置组件SpinnerList(Flex mobile)的旋转,以便它可以旋转几秒钟,然后在选定的索引处停止?

1 个答案:

答案 0 :(得分:0)

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

}

} }