Is this the kind of thing you were looking for? I think you could apply a simple drag and drop to the background. You would have to put limits on how far you could drag though.
EX:
Code:
// Register mouse event functions
blue_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
blue_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
red_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
red_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
// Define a mouse down handler (user is dragging)
function mouseDownHandler(evt:MouseEvent):void {
var object = evt.target;
// we should limit dragging to the size of the page.
object.startDrag();
}
function mouseUpHandler(evt:MouseEvent):void {
var obj = evt.target;
obj.stopDrag();
}
Maybe to limit the dragging:
Code:
//add this to the "function mouseDownHandler()",
if (background.x < leftXLimit && background.x < rightXLimit && background.y < topYLimit && background.y < bottomXLimit) {
}
or something like that. try it out, hope this helps!