Highlighted

Touch events in Animate

Enthusiast ,
Jan 17, 2019

Copy link to clipboard

Copied

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.

TOPICS
Development

Views

649

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Touch events in Animate

Enthusiast ,
Jan 17, 2019

Copy link to clipboard

Copied

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.

TOPICS
Development

Views

650

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 17, 2019 0
Adobe Community Professional ,
Jan 17, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 17, 2019 1
Enthusiast ,
Jan 17, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 17, 2019 0
Adobe Community Professional ,
Jan 18, 2019

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 18, 2019 1
Enthusiast ,
Jan 20, 2019

Copy link to clipboard

Copied

True Except for a larger code, though. You would have double up of every listeners and corresponding functions.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 20, 2019 0
Explorer ,
Jan 29, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 29, 2019 1
Enthusiast ,
Jan 29, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 29, 2019 0
Explorer ,
Jan 29, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 29, 2019 0
Enthusiast ,
Jan 29, 2019

Copy link to clipboard

Copied

True, but the app tend to crash after a while when I do that. Might have to do with my computer, though, or perhaps something in the settings I've overlooked. I think I'll explore it a bit more.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 29, 2019 0