Hi I’m new to this form.
I’m trying to create a drag and drop game as part of a college project.
So basically the idea is that the user will have a object which they can drag around the screen and when the object reaches a certain point of screen, it should lock into place.
But I’m having difficulty trying to lock the image.
redCircle_MC.addEventListener(MouseEvent.MOUSE_DOWN , redCircleDrag);
function redCircleDrag(event:MouseEvent):void
{
if(redCircle_MC.X>300)
{
redCircle_MC.startDrag();
}
};
redCircle_MC.addEventListener(MouseEvent.MOUSE_UP , redCircleStopDrag);
function redCircleStopDrag(event:MouseEvent):void
{
redCircle_MC.stopDrag();
};
blue_box.addEventListener(MouseEvent.MOUSE_DOWN , blueBoxDrag);
function blueBoxDrag(event:MouseEvent):void
{
blue_box.startDrag();
};
blue_box.addEventListener(MouseEvent.MOUSE_UP , blueBoxStopDrag);
function blueBoxStopDrag(event:MouseEvent):void
{
blue_box.stopDrag();
};
Any suggestions would be greatly appreciated.