Trouble with dropTarget
Good evening AS3 programmers,
I've got another newbie question. I'm building a FLA with a Drag & Drop function. I can Drag and if I Drop on the target all is well. However, if I dropoutside the target, I get the following error message: "TypeError: Error #1009: Cannot access a property or method of a null object reference.
at EvalStat/drop()" The target is a MovieClip, DropZone, with an instance name of DropZ. It was placed on the Stage at design time.
function drop(e:MouseEvent) {
e.target.stopDrag();
if (e.target.dropTarget.parent == DropZ) {
e.target.y = DropZ.y + 10;
e.target.filters = null;
} else {
e.target.Die();
}
}
This is a copy of my drop() method. I created a newbie solution by using e.target.x and e.target.y to test if the drop was within the target area. It worked, but I'd really like to learn about dropTarget. Any suggestions would be greatly appreciated.
PS I observed that some threads have code nicely formatted in window. How is this done?