Please be gentle as I know there a lot of posts on this, but I’ve still not been able to figure this out. I have a movieClip that is going to do a startDrag and a stopDrag, but the on MouseUp is not working and I need the onReleaseOutside functionality, however I’m getting errors and don’t really understand them. Here is my AS:
_bounds = new Rectangle(20, 20, 0, 500);
handle.addEventListener(MouseEvent.MOUSE_DOWN, dragSlider);
handle.addEventListener(MouseEvent.MOUSE_UP, stopSlider);
//handle.stage.addEventListener(MouseEvent.MOUSE_UP, stopSlider);
function dragSlider(evt:MouseEvent):void{
evt.currentTarget.startDrag(true, _bounds);
evt.currentTarget.stage.addEventListener(MouseEvent.MOUSE_UP, stopSlider);
//stage.addEventListener(MouseEvent.MOUSE_UP, stopSlider);
//evt.currentTarget.parent.stage.addEventListener(MouseEvent.MOUSE_UP, stopSlider);
}
function stopSlider(evt:MouseEvent):void{
evt.currentTarget.stage.removeEventListener(MouseEvent.MOUSE_UP, stopSlider);
//stage.removeEventListener(MouseEvent.MOUSE_UP, stopSlider);
//evt.currentTarget.parent.stage.removeEventListener(MouseEvent.MOUSE_UP, stopSlider);
evt.target.stopDrag();
}
My errors are either:
Error #1009: Cannot access a property or method of a null object reference.
at media_fla::MainTimeline/stopSlider()
or
Error #1069: Property stopDrag not found on flash.display.Stage and there is no default value.
at media_fla::MainTimeline/stopSlider()
Please help and thanx in advance!