質問

I am looking to make my cross platform mobile application more native-feeling and I was wondering if there was a way to modify the way the Spark Scroller behaves on overscroll (when the user scrolls beyond the bounds of the viewport). Basically, the current implementation matches iOS almost exactly but feels out of place on Android (iOS "bounces", showing area not in the viewport. Android stops at the bounds of the viewport and the edges glow).

Is there a built in way to modify this behavior? I have not come across any options yet, but I would like to make sure that is the case before I go and extend Scroller to try to add such functionality.

役に立ちましたか?

解決

You can kill the pull and bounce effects pretty easily with this:

scroller.mx_internal::bounceEnabled = false;
scroller.mx_internal::pullEnabled = false;

I do not think you can prevent the user from scrolling past the edges very easily though. It looks like you'll want to extend Scroller and override the method:

mx_internal function performDrag(dragX:Number, dragY:Number):void

Let the super.performDrag() run and then check to see if viewport.horizontalScrollPosition or viewport.verticalScrollPosition are out of bounds (< 0 or > (height/width - contentWidth/Height)).

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top