Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Change a movie clip when is touched (not clicked)

Community Beginner ,
Jun 27, 2017 Jun 27, 2017

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!

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

correct answers 1 Correct answer

Community Expert , Jun 27, 2017 Jun 27, 2017

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.

Translate
Community Expert ,
Jun 27, 2017 Jun 27, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 27, 2017 Jun 27, 2017

Ok thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 27, 2017 Jun 27, 2017

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 28, 2017 Jun 28, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 28, 2017 Jun 28, 2017

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;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 28, 2017 Jun 28, 2017
LATEST

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.

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