Almost jenn.
When you get an error from something, paste the whole error into your reply, it usually contains other info that is useful.
Also include the code that is giving you the error.
Like what was the function call you made?
You may have been doing something like
puzzle.dragDrop(someParameter) or similar.
The main problem you have, is you need to target individual pieces of the puzzle, the code you have there will just pick up the whole puzzle & drag it, ie your call to startDrag() will be resolved to this.startDrag() which is a reference to the whole Puzzle instance.
Just call puzzle.dragDrop() from you're mainTimeline(with no parameters), when you want to allow the pieces to be dragged.
I've included a little exercise for you
ActionScript Code:
public function dragDrop():void {
//buttonMode = true; // hand cursor if you desire...
addEventListener(MouseEvent.MOUSE_DOWN, drag);
}
private function drag(event:MouseEvent):void {
var pieceMousedDownOn:Sprite = Sprite(event.target);
// homework
// hmmmm... some pieces are behind others when I drag...
// what could I "add" here to fix it???
pieceMousedDownOn.startDrag();
stage.addEventListener(MouseEvent.MOUSE_UP, drop);
}
private function drop(event:MouseEvent):void {
stopDrag();
stage.removeEventListener(MouseEvent.MOUSE_UP, drop);
}