Scroll (Vertical)

The ‘vertical scroll’ gesture tracks the vertical magnitude of change and returns a numerical value that can be passed to an element to change its vertical position.
Using the Vertical Scroll Gesture
The ‘vertical scroll’ gesture is typically used to scroll an element right and left or to create vertical scrollbars.
Mechanics and Code Samples
To register a ‘vertical scroll’ event, two fingers on the touch screen surface at the same time, vertically positioned to one another, and then one must drag them across the screen surface vertically.
1 | txtArea.addEventListener(GestureEvent.GESTURE_SCROLL, txtArea_scrollHandler); |
1 2 3 4 5 6 7 8 | private function txtArea_scrollHandler(event:GestureEvent):void { var value:Number = (txtArea.verticalScrollPosition + event.scrollY); txtArea.verticalScrollPosition = value > txtArea.maxVerticalScrollPosition ? txtArea.maxVerticalScrollPosition : value < 0 ? 0 : value; } |
Parameters
All touch and gesture events have a localX and localY (relative) position as well as a stageX and stageY (absolute) position.
Related Tutorials
Associated Tutorials
How To Create a Flex Application Using the Multitouch Gesture Scroll (Flex tutorial)
