# For Jubba!

**URL:** <https://forum.kirupa.com/t/for-jubba/21305>\
**Category:** Uncategorized\
**Created:** [May 20, 2003, 3:21am UTC](https://forum.kirupa.com/t/for-jubba/21305 "2003-05-20T03:21:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)\
**Post date:** [May 20, 2003, 3:21am UTC](https://forum.kirupa.com/t/for-jubba/21305/1 "2003-05-20T03:21:25Z")

</div>

Hi Jubba!

Okay, so I have a big map and an inset map. When you use the zoom slider a “frame” appears in the inset box to show where on the map you are. You can drag the frame around the inset and it updates in the big map. The problem is that it isn’t quite accurate. And if you click anywhere BUT the exact center of the frame on the inset and start dragging then the frame jumps to center on the mouse and doesn’t quite update on the big map.

I am NOT using StartDrag but rather some code I adapted from senocular’s website fla’s (www.umbc.edu/interactive).

This is the code on the inset map:

```php
onClipEvent (load) {
    bounds = {L:-51.7, R:51.7, T:-69, B:69};
}
onClipEvent (mouseMove) {
    if (this.frame.dragging) {
                    frame._x = Math.min(Math.max(_xmouse-offset[0], bounds.L), bounds.R);
        frame._y = Math.min(Math.max(_ymouse-offset[1], bounds.T), bounds.B);
        updateAfterEvent();
    }
}
onClipEvent (load) {
    scale = 1;
}
onClipEvent (enterFrame) {
    s = 100*100/_root.scale;
    // reverse scale
    _root.map.center._x = -this.frame._x*scale;
    _root.map.center._y = -this.frame._y*scale;
    // position based on this 10% scale
    this.frame._xscale = frame._yscale=s*scale;
    // scale to reverse
}

```

* * *

And this is the code on the drag button underneath the inset map:

```php
on(press){
    // set dragging of frame to true
    minimap.frame.dragging = true
    // calculate offset from center - relative to scale of map
    minimap.frame.offset = [minimap.minicenter._xmouse* 100/minimap.minicenter._xscale,minimap.minicenter._ymouse* 100/minimap.minicenter._xscale]
}
on(release,releaseOutside){
    // set dragging of map to false
    minimap.frame.dragging = false
}

```

The fla can be downloaded from:  
www.humboldt.edu/~mgk9/Test2.fla

Any suggestions?  
:nerd:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2003, 4:02am UTC](https://forum.kirupa.com/t/for-jubba/21305/2 "2003-05-20T04:02:08Z")

</div>

I’m not sure exactly what the problem is… you don’t want it to snap to the mouse coordinates?

anyways, i can’t really look at this until later tomorrow night. I have work all day tomorrow. Someone will probably have an answer by then.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2003, 7:08am UTC](https://forum.kirupa.com/t/for-jubba/21305/3 "2003-05-20T07:08:16Z")

</div>

hi!  
perhaps there’s something here…

```auto
onClipEvent (enterFrame) {
    s = 100*100/_root.scale;
    // reverse scale
    _root.map.center._x = -this.frame._x*scale; // ***  
   _root.map.center._y = -this.frame._y*scale;//***
    // position based on this 10% scale
    this.frame._xscale = frame._yscale=s*scale;
    // scale to reverse
}

```

\*\*\*"-this.frame.\_x" and “-this.frame.\_y” should be multiplied by 5 ,  
that is, the scale ratio of your small & big map…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2003, 2:28pm UTC](https://forum.kirupa.com/t/for-jubba/21305/4 "2003-05-20T14:28:17Z")

</div>

I can’t believe it! It works! I’ve been trying to work this out for WEEKS! You guys are so rad! Thank you thank you thank you thank you thank you! Noxious you rule - I never EVER would have thought of it! And it’s so simple!

:trout:

You just made my MONTH man!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 21, 2003, 3:01am UTC](https://forum.kirupa.com/t/for-jubba/21305/5 "2003-05-21T03:01:28Z")

</div>

woooh 😊

anytime! :thumb:
