Hello,
I have a drag drop routine, with the dropTarget consisting of a sprite with a label containing text on it. The problem is that depending on the mouse cursor position on the item being dragged, the drop registers either with the intended target Sprite, or with the textField of the Label on the Sprite.
Is there a neat way of finding out what class the drop target is? My attempt gives me the following error.
“Cannot access a property or method of a null object reference”
private function mouseUpStopDrag(e:MouseEvent):void
{
var _valueText:String;
var _test:Boolean;
var _dropTarget:Object;
e.currentTarget.stopDrag();
if (e.currentTarget.dropTarget)
{
_dropTarget = e.currentTarget.dropTarget;
_test = (_dropTarget is NumberBlock);
while (_test == false) {
_dropTarget = dropTarget.parent;
_test = (dropTarget is NumberBlock);
}
trace(_dropTarget);
}
Thanks in advance