Drag and Drop with a response in Flash..please help
Hi
I have just started with flash and actionscript3 about 5 weeks ago. I'm in my first year uni and I have a drag and drop assignment (for a kindergarten class). Its "little Red Hen" and they have place the correct picture in right holder.
I have gotten the drag and drop working but I can't seem to figure out how to display a tick when they have place it in the correct holder.
Please help....
This is my script (it may seem messy...still new)
import flash.events.MouseEvent;
/*Mouse Event that ensures the function of hen movieclip to start dragging
when mouse is pressed*/
hen1_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
hen2_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
hen3_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
hen4_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
hen5_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
hen6_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
function dragStart (event: MouseEvent):void
{
event.target.startDrag();
}
/*Mouse Event that ensures the function of hen movieclip to drop
when the mouse button is realeased with Condition statement, if
hen = holder, hen snaps into place*/
hen1_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop1);
function dragStop1 (event:MouseEvent):void
{
hen1_mc.stopDrag();
if (hen1_mc.hitTestObject (holder1_mc)==true)
{
hen1_mc.x=holder1_mc.x;
hen1_mc.y=holder1_mc.y;
}
}
hen2_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop2);
function dragStop2 (event:MouseEvent):void
{
hen2_mc.stopDrag();
if(hen2_mc.hitTestObject (holder2_mc)==true)
{
hen2_mc.x=holder2_mc.x;
hen2_mc.y=holder2_mc.y;
}
}
hen3_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop3);
function dragStop3 (event:MouseEvent):void
{
hen3_mc.stopDrag();
if(hen3_mc.hitTestObject (holder3_mc)==true)
{
hen3_mc.x=holder3_mc.x;
hen3_mc.y=holder3_mc.y;
}
}
hen4_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop4);
function dragStop4 (event:MouseEvent):void
{
hen4_mc.stopDrag();
if(hen4_mc,hitTestObject (holder4_mc)==true)
{
hen4_mc.x=holder4_mc.x;
hen4_mc.y=holder4_mc.y;
}
}
hen5_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop5);
function dragStop5 (event:MouseEvent):void
{
hen5_mc.stopDrag();
if(hen5_mc.hitTestObject (holder5_mc)==true)
{
hen5_mc.x=holder5_mc.x;
hen5_mc.y=holder5_mc.y;
}
}
hen6_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop6);
function dragStop6 (event:MouseEvent):void
{
hen6_mc.stopDrag();
if(hen6_mc.hitTestObject (holder6_mc)==true)
{
hen6_mc.x=holder6_mc.x;
hen6_mc.y=holder6_mc.y;
}
}
