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