Search code examples
actionscript-3flash-cs5

I want to play from frame 2 and then stop at frame 3


Hey i a have create a movie clip scene in the Second frame now what i want to do is that when it goes to the second frame and start play the clip and the clip finishes it will stop at the third frame i have done the Action script code but it doesn't work

function endDrag(event:MouseEvent):void
{
    event.target.stopDrag();
    event.target.x = startPoint.x;
    event.target.y = startPoint.y;

    if (jug.dropTarget != null && jug.dropTarget.parent == DropTarget && currentFrame == 1)
    {
        this.gotoAndStop(2);
        nextFrame();
    }
}

Solution

  • You are in frame 1. The user drags a Movie Clip named jug to a target named droptarget. So your function endDrag asks its parent (the Main Timeline) to gotoAndStop(2):

    event.target.parent.gotoAndStop(2); // or this
    

    In frame 2 another Movie Clip plays, and when it finishes to play, its parent (the Main Timeline) gotoAndStop(3). In the last frame of your movie clip:

    MovieClip(parent).gotoAndStop(3);