Skip to main content
Known Participant
July 7, 2011
Question

Can I make a button respond to Touch while using Gestures?

  • July 7, 2011
  • 1 reply
  • 790 views

Hi, I've recently discovered I'm unable to use Touch Points and Gestures at the same time on mobile apps.

I would rather use Gestures so I'm wondering if anyone can help with making buttons respond to the user when they are touched.

Here's what I'm trying to do but the buttons are not changing alpha values:

mainMenu.menuPres.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);

mainMenu.menuPres.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);

function mouseDownHandler(event:TouchEvent):void {

TweenLite.to(mainMenu.menuPres, .2, {alpha:.5});

}

function mouseUpHandler(event:TouchEvent):void {

TweenLite.to(mainMenu.menuPres, .2, {alpha:1});

}

Is there another way I can do this or can this method be refined?

Thanks

This topic has been closed for replies.

1 reply

Pahup
Adobe Employee
Adobe Employee
July 7, 2011

Hi Mike,

That's right, MultiTouch and Gestures can not be used at the same time, but you should always be able to receive mouse events for 1st touch point.

Could you try changing your code as below.

function mouseDownHandler(event:MouseEvent):void {

TweenLite.to(mainMenu.menuPres, .2, {alpha:.5});

}

function mouseUpHandler(event:MouseEvent):void {

TweenLite.to(mainMenu.menuPres, .2, {alpha:1});

}

please sprinkle some trace statements in event handler to see if they get triggered.

Also, did you try just adding event listener for MouseEvent.CLICK, instead of MOUSE_DOWN and MOUSE_UP.

-Thanks

Pahup

Known Participant
July 7, 2011

Hi Pahup

Thanks for getting back to me... okay so the trace statements are working no problems.

The Tweenlite command to tween the alpha is not working though and I'm not sure why as I'm using Tweenlite on my Swipe Gestures. So that tells me it's not having a problem with the Tweenlite class but the iPad is not responding by changing the alpha when the buttons are pushed.

Any thoughts?