Air-Mobile-ScrollController is a library to control the scrolling process of an application. The library handles all the scrolling manipulation of the content, producing a smooth result that reassembles the native scroll movement. It has an API for mobile and web applications.
The library works based on two rectangles, one representing the content and the other one acting as a container. It’s possible to individually control horizontal and vertical scrolling, as well as read the current position in the scrolling area. There are several methods to smoothly scroll to a specific position, e.g. the origin. An animation is used to transition between any scrolling positions.
Sample
package com.freshplanet.lib.ui.scroll.mobile.example { import com.freshplanet.lib.ui.example.util.RectangleSprite; import com.freshplanet.lib.ui.scroll.mobile.ScrollController; import flash.display.Sprite; import flash.events.Event; import flash.geom.Rectangle; public class ScrollControllerExample extends Sprite { private var _scroll:ScrollController; public function ScrollControllerExample() { super(); this.addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage); this.addEventListener(Event.REMOVED_FROM_STAGE, this.onRemovedFromStage); } private function onAddedToStage(e:Event):void { this.removeEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage); var container:RectangleSprite = new RectangleSprite(0x440000, 50, 50, this.stage.stageWidth - 100, this.stage.stageHeight - 100);//red background this.addChild(container); var content:RectangleSprite = new RectangleSprite(0x444477, 0, 0, this.stage.stageWidth - 100, this.stage.stageHeight * 2, 30);//blue foreground container.addChild(content); var containerViewport:Rectangle = new Rectangle(0, 0, this.stage.stageWidth - 100, this.stage.stageHeight - 100); this._scroll = new ScrollController(); this._scroll.horizontalScrollingEnabled = false; this._scroll.addScrollControll(content, container, containerViewport); } private function onRemovedFromStage(e:Event):void { this.removeEventListener(Event.REMOVED_FROM_STAGE, this.onRemovedFromStage); this._scroll.removeScrollControll(); } } }
RT @as3gamegears: New: Air-Mobile-ScrollController (lib to control the scrolling process on mobile and web) http://t.co/hSORtWeZCs #as3 #fl…
I have a movieclip and I want to add horizontal scroll to it. Can it be done using this. If yes, how? Please help.
I think it’s possible. I haven’t played with that lib yet, so I can’t answer. Try pinging @freshplanet and ask for help.