Event Click On MovieClips Mask (Non Transparent Area) - actionscript-3

I'm working with Flash CS6 to create MovieClips that I want to use in my AS3 project using Linked Classes, I'm trying to detect when the mouse is clicking the MovieClip, but the event is fired also when I click the transparent area of the PNG image used to create the MovieClip, and I want to fire the event only when I click the non transparent area of the Movieclip (the mask), is there any work around I can do in Flash CS5 or with AS3 code !

You should add an instance name to the mask (which means it must be a symbol), and then add listener directly on the mask, not on the whole movie clip.
Another solution is to set mouseEnabled and mouseChildren to false on that bitmap, and leave only the area you wish to be clickable.

Related

Its possible do a hole in movieclip with mouse click?

I have a movieclip moving and when I click him I want that appears a hole.
Its possible do that with actionscript? how?
If your hole should appear there the mouse clicks, you could create new Sprite, draw two circles (one bigger than your MovieClip, another at size of you hole, both at position of your click) using his graphics property. Fill it with any color. It should look like donut.
After that assign created Sprite as a mask for your MovieClip.
youMovieClipId.mask=createdSpriteId;
After that, you could add mask as child of your MovieClip, using
youMovieClipId.addChild(createdSpriteId);
Now created mask will follow your MovieClip.

Custom cursor issue with nested movieclips

I made a custom cursor and add mouse event listeners to it, so it can animate according to mouse clicks (Up/Down) and also hide after 4 seconds if the user didn't click or move the mouse.
The custom cursor was working OK, but after loading external SWF to the container I found that custom cursor event listeners is not working with all movie clips on the child SWF (external loaded SWF). So It is not animating with mouse events and not resetting hide timer, which causing mouse to hide even if the user are moving or clicking it.
The hierarchy of movie clips as follows:
-- Scene 1
-- container's Buttons and controls MCs
-- myLoader content //added under the controls MC
-- content_mc //contains the child movie clips
-- child's movie clips //contains animations and simple buttons
I tried to set
myLoader.mouseChildren = false;
This solves the custom cursor issue but also blocked all mouse events on the child SWF and make all child's buttons unclickable.
So, I wonder if you can help me finding a way to make the custom cursor events working with the nested movie clips without blocking the nested movie clips mouse events.
You should find that if you place the listener at the top level class and set capture to true you should get all the events you need

Flash CS6 AS3: Click listener on overlapping movieclips only fires top movieclip

I have several Movieclips which overlap one another, each one has a different graphic of a body part. I would like the user to be able to click on a body part and it highlights.
I've set up event listeners to detect a click on the movieclips and to then apply a colorTransform. The problem is that the top movieclip also gets selected, and not the one's below even though the movieclips have transparent BitMap (PNG) images in them.
Is there a way I can create the hotspots to support only opaque pixels?

Actionscript 2.0 and 3.0: Dragging Dynamic Image and not being replaced by another

I have a function that displays an image on top of a movie clip but when you click another image, it of course replaces the current image. I don't know how to stop it from replacing the image, that way I can make an image appear and drag it over somewhere on the stage and then make a different image appear and drag that somewhere else, too. and what is the drag event for Actionscript 3.0.
Sprite or MovieClip startDrag() and stopDrag() methods.
also i don't understand the following:
function that displays an image on top of a movie clip but when you click another image, it of course replaces the current image
how do images get inside of your swf (library, embed, loader)?
why are they replacing each other on MouseEvent.CLICK?
according to my current vision of your problem Event.stopImmediatePropagation() or Event.stopPropagation() in MouseEvent.CLICK handler function may help

erasing a movieclip

I have a fully working flash application, made in as3. Now i dynamicly added a movieclip and i would like to be able to erase that movieclip with a eraser of some sort, my goal is to be able pick up a sponge with the mouse and then start dragging over the movieclip and erasing the parts where i dragged over it.
Anyone who can help?
Looks like this might be what you're looking for:
http://www.piterwilson.com/personal/2008/05/07/bitmapdata-erasing-in-as3-with-custom-brush-shape/
Is the background behind the MovieClip always the same?
If so you can put an image of the background over the MovieClip you want to erase, and mask that image so it becomes invisible, then add a click listener that draws a circle in the mask when clicked. This way it'll look like the MovieClip is being erased.
With getPixel you can loop over the mask and detect the percentage of the MovieClip that has been erased, so you can remove the clip from stage when it's fully erased.