1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| stop()
map_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragArea);
map_mc.addEventListener(MouseEvent.MOUSE_UP, dropArea);
function dragArea(e:MouseEvent):void{
var bounds:Rectangle = new Rectangle(
stage.stageWidth - map_mc.width,
stage.stageHeight - map_mc.height,
map_mc.width - stage.stageWidth,
map_mc.height - stage.stageHeight
 :wink:;
map_mc.startDrag(false, bounds);
}
function dropArea(e:MouseEvent):void{
map_mc.stopDrag();
}
var tmpX:int;
var tmpY:int;
frida_mc.x = frida_mc.x + (map_mc.x - tmpX);
frida_mc.y = frida_mc.y + (map_mc.y - tmpY); |
Partager