I’m building a game which makes use of a few extended classes. I’ve recently made a few changes in the way the graphics are ordered and am now running into problems, namely:
ReferenceError: Error #1069: Property grab not found on flash.display.Sprite and there is no default value.
at DraggableSprite/grabObject()
ReferenceError: Error #1069: Property drop not found on flash.display.Sprite and there is no default value.
at DraggableSprite/dropObject()
The general structure is as follows (’>’ means extends) :
MovieClip > DraggableSprite > PlantPart > Seed or Flower.
DraggableSprite manages dragging/dropping objects with the mouse. It contains the offending lines of code being:
private function grabObject(evt:MouseEvent)
{
trace("grabTarget: "+evt.target.name);
if (this._draggable)
{
_origX = evt.target.x;
_origY = evt.target.y;
parent.addChild(this);
evt.target.startDrag();
** evt.target.grab(evt.target);**
}
}
private function dropObject(evt:MouseEvent)
{
trace("dropTarget: "+evt.target.name);
evt.target.stopDrag();
**evt.target.drop(evt.target.dropTarget);**
}
The Seed and Flower classes contain a public ‘grab’ and ‘drop’ function which manage some different effects of being picked up and dropped, but the code seems to stop short at the PlantPart class and register a sprite it contains as the ‘evt.target’. I added this intermediate sprite to overcome a colission problem with the mouse. The sprite functions as a dragbox, while the Seed and Flower graphics offer visual feedback.
I think I’m overlooking a simple logical step, but I just can’t seem to find it. I hope someone understands the problem and can help me solve it.