I’ve been searching for hours but still haven’t found the answer to my problem.
My goal is to have a map that I can drag around within the frame of a webpage.
Finding the right code to move the map in a restricted frame wasn’t too easy but I managed to find that (which works like a charm):
zoom3.addEventListener(MouseEvent.MOUSE_DOWN, dragArea);
zoom3.addEventListener(MouseEvent.MOUSE_UP, dropArea);
function dragArea(e:MouseEvent):void{
var bounds:Rectangle = new Rectangle(
stage.stageWidth - zoom3.width,
stage.stageHeight - zoom3.height,
zoom3.width - stage.stageWidth,
zoom3.height - stage.stageHeight
);
zoom3.startDrag(false, bounds);
}
function dropArea(e:MouseEvent):void{
zoom3.stopDrag();
}
Now the catch is that I’d like the map to be dragged simultaneously with a movieclip situated above, that contains names of regions, cities etc…
Both can’t be on the same layer as I need to put a layer of texture in between.
Is there a simple way to link both layers and make them move at once?
Hope I’m clear enough, English is my second language.
Thanks for reading, and maybe helping.
you can:
Option 1:
** Option “:**
A more OO approach. You don’t need to override the x and y, but
zoom3needs to extend a class something like this:Then to listen to the events, something like this: