Skip to main content
RyanS_Extron4075776
Inspiring
January 4, 2019
Question

Adobe Animate CC JavaScript Code Causing Double Clicking In Mobile

  • January 4, 2019
  • 1 reply
  • 999 views

I was told to place this code into Adobe Animate in order to allow mousedown and clicks to work for mobile:

// Enable touch events while allowing the touch events to bubble up to the document.

createjs.Touch.enable( stage, false, true );

// Don't let the stage to automatically prevent default touch events.

stage.preventSelection = false;

This is a sample event listener:

this.HoldChBx.addEventListener("click", CheckBoxClickHandler.bind(this,"Hold"));

The problem is that when I press a button in mobile, it actually double clicks. For example, I have a checkbox. I click for the check to show, but then another click happens again automatically to make the check go away. I don't know why this is happening. I don't have this problem when I try it on my desktop using a mouse. This is bizarre.

I am need stage.preventSelection = false so that the user can still zoom in and out using pinch.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
January 5, 2019

use a mousedown event.

RyanS_Extron4075776
Inspiring
January 9, 2019

The problem is that if the user doesn't press down long enough, it has the same issue as using a click event. For example:

this.SelectHold.addEventListener("mousedown", Button_MouseDown.bind(this));

this.SelectHold.addEventListener("pressup", Button_MouseUp.bind(this));

If I press the mouse down and then release quickly, then it reacts the same way as the click event, as if I clicked twice.

kglad
Community Expert
Community Expert
January 9, 2019

i don't see a problem, test1_Canvas