hey, im having this problem with my movieclips. one is container_mc and inside it is picture_mc. They both have drag and drop functions. Container drags when it is clicked...but when i try to drag and drop picture_mc, i end up dragging the whole container itself. picture_mc is inside container_mc. Is there any way i can get by this?
Because container has a drag on it it will be selected every time, even if you appear to be clicking on the picture.
It is effectively on top of the picture so it registers the mouse click.
Could you check if the mouse is inside the boundary of the picture and if it is temporarily remove the mouse down listener from the container.
Add it back once the mouse is outside the picture.
say you use a main_mc and inside that main_mc is the mc movieclip which holds the picture.
So use this code below hope it will work
//////////////////////////////////////////////////////////////////////////////////////////////////
function stopdrag(evt:MouseEvent)
{
main_mc.stopDrag()
main_mc.mc.stopDrag()
}
function click1(evt:MouseEvent)
{
evt.currentTarget.startDrag(false)
}
function click2(evt:MouseEvent)
{
evt.stopImmediatePropagation()
Very nice er_gagan_deep.
achieved basically the same thing I was doing with WAY less code.
I am more of a designer than a coder, can you explain the stopImmediatePropogate a bit, in the Flash help it says
"Prevents processing of any event listeners in the current node and any subsequent nodes in the event flow. This method takes effect immediately, and it affects event listeners in the current node. In contrast, the stopPropagation() method doesn't take effect until all the event listeners in the current node finish processing."
I guess I am a bit unclear on what they mean by node, and current node etc.
Respected Sir for this first you have to study about the event flow in Flash.
basicaly event flow takes place in three phases :
Capture phase
Target Phase
Bubbling Phase