Its possible do a hole in movieclip with mouse click? - actionscript-3

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.

Related

How to put a sprite behind other sprites in pygame?

I want to put a sprite on screen, but I want it in the back layer behind other sprites, so that it does not cover up those sprites when they pass by each other.
How would I go about doing this?
One way is to just blit the Surface/Sprite that should go to the background before the other Surface/Sprite that should go to the foreground.
If you use the Sprite class, you could also use the LayeredUpdates or LayeredDirty groups to handle this for you by using a layer attribute or kwarg when adding the Sprite to the group.

How to manipulate a movieclip inside another movieclip independently

So, I am trying to make a flash game with a bomber plane with a rear-gunner. I have made the plane a movieclip and, inside that, have the gunner movieclip. I am trying to use key controls to move the plane and have the gunner follow the mouse cursor. I am not certain if there is a way to make the gunner movieclip stay attached to the plane and move independently. Right now the only thing that works is instantiating a gunner and adding it to the frame, but I am having problems keeping it in the right location while the plane moves.
you can refer to a movieclip in another movieclip by naming it
Picture example:
http://i.stack.imgur.com/weNeF.png
then you can refer to it in your actionscipt by writingyourPlane_mc.gun Example: yourPlane_mc.gun.rotation = mouseAngleToPlane

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?

AS3 Clicking through the hidden Mask area

I am trying to create a Flash Application similar to www.faceinhole.com.
So far I was able to load my photo through Browse functionality.
Display it inside a movie clip.
Mask this movie clip with an oval shape.
Add the transform controls (senocular) to resize and move the image.
The problem:
Whenever I click on the visible part of the Masked Movie Clip, I can successfully drag my photo around. However when I click on the hidden part of the Masked Movie Clip, I cannot drag my photo around.
Question: Is there a way to add mouseEnabled=false to the hidden area of a mask?
Place a invisible (alpha=0) Sprite on top of everything on the stage or visible section, including the picture and mask and have that drag around. Add a callback to it that updates the picture's position underneath the mask based on the drag values. You'll need to reset the invisible sprite so you can keep dragging the picture and also put limits to how far it can be dragged.

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.