Ive been working on a script to scroll like an android, so far the script can fling pretty good, it can also detect if you let go of it to late, so it stops flinging, it doesnt work good on pc unless you release it abnormally quick, you have to test it on your device to get the full effect, feel free to improve upon this open source script, this script needs improvement on where sometimes if you release it kind of late and it shouldn't fling anymore it still flings, it uses second-precise accuracy but really, it needs millisecond-precise accuracy:
(all you need to get this script working is a movieclip on the stage with the name grab)
var xpos=0;
var ypos=0;
var cursorState="up";
var directionMove="down";
var mmCount=0;
var positionToLongCount;
var yold=0;
var ynew=0;
var start_y:Number=0;
var end_y:Number=0;
stage.addEventListener(MouseEvent.MOUSE_DOWN,md);
stage.addEventListener(MouseEvent.MOUSE_UP,mu);
stage.addEventListener(MouseEvent.MOUSE_MOVE,mm);
function md(e:*){
start_y=stage.mouseY
cursorState="down";
grab.startDrag(false,new Rectangle(grab.x,ypos,0,stage.stageHeight));
}
function mm(e:*){
mmCount++;
if(mmCount%4==0){
yold=grab.y
}
if(mmCount%2==0){
ynew=grab.y
if(ynew>yold){
if(directionMove!="up"){
tl=0;
}
directionMove="up";
}
if(ynew<yold){
if(directionMove!="down"){
tl=0;
}
directionMove="down";
}
}
if(cursorState=="down"){
}
}
function mu(e:*){
end_y=stage.mouseY;
cursorState="up";
positionToLongCount=0;
grab.stopDrag();
}
var tl=0;
stage.addEventListener(Event.ENTER_FRAME,recurse);
var dup_pos={};
function recurse(e:*){
if(dup_pos[grab.y]==undefined){
dup_pos[grab.y]=0;
}
if(cursorState=="down"&& dup_pos[grab.y]<2){
dup_pos[grab.y]+=1;
positionToLongCount++;
}
if(cursorState=="down"&& dup_pos[grab.y]>=2){
positionToLongCount=0;
tl=0;
delete dup_pos[grab.y];
start_y=-0.1;
end_y=-0.1;
}
if(cursorState=="up"&&tl>-1){
if(start_y!=-0.1){
if(start_y>end_y){
tl=start_y-end_y;
}else{
tl=end_y-start_y
}
start_y=-0.1;
}
if(directionMove=="up"){
grab.y+=tl;
tl-=tl/10
}else{
grab.y-=tl;
tl-=tl/10
}
}
if(grab.y>stage.stageHeight){
grab.y=stage.stageHeight-grab.height;
}
if(grab.y+grab.height<0){
grab.y=0;
}
}