Flex SpinnerList - how animate spin?

2019-09-04 07:24发布

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?

1条回答
Summer. ? 凉城
2楼-- · 2019-09-04 07:50
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();

}

} }

查看更多
登录 后发表回答