I've been trying to figure out for days now how to get the smooth scrolling on a touch device as all other apps have.. For the time being I've implemented this:
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler);
function fl_SwipeHandler(event:TransformGestureEvent):void
{
switch(event.offsetX)
{
// swiped right
case 1:
{
// Start your custom code
// This example code moves the selected object 20 pixels to the right.
// End your custom code
break;
}
// swiped left
case -1:
{
// Start your custom code
// This example code moves the selected object 20 pixels to the left.
// End your custom code
break;
}
}
switch(event.offsetY)
{
// swiped down
case 1:
{
// Start your custom code
// This example code moves the selected object 20 pixels down.
if (PActive == true) {
dgPlace.verticalScrollPosition = dgPlace.verticalScrollPosition - 60;
}
if (SActive == true) {
dgSubject.verticalScrollPosition = dgSubject.verticalScrollPosition - 60;
}
if (OActive == true) {
dgObject.verticalScrollPosition = dgObject.verticalScrollPosition - 60;
}
if (FActive == true) {
dgFeeling.verticalScrollPosition = dgFeeling.verticalScrollPosition - 60;
}
if (AActive == true) {
dgAction.verticalScrollPosition = dgAction.verticalScrollPosition - 60;
}
if (NActive == true) {
dg.verticalScrollPosition = dg.verticalScrollPosition - 60;
}
// End your custom code
break;
}
// swiped up
case -1:
{
// Start your custom code
// This example code moves the selected object 20 pixels up.
if (PActive == true) {
dgPlace.verticalScrollPosition = dgPlace.verticalScrollPosition + 60;
}
if (SActive == true) {
dgSubject.verticalScrollPosition = dgSubject.verticalScrollPosition + 60;
}
if (OActive == true) {
dgObject.verticalScrollPosition = dgObject.verticalScrollPosition + 60;
}
if (FActive == true) {
dgFeeling.verticalScrollPosition = dgFeeling.verticalScrollPosition + 60;
}
if (AActive == true) {
dgAction.verticalScrollPosition = dgAction.verticalScrollPosition + 60;
}
if (NActive == true) {
dg.verticalScrollPosition = dg.verticalScrollPosition + 60;
}
// End your custom code
break;
}
}
Which basically just says that if a swipe occurs then scroll the active datagrid up or down by 60 units which is 2 rows. Please if anyone has any idea how to do this, I would greatly appreciate the help. ^_^