AS3 startDrag x y coordinates
Hey guys, not sure if this is possible but i'd like to get the X,Y coordinates of a button I drag. here's my problem:
PHP Code:
backbutton_btn.addEventListener(MouseEvent.MouseDown, backbuttonDown);
backbutton_btn.addEventListener(MouseEvent.MouseMove, backbuttonMove);
public function backbuttonDown(e:MouseEvent)
{
backbutton_btn.startDrag();
}
public function backbuttonMove(e:MouseEvent)
{
trace(backbutton_btn.x +","+backbutton_btn.y);
}
the x and y coordinates remain the same even though i'm clearly dragging my button all over the stage. I did code my own by putting events and whatnot around the button but startDrag seemed smoother and faster. is it even possible?
how about locking a drag and drop object in with boundries?
new to the forum. still somewhat green to AS3. hello all.
i was reading this post (i found while doing a search to answer my question) and thought i'd ask you this here.
how would i lock in an object into set boundries? i can do this in AS2 but can't get it to work in 3.
in a nut shell, i have a ball. i want to drag this ball around the screen, but when it gets to the edge i don't want it to get cut off but instead stop at edge of the ball. essentially the stage is a box.
here's what i got so far:
Quote:
ball_mc.buttonMode = true;
ball_mc.addEventListener(MouseEvent.MOUSE_DOWN, drag);
ball_mc.addEventListener(MouseEvent.MOUSE_UP, drop);
function drag(event:Event):void
{
ball_mc.startDrag();
}
function drop(event:Event):void
{
ball_mc.stopDrag();
}
so how do i set the boundries in which i want the ball to stay?
thanks!
`shields