Skip to main content
Inspiring
December 19, 2019
解決済み

Mouse Events Not Working for PNGs in MovieClips - Works for Vector Shapes

  • December 19, 2019
  • 返信数 1.
  • 1041 ビュー

When I use the code below for a vector shape in a MovieClip, it works, but when I do the same exact thing where a png is used instead of a shape, nothing happens and the JavaScript breaks down. How can I do the same thing with pngs that I am able to do with vector shapes created in Animate? Thanks.

this.pngMe.on("pressmove", function(event) {
    var p = this.globalToLocal(stage.mouseX, stage.mouseY);
    this.pngMe.x = p.x;
    this.pngMe.y = p.y;	
}, this);

 

このトピックへの返信は締め切られました。
解決に役立った回答 ClayUUID

Just now I went to Control > Test, and it worked. The Test Movie has In Browser checked, so I didn't even need to test it in Animate. I guess the problem has to do with how it's being published, because that's when it doesn't work.


You know how Animate likes to spam this message in the Output window when you test an HTML5 Canvas document?

Content with both Bitmaps and Buttons may generate local security errors in some browsers if run from the local file system.

A bitmap with a mouse event handler is basically a button. So... yeah.

返信数 1

sumanr49634048
Known Participant
December 20, 2019

HI,
its works vector space or png inside of Movieclip

Inspiring
December 20, 2019

It didn't work for me when I replaced a vector shape with a png inside a MovieClip.

Legend
December 20, 2019

I just tried it, and it worked perfectly when I replaced a vector shape with a PNG inside a movieclip. Tested in both Animate 18 and 20.