R – Flash – Drag Two Movieclips at Once

actionscript-3flash

I'm trying to create a map application similar to this. Click the SWF Preview tab on the left of the image. Specifically, noticed how you can pan around, and the clickable buttons on the map move with it. Basically, how do they do that?

My application has a map that you can click and pan around using a startDrag() function. I have a separate layer with other, clickable movie clips that I'd like to follow the pans of the map layer. Unfortunately, Flash limits you to dragging only one movie clip at a time. Somebody proposed a solution using a prototype, but I can't get that working correctly, and I'm not sure if it's because I'm using ActionScript 3.0 or not.

Can anybody outline a better way for me to accomplish what I'm trying to do, or a better way to do what I'm currently doing? Appreciate it.

Best Answer

Simple. Put your map and the clickable buttons into a new MovieClip, you could call it interactiveMapContainer or something similar, then call your startDrag method on interactiveMapContainer and you'll still be able to click the buttons once you've dragged it about.

Jakub Kotrla's method will also work very well, although it is slightly more complicated.

Related Topic