Copy link to clipboard
Copied
Hi,
I'm working with animate cc html5 canvas.
My problem is that I would like to change a movie clip color when is touched, but with a code that works with both the mouse and on touch devices.
I do not use the "click" event because I need the MC to change when it is touched (for example if the finger clicked on another side on the screen but is swiping and passes over the MC)
I already saw that "mouseover" does not work on touch devices.
I also tried with HitTest (making an MC replace the mouse and putting the code there), but it does not help because I see that there is a delay in the speed in which an MC follows the cursor in the touch devices.
Hopes someone can help!
if you want to include all the different ways a mouse or finger can 'touch' a movieclip, i don't see any other way other than a hittest.
Copy link to clipboard
Copied
if you want to include all the different ways a mouse or finger can 'touch' a movieclip, i don't see any other way other than a hittest.
Copy link to clipboard
Copied
Ok thanks.
Copy link to clipboard
Copied
you're welcome.
Copy link to clipboard
Copied
Could you tell me if you know any way to optimize how an MC follows the mouse?
Works perfect on desktop but I've tested on several touchscreen devices and there is al lag that makes this solution (HitTest) not effective.
Does a rectangle movie clip following the mouse consume so many device resources ?
Note: if I upload the fps to 120, this solution works on desktop and mobile, but it is not the idea since the animations start working differently.
Copy link to clipboard
Copied
yes, it does. but if that movieclip is not changing frames, rotating, deforming or fading (ie, it just moves left-right-up-down), you can enable its cacheAsBitmap property and increase performance significantly:
movieclip.cacheAsBitmap=true;
Copy link to clipboard
Copied
Thanks, your answer is useful and I will do what you suggest for the moment,
but consuming so many device resources for such a simple action does not seem logical,
I hope to find a better alternative in the future.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now