1

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. ^_^

4

1 回答 1

0

只是一个建议(虽然我自己还没有尝试过),滑动体验真的取决于影片剪辑(或内容)的大小。

所以,也许不是使用固定数字 60,您可以使用类似dgSubject.height / 3. (3,这样您将通过 3 次滑动到达终点)。

只是想扔一些东西来引发更多的思考。

另外,我刚刚找到以下链接: http://www.greensock.com/throwprops/ http://www.swfgeek.net/2011/09/08/greensocks-throwpropsplugin-ipad-test/

看看他们是否解决了你的问题

于 2013-12-13T02:14:45.850 回答