Skip to main content
Known Participant
Feb 17, 2022 7:34 AM UTC
Question

Needed help in Action Script 3.0

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 is closed to new replies. Start a new post to keep the conversation going.

4 replies

JoãoCésar17023019
Community Expert
Community Expert
Feb 17, 2022 4:53 PM UTC

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

Translate
Known Participant
Feb 18, 2022 6:45 AM UTC

thanks for this,,,

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

 

Translate