I read senoculars post on this but cant figure it out
I am making a drag/drop file and if I am not over the clip I began dragging, it wont release. I added an event to the stage for MOUSE_UP, but then when Im not over the clip I am getting an error:
ReferenceError: Error #1069: Property stopDrag not found on flash.display.Stage and there is no default value.
at com.ronnie::DragAndDrop/upHandler()[E:\__AS3\com\ronnie\DragAndDrop.as:46]
Here is my code right now
package com.ronnie
{
import flash.display.MovieClip;
import flash.events.*;
import gs.TweenLite;
import gs.easing.Expo;
public class DragAndDrop extends MovieClip
{
private var p:MovieClip;
private var m:MovieClip;
private var boxes:Array = new Array();
public function DragAndDrop(parentClip:MovieClip)
{
p = (parentClip as MovieClip);
m = p.mH;
addEventListener(Event.ADDED_TO_STAGE, initBoxes);
}
private function initBoxes(e:Event):void
{
for (var i:int = 0; i < 4; i++)
{
var b:Box = new Box();
b.y = i * 50;
b.id = i;
b.txt.text = "Hello, I'm box number " + (i + 1);
b.txt.mouseEnabled = false;
m.addChild(b);
boxes.unshift(b);
b.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
b.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
}
removeEventListener(Event.ADDED_TO_STAGE, initBoxes);
}
private function startDragging(e:MouseEvent):void
{
var top:Number = 1;
e.currentTarget.startDrag();
e.currentTarget.alpha = 0.7;
stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
}
private function stopDragging(e:MouseEvent):void
{
e.currentTarget.stopDrag();
TweenLite.to(e.currentTarget,0.5,{x:0,alpha:1,ease:Expo.easeOut});
}
}
}
I need help so when I release on the clip or outside the clip it stops dragging.