treylok
treylok

Reputation: 13

Flex 4.6 Scroller - Is it possible to disable scrolling temporarily through Actionscript?

I am trying to make a mobile app that would allow a drag and drop of certain elements using startDrag() and stopDrag(). These elements are enclosed inside of a spark scroller. I would like to disable the scroller when someone is interacting with the draggable objects, but can't seem to get the scroller to not respond.

Here are the things I have tried.

protected function draggableObjectOnMouseBegin(e:MouseEvent):void {
    scrollerObject.enabled = false;
    scrollerObject.mouseEnabled = false;
    scrollerObject.mouseFocusEnabled = false;
    draggableObject.setElementIndex(e.currentTarget as IVisualElement, dragabbleObjectGroup.numElements-1);
    e.currentTarget.startDrag();
}

But the scroller will not stop scrolling. Am I missing something or is there no wat to temporarily stop a scrollers ability to scroll to allow for drag and drop type operations on objects enclosed in a scroller.

Upvotes: 1

Views: 3255

Answers (1)

Jamie
Jamie

Reputation: 56

I just trying to do exactly this this myself and I think I have a working answer.

What you need to do is set the verticalScrollPolicy (and/or horizontal). You do this via the setStyle method:

scrollerObject.setStyle('verticalScrollPolicy', ScrollPolicy.OFF);

Obviously to re-enable scrolling just set the policy back to ON.

Upvotes: 4

Related Questions