How to make an ending when the last piece is completed
Im new to flash
Can someone tell me how to end a puzzle game where when the last piece of the puzzle matches/ collides with the last slot it will then go to a new movie/scene with a different backgrund and some text like "you win". Below is the drag drop action code with no ending. I made a scene 2 and im planning it to go to scene 2(the one with new background and txt) once the puzzle is complete. I dont know how to do the code, i just copied this from an online tutorial which is great but no ending. Also at scene 2 i want to put a replay button where it goes back to scene 1(solve the puzzle thingy). Im still new and dont have any proggramming background , any help is appreciated. Thankx.
piece1_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart1);
function dragStart1(event:MouseEvent): void {
piece1_mc.startDrag();
}
piece1_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop1);
function dragStop1(event:MouseEvent): void {
piece1_mc.stopDrag();
if (piece1_mc.hitTestObject(holder1_mc)==true){
piece1_mc.x=holder1_mc.x;
piece1_mc.y=holder1_mc.y;
}
}
piece2_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart2);
function dragStart2(event:MouseEvent): void {
piece2_mc.startDrag();
}
piece2_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop2);
function dragStop2(event:MouseEvent): void {
piece2_mc.stopDrag();
if (piece2_mc.hitTestObject(holder2_mc)==true){
piece2_mc.x=holder2_mc.x;
piece2_mc.y=holder2_mc.y;
}
}
piece3_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart3);
function dragStart3(event:MouseEvent): void{
piece3_mc.startDrag();
}
piece3_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop3);
function dragStop3(event:MouseEvent): void{
piece3_mc.stopDrag();
if (piece3_mc.hitTestObject(holder3_mc)==true) {
piece3_mc.x=holder3_mc.x;
piece3_mc.y=holder3_mc.y;
}
}
piece4_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart4);
function dragStart4(event:MouseEvent): void{
piece4_mc.startDrag();
}
piece4_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop4);
function dragStop4(event:MouseEvent): void{
piece4_mc.stopDrag();
if (piece4_mc.hitTestObject(holder4_mc)==true) {
piece4_mc.x=holder4_mc.x;
piece4_mc.y=holder4_mc.y;
}
}
piece5_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart5);
function dragStart5(event:MouseEvent): void{
piece5_mc.startDrag();
}
piece5_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop5);
function dragStop5(event:MouseEvent): void {
piece5_mc.stopDrag();
if(piece5_mc.hitTestObject(holder5_mc)==true) {
piece5_mc.x=holder5_mc.x;
piece5_mc.y=holder5_mc.y;
}
}
piece6_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart6);
function dragStart6(event:MouseEvent): void{
piece6_mc.startDrag();
}
piece6_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop6);
function dragStop6(event:MouseEvent): void
{
piece6_mc.stopDrag();
if(piece6_mc.hitTestObject(holder6_mc)==true) {
piece6_mc.x=holder6_mc.x;
piece6_mc.y=holder6_mc.y;
}
}
