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