hello im trying to make my gotoAndStop button as swipe instead of onpress. but it only work once, the second frame i make is not working anymore and i dont know the error please help me , thanks
Multitouch.inputMode = MultitouchInputMode.GESTURE;
story1chapter3.addEventListener(TransformGestureEvent.GESTURE_SWIPE , onSwipe);
function onSwipe (e:TransformGestureEvent):void{
if (e.offsetX == 1) {
//User swiped towards right(back button)
story1chapter3.x += 100;
gotoAndStop(31);
}
if (e.offsetX == -1) {
//User swiped towards left(next)
story1chapter3.x -= 100;
gotoAndStop(159);
}
}
this code is working but when i try to make another code same as this in different frame its not working anymore, i also change the instance name so it wont dupplicate
Multitouch.inputMode = MultitouchInputMode.GESTURE;
story1chapter2.addEventListener(TransformGestureEvent.GESTURE_SWIPE , onSwipe);
function onSwipe2 (e:TransformGestureEvent):void{
if (e.offsetX == 1) {
//User swiped towards right(back button)
story1chapter2.x += 100;
gotoAndStop(30);
}
if (e.offsetX == -1) {
//User swiped towards left(next)
story1chapter1.x -= 100;
gotoAndStop(27);
}
}
PS i also try to change onSwipe2 to onSwipe , but error comes saying its duplicate