Flash _xmouse ?
- Started
- Last post
- 23 Responses
- CX
Is there a way in Flash to capture where you clicked with the mouse with _x/ymouse as opposed to where the mouse is currently?
I'm doing a zoom map in Flash and it's going well (scaling, moving x/y coordinates) but I would like to move the map to make the exact point I click come to the center of the movie.
- fountainhead0
you can create a listener that will only execute while the mouseDown. at that point capture the current _xmouse & _ymouse. pretty simple actually.
- SP™0
listers rock.
- CX0
Unfortunatly I'm stuck using Flash 5 at this location at the moment. I hope it still works in 5.
If anyone has any tips for how I'm trying to make the part I click move to the center please let me know.
- mitsu0
just convert the source to AS would have done it in AS, but JS is obviously faster:
- fountainhead0
Well.. if your using Flash 5. you might try using a empty movie clip. and have it follow the mouse around. then when you mouseDown disable the MC from following the mouse.... then you will be able to get the x & y position of the MC. once you have that info then kill that mc. Try investigating Duplicating and removing MovieClips. as well as how to have MovieClips following the mouse. you should be good to go.
- mitsu0
or for something really annoying:
- CX0
None of those links seemed to work for me, Mitsu.
- mitsu0
should work in IE
- ********0
why develop for one browser?
- mitsu0
it was an example... i took the time to make an example to prove a concept, understand?
- ********0
i just breezed over the topic threads. 1000 pardons
- versa0
CX -
hey - i am interested in seeing the map that you are trying build
i started a thread that died yesterday regarding a similar ( i think ) attempt at building a scrollable contact map
i'd be glad to show you what i've done if our two problems are similar, or even if not
maybe we could help each other out on this one
- JamesEngage0
I'm a great beliver in the invisible button,,, then you can alway detect hits etc. whether you are on your object or not... combine that with turning the pointer on and or (i.e showing you're over a button when necessary (hand vs. arrow))
- CX0
I need some help. I would like to move the map to make the exact point I click move to the center of the movie. I'm now using a small dragMC that disables wherever I click on the map to get the coordinates.
I've been trying everything. Currently what I'm doing is the exact opposite. Wherever I click the center of the mapMC goes to that point.
Here is the code as I currently have it in a control MC:
Xdif = _root.trueDif;
_root.map._x = 283.85+Xdif;trueDif is the difference between _x of the mapMC (which is in the center of it and equals 283.85) and the _x value of where I clicked. I know why it's doing what it's doing now but I can't seems to get it to do what I need it to do. I'm not even sure if it's possible to make any coord in an MC to go to the center of the movie. Please help.
- mitsu0
where movieWidth and movieHeight is the respective width and height of your movie and where curX and curY is the respective x and y position of the cursor:
_root.map._x=(movieWidth/2)-(cur...
_root.map._y=(movieHeight/2)-(cu...
- CX0
I'll keep trying to work with that. It currently just makes the map fly far off the page.
Its kind of similar to what I was doing when I look at it because
_root.map._x is almost the same # as the first division parts and the trueDif variable I had is the same as the 2nd subtraction part._root.map._x=(559/2)-
(_root.curX-_root.map._x);
_root.map._y=(283/2)-
(_root.curY-_root.map._y);If you have anymore tips to add I would love to hear them. Thanks.
- mitsu0
that should work fine. there must be something else that's throwing it off as the dhtml proof of concept i put together worked.
it's good to print out the output to the screen in textboxes or something so you can see what's going on during each event.
- CX0
Thanks, yeah I have about 10 text boxes being outputted for different variables.
I had it like this:
_root.map._x = 283.85+Xdif;
for some reason if I change the + to a - it get really weird also.I'll post if I discover anything.
- CX0
mitsu, could I email you the FLA to look over for a few seconds to see if you notice anything odd. This is starting to drive me nuts.
- mitsu0
sure