Skip to main content
Known Participant
February 17, 2022
Question

Needed help in Action Script 3.0

  • February 17, 2022
  • 1 reply
  • 272 views

Hello Everyone.

 

what im creating-

okay so i'm creating a simple drag and drop application, in which you have to drag and drop (CAR) Letters in a right sequence.

 

what i want to do-

after you drop letters in a right sequence i want to run congratulation clip or animation.

 

 

 

here is my code-


/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/

R.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);

function fl_ClickToDrag(event:MouseEvent):void
{
R.startDrag();
}

R.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);

function fl_ReleaseToDrop(event:MouseEvent):void
{
R.stopDrag();
if(R.dropTarget!=null&&R.dropTarget.parent==box03)
{
trace("Sahi hai")
R.x=box03.x
R.y=box03.y
}
else
{
trace("Galat hai")
R.x=151.1
R.y=167.5
}
}

/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/

A.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_2);

function fl_ClickToDrag_2(event:MouseEvent):void
{
A.startDrag();
}

A.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_2);

function fl_ReleaseToDrop_2(event:MouseEvent):void
{
A.stopDrag();
if(A.dropTarget!=null&&A.dropTarget.parent==box02)
{
trace("Sahi hai")
A.x=box02.x
A.y=box02.y
}
else
{
trace("Galat hai")
A.x=261.15
A.y=167.5
}

}

/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/

C.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_3);

function fl_ClickToDrag_3(event:MouseEvent):void
{
C.startDrag();
}

C.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_3);

function fl_ReleaseToDrop_3(event:MouseEvent):void
{
C.stopDrag();
if(C.dropTarget!=null&&C.dropTarget.parent==box01)
{
trace("Sahi hai")
C.x=box01.x
C.y=box01.y
}
else
{
trace("Galat hai")
C.x=371.05
C.y=167.5
}
}

  

 

This topic has been closed for replies.

1 reply

JoãoCésar17023019
Community Expert
Community Expert
February 17, 2022

Hi.

 

There's a sample here:

https://community.adobe.com/t5/animate-discussions/animate-drag-drop-help/m-p/9897422#M181679

 

Please let us know if this is what you're looking for.

 

Regards,

JC

Known Participant
February 18, 2022

thanks for this,,,

but im amature.....so can you please edit my own code to achieve this result.