Skip to main content
Inspiring
July 28, 2016
Answered

How to swipe particular area only in Air for IOS

  • July 28, 2016
  • 1 reply
  • 282 views

Dear Friends,

iam creating an app for iOS using Air and AS3. I have a strip below my screen in that I have set of buttons to click and go to particular lessons. iam creating swiping for those buttons. I have this below code:

Multitouch.inputMode = MultitouchInputMode.GESTURE;

stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler);

function fl_SwipeHandler(event:TransformGestureEvent):void

{

switch(event.offsetX)

{

  // swiped right

  case 1:

  {

   sw_area.buttons.x += 20;

   break;

  }

  // swiped left

  case -1:

  {

   sw_area.buttons.x -= 20;

   break;

  }

}

}

The above code makes the buttons inside the swipe area strip to move while swiping on the stage... I want the user to swipe on the swipe area strip available blow and move the buttons. if user swipes on the stage it should not move. how can I do it? pls help me friends.

I changed like

sw_area.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler);

it is not working. pls help me to fix this.

Thanks in Advance,

Syed Abdul Rahim

This topic has been closed for replies.
Correct answer rahimhaji

hi friends,

I solved it, may be usful to others.. I used stageY to control.

Multitouch.inputMode = MultitouchInputMode.GESTURE;

stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler);

function fl_SwipeHandler(event:TransformGestureEvent):void

{

switch(event.offsetX)

{

  // swiped right

  case 1:

  {

     if ( event.stageY > 650) {

        sw_area.buttons.x += 20;

     }

        break;

  }

  // swiped left

  case -1:

  {

     if ( event.stageY > 650) {

        sw_area.buttons.x -= 20;

     }

        break;

  }

}

}

1 reply

rahimhajiAuthorCorrect answer
Inspiring
July 28, 2016

hi friends,

I solved it, may be usful to others.. I used stageY to control.

Multitouch.inputMode = MultitouchInputMode.GESTURE;

stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler);

function fl_SwipeHandler(event:TransformGestureEvent):void

{

switch(event.offsetX)

{

  // swiped right

  case 1:

  {

     if ( event.stageY > 650) {

        sw_area.buttons.x += 20;

     }

        break;

  }

  // swiped left

  case -1:

  {

     if ( event.stageY > 650) {

        sw_area.buttons.x -= 20;

     }

        break;

  }

}

}