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

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

Related

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.

AS3: Create sprites from loaded image

I don't know if the title is misleading as the image I'm loading is actually a sprite image consisting of a multi-state button. I want to load this image and split it into several display objects (sprites?) in AS3, to create a SimpleButton with an over and down state.
Right now I'm just loading the image with Loader and URLRequest, and then creating a sprite from the loaded content.
Is this possible or is there any other way of doing this, without having to load two separate images?
Thanks in advance,
Pierre
There is. You can use the mask function of the Sprite class. First you set the mask to normalstate button part of the image,, and on mouseover you set the mask to the other state and on mouse down you set the mask to the clickstate button part of the image
Please mark as answer if this helped.

actionscript 3 popup window - not js

Im doing a program in AS3 and, i'm trying to do the following:
Lets say I have a button, which have onClick event, and when the event is triggered, the popup window will appear.
And in this popup window there is going to be an animation (countdown) of 2020 (this is just an example).
Is there a way to do this without javascript. Because i'm not doing this for website, its going to be a animation.
Hope i was clear.
Thanks
In Flash,create a movie clip, give it an instance name of "countdown_mc", put the countdown animation inside it.This will be your "alert" type window.
Now, in the movieclip containing "countdown_mc", add a new layer and on the same frame bring up the action editor(F9) and write the following: countdown_mc.visible=false;
When you push the button it should make countdown_mc.visible=true and maybe do an optional growing animation;
Also on this frame add a listener for countdown_mc so that when the user clicks on the window it disappears(countdown_mc.visible=false);
For animations add download tweenmax from http://www.greensock.com/tweenmax/, extract the archive in the folder that contains your fla and add the following to your code:
import com.greensock.*;
TweenMax.from(countdown_mc,0.5,{scaleX:0,scaleY:0});

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.