I am teaching with an basic AS3 programming class and we are looking at drag/drop. I cannot get the following code to work without a 1009 error when not dropping the ball into the inventory box.
What we are trying to accomplish is creating an inventory for an adventure game.
function ball_drag(event:MouseEvent):void {
ball.startDrag();
}
ball.addEventListener(MouseEvent.MOUSE_DOWN,ball_drag);
function ball_drop(event:MouseEvent):void {
stopDrag();
if (ball.dropTarget.parent == inventory_box) {
trace("it worked!");
}
}
ball.addEventListener(MouseEvent.MOUSE_UP,ball_drop);
Thanks in advance, file is attached.