# Lot to ask from one frame

**URL:** <https://forum.kirupa.com/t/lot-to-ask-from-one-frame/42066>\
**Category:** Uncategorized\
**Created:** [February 4, 2004, 7:55pm UTC](https://forum.kirupa.com/t/lot-to-ask-from-one-frame/42066 "2004-02-04T19:55:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![manifest](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manifest](https://forum.kirupa.com/u/manifest)\
**Post date:** [February 4, 2004, 7:55pm UTC](https://forum.kirupa.com/t/lot-to-ask-from-one-frame/42066/1 "2004-02-04T19:55:21Z")

</div>

does anybody know a way to use a the mouse to move a movie clip in one frame without dragging?

what i’m shooting for is moving a map in the opposite direction of the mouse (mouse moves left, map moves right, mouse moves up, map moves down) and continues to move. not just one jump, but real motion.

i’ve thought of initializing a getTimer after the mouse moves past a certain point and of moving the map after the mouse rolls over a hidden mc.

i have only one stopped frame to do it in. it must be action script…

help?

---

<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:** [February 4, 2004, 8:07pm UTC](https://forum.kirupa.com/t/lot-to-ask-from-one-frame/42066/2 "2004-02-04T20:07:48Z")

</div>

onMouseMove, and then use the \_x & \_y, compared to initial x&y of the mouse, to move map in opposite direction, reset mousetracker x&y to new values to keep updated, maybe throw in an “updateAfterEvent”…not gonna code that for ya tho’… 😉

---

<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:** [February 4, 2004, 8:08pm UTC](https://forum.kirupa.com/t/lot-to-ask-from-one-frame/42066/3 "2004-02-04T20:08:40Z")

</div>

Not sure if this is what your after but there is a tutorial written by Lost In Beta on Kirupa for easing an object TO your mouse when you click on the stage. The link for that is [here](http://www.kirupa.com/developer/mx/easing_mouseclick.htm)

I just changed some of the +/- signs around to have the object ease AWAY from the mouse when you click:

[AS]  
onClipEvent (load) {  
\_x = 0;  
\_y = 0;  
speed = 5;  
}  
onClipEvent (mouseDown) {  
endX = \_root.\_xmouse;  
endY = \_root.\_ymouse;  
}  
onClipEvent (enterFrame) {  
\_x -= (endX+\_x)/speed;  
\_y -= (endY+\_y)/speed;  
}  
[/AS]

Just draw any old thing on the stage (I made a circle) and make it a movie clip (I made the registration point in the center). Then put the above code not on the clip but on the main stage.

Is that sort of what you want?

---

<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:** [February 4, 2004, 8:09pm UTC](https://forum.kirupa.com/t/lot-to-ask-from-one-frame/42066/4 "2004-02-04T20:09:21Z")

</div>

Dangit! Why am I always too late??? :d:

😛

---

<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:** [February 5, 2004, 9:36am UTC](https://forum.kirupa.com/t/lot-to-ask-from-one-frame/42066/5 "2004-02-05T09:36:24Z")

</div>

maybe this wiill help?

---

<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:** [February 6, 2004, 6:16pm UTC](https://forum.kirupa.com/t/lot-to-ask-from-one-frame/42066/6 "2004-02-06T18:16:28Z")

</div>

thanks for the help, everybody.  
but in all fairness, i cheated to solve the problem. i said i couldn’t drag, but that was because i was using onRelease to zoom on the map and coulnd’t use it to do two things (zooming and stopDrag).  
i experimented with setInterval and the other suggested things. i couldn’t get them to work and didn’t want to ask for even more help. in the end i came up with what i think is a pretty innovative solution.  
i set a variable to \_xmouse before click and another after. did a onPress startdrag and a != between the two variables to see if the map had been dragged. if it had, the onRelease was set to stopdrag, if not it was set to zoom in. then i set another variable to check the \_xscale before click and another for after. if it had changed, i set the onRelease to stopdrag.  
now i have one map that can either zoom or drag all based on one mouse click. no more arrows or magnifying glasses to zoom and navigate.

i’m new to all of this coding so i was pretty pleased it all worked out.

---

<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:** [February 6, 2004, 7:48pm UTC](https://forum.kirupa.com/t/lot-to-ask-from-one-frame/42066/7 "2004-02-06T19:48:40Z")

</div>

well, if you’re happy, I’m happy! 😉  
congrats!
