# Jigsaw puzzle

**URL:** <https://forum.kirupa.com/t/jigsaw-puzzle/257481>\
**Category:** Uncategorized\
**Created:** [April 14, 2008, 4:59pm UTC](https://forum.kirupa.com/t/jigsaw-puzzle/257481 "2008-04-14T16:59:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![small\_guy](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@small\_guy](https://forum.kirupa.com/u/small_guy)\
**Post date:** [April 14, 2008, 4:59pm UTC](https://forum.kirupa.com/t/jigsaw-puzzle/257481/1 "2008-04-14T16:59:39Z")

</div>

I am putting together a series of jigsaw puzzles using Flash Pro 8/AS 2.0.

The puzzles themselves all work fine. They are set up using a piece1\_mc hitTest to an identical target1\_mc (with the target piece at an alpha of zero).

My question is this:

when all the pieces have been placed (i.e., the puzzle is finished) I want a piece of music to play (the music selection is relevant to the specific puzzle). I don’t need help with setting up the sound aspect. What I am trying to figure out is the code that might work so that no matter what the last piece of the puzzle that is placed it will trigger the music.

I figure that if I can just make it work for one piece connecting with one target I can figure out how to build it to work with all the pieces.

I tried a Boolean like this:

var music\_sound:Sound = new Sound();  
music\_sound.attachSound(“music”);

var piecePositioned:Boolean = (piece1\_mc.\_x && piece1\_mc.\_y);  
var targetPositioned:Boolean = (target1\_mc.\_x && target1\_mc.\_y);

if(piecePositioned == targetPositioned){  
music\_sound.start();  
}

which obviously did not work (or I would not be here putting forth the question).

In essence, all 29 of the piece\_mcs (labeled piece1\_mc, piece2\_mc, etc) have to match the \_x and \_y of all 29 of the target\_mcs (labeled target1\_mc, target2\_mc, etc.)

If anyone has direct insights into this - or even some educated guesses - that I can try it would be appreciated as the playing of the music is sort of the “award” for having completed the puzzle.

Thanks.

small\_guy
