我一直在努力弄清楚如何在触控设备上顺利滚动所有其他应用程序..暂时我实现了这个:
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;
}
}
基本上只是说如果发生滑动,则将活动数据网格向上或向下滚动60个单位,即2行。如果有人知道如何做到这一点,我将非常感谢帮助。 ^ _ ^
答案 0 :(得分:0)
只是一个建议(虽然我自己还没有尝试过),滑动体验实际上取决于影片剪辑(或内容)的大小。
因此,您可以使用类似dgSubject.height / 3
的内容,而不是使用固定数字60。 (3这样你就可以通过3次滑动来结束)。
只想抛出一些东西来引发更多思考。
另外,我刚刚找到以下链接: http://www.greensock.com/throwprops/ http://www.swfgeek.net/2011/09/08/greensocks-throwpropsplugin-ipad-test/
看看他们是否解决了您的问题