Skip to main content
Lars Laborious
Legend
January 17, 2019
Question

Touch events in Animate

  • January 17, 2019
  • 2 replies
  • 1963 views

Hi, all.

In my previous apps I've used mouse events, but for my latest I've decided to go for touch events, mainly because mouse events don't work if you accidentally touch the screen with a finger holding your device while tapping a button with the other.

However, I'm using Animate and have to activate the touch layer on the simulator each time I test the app.  Does anyone have a best practice on dealing with touch events in Animate? Btw I'm using a PC. It would be nice to be able to change the default settings for the simulator, so it opens with a touch layer and turns it's alpha down.

This topic has been closed for replies.

2 replies

Known Participant
January 29, 2019

I just compile to the iPad from Animate every time. I think that testing multi touch is much easier when you are using a real device instead of a simulator. Setting the Device deployment type in Animate settings to "Device testing in interpreter mode" makes in compile really fast.

However sometimes I wan't the app to act differently in windows. I have a static class "Project". When I initialize the class I just determinate if the app is running in windows (running simulator) or not.

Like this:

import flash.system.Capabilities;

------

var myOS:String;= Capabilities.os.toLowerCase();

if(myOS.indexOf("windows ", 0) >= 0) {

     isSimulator = true;

} else {

     isSimulator = false;

}

Then I can just call the static variable Project.isSimulator before adding code that should only work in the simulator in windows.

Lars Laborious
Legend
January 29, 2019

Rolf_Rahbek, thanks for your suggestions. Compiling to a device is a good option, however while debugging I find it easier to test from within Animate being able to check the Output and Compiler Errors. When testing on a device I use Scout, but it's a bit cumbersome to track down errors.

Known Participant
January 29, 2019

OK, but you can still get your traces and runtime errors in the Output in Animate when the app is tested on the iPad.

In Adobe Animate: Just select "Debug" in the main menu, then 'Debug movie" and then choose you iPad.

Colin Holgate
Inspiring
January 17, 2019

As far as I know there isn't a way to make it default to that. I sometimes have both touch and mouse listeners, and a variable to say which I'm using. That way I can test with a mouse, then switch to touch for testing on devices.

Lars Laborious
Legend
January 18, 2019

Colin, I've thought about doing the same, but isn't it an extensive task to clean up all the mouse listeners + functions when you finally deploy the app? I guess it depends on how complex the app is, though.

Colin Holgate
Inspiring
January 18, 2019

I leave them in. They're doing no harm.