-
Snapping mouse to position of Movieclip
Hello everyone, I have been trying to get the mouse to snap to the position of a movieClip once the movieClip is made visible. My approach was to define the coordinates of the mouse as that of the said movieClip however it seems flash does not dig my approach; see code below. So I would like to know weather it is possible and if so, how do I go about it. Thanks.
Code:
Stage_mc.addEventListener(MouseEvent.CLICK, showTaskTray);
function showTaskTray(myEvent:MouseEvent):void {
taskManager.gotoAndPlay("Launch");
mouseX = taskManager.taskRibbon.x;
mouseY = taskManager.taskRibbon.y;
}
-
Senior Member
you could do it with fake cursor
-
Lolll, that hack was a such smart one that I laughed immediately I saw it. Thanks much. I will try it out
-
Erm, it didn't work as expected; the fake cursor movieclip snap to the position of the position of the taskManager_mc once it was made visible but once I moved my mouse, the fake cursor snapped back to the original position
-
Senior Member
Maybe you could make actual arrow mc a child of the one that is following the mouse, and then offset it from 0,0 inside once your stuff becomes visible - then this offset will remain after you move the mouse.
-
So are you suggesting I make a second cursor and put into the current cursor movieclip as a child or re-convert the current cursor_mc into movieclip and make the x and Y cordinates 0?
-
Senior Member
basically, this:
cursor_mc (no graphics, just a wrapper) <- call startDrag on this one
arrow_mc (arrow graphics, child of cursor_mc) <- starts at 0,0; move it when you need to snap the arrow to something
-
Nope, I still got nothing....
-
Senior Member
well, too bad. these days people send cars to Mars, and you can't get the fake cursor working
-
I'm not convinced that they have got a car on mars until I see sufficient proof, nothing is for sure these days. Thanks anyway for your help, I will try figure something out.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|