[COLOR=#333333][FONT=Verdana]Hi,[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]I am using some of the code in one of the default templates in Air for Android. Using the code, you can swipe the screen left or right and it’ll move the menu left or right accordingly. I’m having a problem though, in that if you swipe quickly back and forth across the screen, eventually it’ll end up with the menu being all off centre and such.[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]What i’m looking for is to disable swiping until the menu has “finished” moving left or right, if that makes sense. Kind of like using mouseEnabled = false; while it’s moving, but a touchscreen equivilent if there is one.[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]Any help with this would be appreciated… here’s the code i’m using:
[/FONT][/COLOR]
var currentmenu_main:Number = 1;var totalmenu_main:Number = 4;
menu_main.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousFramemenu_main);
function fl_SwipeToGoToNextPreviousFramemenu_main(event:TransformGestureEvent):void
{
if(event.offsetX == 1)
{
if(currentmenu_main > 1){
currentmenu_main--;
slideRightmenu_main();
}
}
else if(event.offsetX == -1)
{
if(currentmenu_main < totalmenu_main){
currentmenu_main++;
slideLeftmenu_main();
}
}
}
var slideCountermenu_main:Number = 0;
function slideLeftmenu_main(){
menu_main.addEventListener("enterFrame", movemenu_mainLeft);
}
function slideRightmenu_main(){
menu_main.addEventListener("enterFrame", movemenu_mainRight);
}
function movemenu_mainLeft(evt:Event){
menu_main.x -= 32;
slideCountermenu_main++;
if(slideCountermenu_main == 10){
menu_main.removeEventListener("enterFrame", movemenu_mainLeft);
slideCountermenu_main = 0;
}
}
function movemenu_mainRight(evt:Event){
menu_main.x += 32;
slideCountermenu_main++;
if(slideCountermenu_main == 10){
menu_main.removeEventListener("enterFrame", movemenu_mainRight);
slideCountermenu_main = 0;
}
}
[COLOR=#333333][FONT=Verdana]
[/FONT][/COLOR]