Proximity From Mouse To Snap Into Place
Hi there everyone, I'm working on making a rotating navigation system, like an atom, where the nucleus is the "home" button and the electrons are the individual buttons to press.
I have it so the darn thing rotates with the mouse, but I am having a problem with getting the indivudal buttons to "snap" to the mouse when it is in a close proximity, and then give up and snap to another button when you are in close proximity to the other as well.
I'm not dense in math, but I am having a problem - I hope my post isn't too general, but if I could ge pointed int he right direction to maybe a turorial, or example that would be an awesome roadmap!
Thanks to all who reply!
Paul
SitePoint > Design Your Site > Flash and Actionscript
Posted on: Sep 2, 2005, 16:39
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Follow Mouse Then Snap To Place - How ?
Hi,
I want to create a similar effect that's displayed on http://www.dnastudio.com/
The effect I'm talking about is the little fill on top (over the menu) that follows the mouse horizontaly and then snaps to place when the mouse is over a button.
Could someone help me out, or maybe point me to a tutorial?
thanks in advance
Follow Mouse Then Snap To Place - How ?
Hi, I posted this at the Flash MX thread but I figured this is the place for this kind of questions + I didn't get any answers
I want to create a similar effect that's displayed on http://www.dnastudio.com/
The effect I'm talking about is the little fill on top (over the menu) that follows the mouse horizontaly and then snaps to place when the mouse is over a button.
Could someone help me out, or maybe point me to a tutorial?
I would appreciate any kind of help
thanks in advance
Self Tidy Buttons (snap Into Place)
I have a flash quiz type thing, which involves the user dragging quotes onto a choice of 2 movie clips then clicking submit to get the correct answers etc (you know the kind of thing).
My question is would it be possible to self tidy the buttons when they are dragged onto the MC's? For example quote 1 is released on the MC and it snaps straight into position 1, then when another quote is released it snaps neatly underneath into position 2 and so on....
The difficult part is that whatever qoute is dragged first, it needs to snap to the top, the second underneath, and so on...
I'd be extremely grateful if anyone can help.
Cheers.
Make Drag N' Drop Snap Into Place
I am wondering if anyone has the code to make my drag and drop movie clip "snap" into place when it roles over another (given) movie clip.
Here is the code that I am using so far. It is located on an invisible button inside the movieclip which is being dragged in the main time line:
on (press) {
startDrag ("");
}
on (release) {
stopDrag ();
if (_droptarget eq "/one") {
gotoAndStop ("p1");
} else if ( _droptarget eq "/two") {
gotoAndStop ("p2");
} else if (_droptarget eq "/three") {
gotoAndStop ("p3");
} else if (_droptarget eq "/four") {
gotoAndStop ("p4");
} else {
gotoAndStop ("p5");
}
}
If this is not clear, please let me know. I am getting desperate, and can't find a tutorial with a clear answer.
Thanks. Gabrielle
Drag And Drop Objects That Snap Into Place
Hello! I'm new around these parts (I literally signed up about 3 minutes ago!). I'm a high school student who just started using Flash about a month or two ago, so I'm far from advanced, though I have tackled some of the basics. In class I'm working on an art portfolio site but in my spare time I'm making a virtual dress-up doll (you know, the kind where you can pick up the clothes and drop them on the figure to mix and match outfits). Learning how to make drag-and-drop objects was very easy and there are lots of tutorials on it but what I can't figure out is how to get objects to "snap" into place. I want it so that the doll's hairdo's snap into position because they look kind of stupid when placed incorrectly.
Thank you so much, to anyone who can help! I've looked everywhere but haven't been able to find a tut on this >_<.
Timeline Window Won't Snap Back To It's Original Place
Hi all,
I'm having the most annoying, and the most weirdest problem ever. Has anyone had problems with the timeline window where it just don't snap back into it's original place, that is, just above the workarea? After a few times using flash with it's timeline window detached from it's original spot on a dual monitor, the timeline window always start detached when loading a fla document, or when creating a new document, and it just won't fit back into it's original place unless I choose to load up a pre-saved panel set.
Please! if anyone had or knows about this problem please let me know what to do! I don't want to go over the hassles of reinstalling and reseting all my personal settings! grRR!
Mouse Proximity
Hi,
Is it possible to change between multiple custom mouse cursors depending on where it is on the stage?
For instance, when it's 100 pixels away from the a certain point it will change to one type of cursor; 200 pixels away and it will change to another; 300 pixels away it will change to another etc....
Any help on this would be great - i've spent far too long *trying* to code it!
Thanks!
Sanj
MC Scale - Mouse Proximity?
i need a script that scales a MC depending the on the distance the cursor is from said movie clip, NOT were the cursor is on the stage.
does anyone have one of these? itwould be GREATLY appreciated
Proximity To Mouse Pointer
Hey there,
So a sort of involved question. I need to know how you folks go about creating a zone around an object that can activate certain events when the mouse enters that zone.
Basically, a rectangle around a button that when the mouse gets within a certain distance, the button moves towards the mouse or to a specified position. We've all seen sites like this... is there a "proximity" or "distance" listener?? Basically what I did, and this is the most basic one can get with the idea, was to create a rectangle, and use a series of "if" statements to determine if the cursor is within the boundaries of said rectangle. Then, when it is, the menu items jump out from behind a logo and become much more visible and clickable.
Most specifically, I want to ideally have the buttons move towards their final positions based off of how close the mouse is-- tween percentages, basically. I just cant figure out how to rig this up.
And I think I'm taking the very, very hard way about it. Plus, it doesnt work. Does anyone have suggestions??
Sound Volume = Mouse Proximity?
Hi guys,
I have this mc in my movie, and I want the volume of a certain sound to increase/fade up as the cursor gets closer to the mc, and also want it to decrease/fade down as the cursor gets away from the mc.
I've got this code:
Code:
onClipEvent (load) {
s_jam = new Sound(this);
s_jam.attachSound("jam");
s_jam.start(0, 999);
s_jam.setVolume(0);
startVol = 100;
}
onClipEvent (enterFrame) {
xSide = _root._xmouse-this._x;
ySide = _root._ymouse-this._y;
hypo = Math.sqrt((xSide*xSide)+(ySide*ySide));
if (hypo<100) {
if (jamStopped == true) {
s_jam.start(0, 999);
jamStopped = false;
}
deltaV = startVol-(startVol*(hypo*.01));
} else {
deltaV = 0;
s_jam.stop();
jamStopped = true;
}
s_jam.setVolume(deltaV);
}
But it seems pretty archaic, since I think it was done for flash 5, and also I want to be able to customize the distance at which the sound starts to fade.
Does anybody know someway of doing it, or how to fix this code?
MovieClip Control On Mouse Proximity?
Hi guys. Really sorry this could be a real noob question!
I'm trying to make a mc play or reverse depending on how close or far away the mouse gets to the mc.
Basically I'd like that if you got withing 50 pixels of it, it would start to play but stop if you didnt get any closer, then play or reverse depending if you got closer or further away from it.
So if you were more than 50 pixels away from it it would be at the start of the mc, if you were dead on its _x & _y coordinates it would be at the end of the mc. Does that make sense?
Is it possible? if so how would I start to code that?
thanks a lot for your help in advance
DAve
Scale Based On Mouse Proximity
I would like to scale a movie clip based on how close the mouse gets to it, but flash slows when there are a ton of these. I'm looking for a new method -- any ideas?
onMouseMove = function(){
var dx:Number = this._x - _parent._xmouse;
var dy:Number = this._y - _parent._ymouse;
var dist:Number = Math.round(Math.sqrt(dx*dx + dy*dy));
if (dist<100){
this._xscale = this._yscale = 200 - dist;
this._alpha += 2;
} else if (dist>100){
this._xscale = this._yscale = 100;
this._alpha = 20;
}
}
Movieclip Fade With Mouse Proximity
Hi,
I would like to create a movieclip which is to fade in when the mouse gets within a certain proximity to it and then fades out when the mouse moves away.
I'm new to actionscript can someone help me..
Thanks in advance for any help.
Snap Mouse To Button(possible?)
Hey,
I have two movieclips that follow my mouse around the sceen.
The first movieclip is a set of crosshairs used for locating purposes. The second movieclip is a map that scrolls in any direction according to the mouse position.
What I need help with is this: I need to stop the crosshairs and map from scrolling on a mouseover event. Even better if it could exponetionaly decrease speed(magnet/snap) as i get closer to the center of my button.
Any suggestion would be great.
if you want to see the progress so far check out
http://www.canadianuniversal.com/new/header.html
Thanks
[MX04] Snap To Mouse
hi,
sorry this is a simple thing to do but i just cant remember. How do i go about snapping a movie clip to the mouse so it can be dragged?
cheers
MC Snap To AND Drop Off Mouse How?
Hey guys, I'm working on the same thing again, but instead of having to click and drag it. I was hoping that it could automatically snap to the cursor whenever its out of the nav area and drop/stopDrag whenever the cursor is in the nav area. Meanwhile always restricting its movements to the stage.
I've include my file.
The scene here is that the user clicks and drags the 'Contact Bar' over 'Me', and 'Me' exploseds, calling a getURL().
So is there anybody out there who can help me?
Mouse Follow Snap Menu
Hola! Does anyone know how to make a mouse follow, on a menu, on an x-axis, that snaps into place when the mouse is moved over certain menu buttons? I've created my own mouse follow that follows my mouse on an x-axis and is restricted to the menu area using the following code adapted from kirupa actionscript tutorial:
ActionScript Code:
onClipEvent (enterFrame) { getlimits = _root.menu.getBounds(_root); speed = 5; //get the limits of the normal pic movie if (_root._xmouse>=getlimits.xMin && _root._xmouse<=getlimits.xMax && _root._ymouse>=getlimits.yMin && _root._ymouse<=getlimits.yMax) { this.endX = _root._xmouse; _x += (endX-_x)/speed; }}
This works find and I like the effect I get from this, but I would ultimately like the mouse follow to snap onto a certain point on a button when the mouse is over the button. When rolled on to another button, it'll move to that button. Did I explain it clearly?
Much thanks is advance.
180 Degree Pan On Mouse Over - Stop In Place On Mouse Out
I want to do something similar to these except I would like to have left and right arrow buttons that pan on rollOver and stop in place on rollOut.
http://www.kirupa.com/developer/flas..._image_pan.htm
http://www.flashloaded.com/flashcomp.../360panviewer/
I was able to get it to pan on mouseover correctly, but mouseout seems to moving the mc to -3830. Here's my code
//code on panning_mc
onClipEvent(load){
_root.targetx = -3830; //Startposition
}
onClipEvent(enterFrame){
diff = _root.targetx - this._x;
this._x += diff/50;
}
//code on left button
on(rollOver){
_root.targetx = 50;
}
on(rollOut){
_root.targetx = panoramic_mc._x;
}
//code on right button
on(rollOver){
_root.targetx = -50;
}
on(rollOut){
_root.targetx = panoramic_mc._x;
}
Can anyone help?
MC's That Follow Mouse, Then Snap Back To Position?
Hi, I have five Movieclips with buttons in them for a navigation system.
I want to make them smoothly follow the mouse but only when the mouse is say 50 px close to it and when it moves futher than 50 pixels from the target area then the MC smoothly snaps back to its original position
I already have the code to make them smoothly follow the mouse but am getting confused in keeping it to an area then making it snap back
any help would be great.
Thanks in advance
How To Make Two Lines Snap To Your Mouse Cursor?
How to make two lines snap to your mouse cursor?
Example: http://www.kirupa.com/developer/mx/specialfx.htm
the flash file on the top ( small one )
Can anyone teach me and provide me with the code?
Goto Different Place In Timeline On Mouse Over?
The movie I'm trying to finish has a series of events that loop. I need to make it so that when a user rolls over the movie it automatically jumps to a place further down in the timeline with a (stop) in place. This would allow the viewer as much time as they wish to interact with that point in the movie. Then when they move the mouse away from the movie it continues to loop to the next frame. I have attached a .fla of what I have done to this point with an (on release) function that is working fine, however the rollover would be better. Thank you.
Mc Follow Mouse Cursor In Definition Place
hi, please can u halp me
iŽd like know how can i do:
mc witch follow mouse cursor only in definition place
script
onClipEvent (enterFrame) {
_root.mc._y = _root.mc._y+(_root._ymouse-_root.mc._y)/10;
if (_root.mc.hitTest(_root._xmouse, _root._ymouse, true)) {
}
}
thank you
Making OnDrag Lock The Mouse In Place
I don't know exactly how to word this.. basically, I have a homemade scroll button. All my scrolling works fine but I have a problem with onRelease because the mouse isn't on the scrollhead movieclip any moore. Is there a way to lock the x value of the mouse itself while dragging?
http://www.dustinandamy.info/TDOT/
Go to the Schedule page and drag the yellow scroll head.
-Dustin
Rom 8:28
I Want The Control Bar To Move When The User Moves His Mouse Over A Certain Place
I have been trying to figure this out for a loooong time and I'm still having issues.
I have an FLV. I also have a control bar that controls the FLV. I want the control bar to move when the user moves his mouse over a certain place and then for it to go off when the mouse over is off.
the problem is, when I put the mouse over that specific place, the buttons in the control bar no longer work...What am I doing wrong?!??arggh
attached is an fla if my explanation wasn't clear.
Mouse "Snap To" Effect?
Hey Guys,
Have you ever seen in sites such as http://www.seanjohn.com (the effect can be seen on the Nav Menu) or http://www.dubmagazine.com/dubindex.htm (the effect can be seen on the Nav Menu in the upper left hand corner) they have an effect (AS; most likely...) that when the mouse is near an object, the object "snaps" to the mouse pointer location?
Any ideas how this is done?
Mouse "Snap To" Effect?
Hey Guys,
Have you ever seen in sites such as http://www.seanjohn.com (the effect can be seen on the Nav Menu) or http://www.dubmagazine.com/dubindex.htm (the effect can be seen on the Nav Menu in the upper left hand corner) they have an effect (AS; most likely...) that when the mouse is near an object, the object "snaps" to the mouse pointer location?
Any ideas how this is done?
Paste In Place Between Movie Clips Is Not In Place Re The Stage
Hi,
I realize that pasting in place between movie clips is referening the registration point in each separate movie clip and that is why they don't align to the stage properly. So is there any way to turn this off?
Can I make my shapes align to the document stage size no matter what movie clip I'm in? Also, can the paste in place be made to paste in place always relative to the stage?
Thanks,
Stan
Place, Rotate And Check If The Place Is Free
hi,
I want develope a mini game like:
www.medienanfall.de/mix.swf
most important thing is in this game to place the elements in a free space so I have to check if the place is free or full. another problem is if I found a free place for the card I have the possibilty to rotate the card but only if the places on left,right,top or bottom are free. I believe this is the most diffulcult thing in my application.
I hope I could explain it with my terrible english.
I am looking for some tuts or inspirations. could somebody tell me
where I can find somthing similar?
Proximity
I wrote this action script to display the proximity of one object to another. The eventual idea is to use this as a variable in an interactive function, not just display it in a text box.
I seem to remember something that is already in flash that does this but I can't remember what it is.
If there is a function that is already in flash that will detect this or a better (shorter) way to write this script, please let me know.
Here's the script:
PHP Code:
onEnterFrame = function () {
// create the function that will read the proximity of ball 2 to ball 1
xDiff = Math.abs(_root.ball1._x-_root.ball2._x);
yDiff = Math.abs(_root.ball1._y-_root.ball2._y);
prox = xDiff+", "+yDiff;
// set the text box to read the proximity of ball 2 to ball 1
_root.coords.text = prox;
};
Thanks,
How Is This Done? Proximity?
Hello
How is the WHAT'S NEWS section navigation on this website done?
http://www.atlanticrecords.com/
I'd like to try to build something like this. I'm unsure of how they are getting the unselected elements to float to the correct y position when the selected box expands. I've seen a lot of stuff like this on the web and always wondered how it was done.
Proximity
I wrote this action script to display the proximity of one object to another. The eventual idea is to use this as a variable in an interactive function, not just display it in a text box.
I seem to remember something that is already in flash that does this but I can't remember what it is.
If there is a function that is already in flash that will detect this or a better (shorter) way to write this script, please let me know.
Here's the script:
PHP Code:
onEnterFrame = function () {
// create the function that will read the proximity of ball 2 to ball 1
xDiff = Math.abs(_root.ball1._x-_root.ball2._x);
yDiff = Math.abs(_root.ball1._y-_root.ball2._y);
prox = xDiff+", "+yDiff;
// set the text box to read the proximity of ball 2 to ball 1
_root.coords.text = prox;
};
Thanks,
How To Zoom In And Change From Place To Place
Hello, im fairly new to flash MX 2004 and i am currently working on animations.
Feel free to explain it to me in Actionscript or any other way. Here is my question:
For example. A man is walking in a town. This man then reaches the end of the stage (in your fla. work place), what is a way to show the new backround? make a new keyframe right after with a new background? or is there an easier way.
Another thing, how can i have like im a camera type view, and move around showing diffrent things in the backround (while moving left lets say)
Last thing.. zooming in, how can i do it with a picture backround from the internet?
thanks
Sending A Shape From Place To Place
How would i send a shape or movie clip from its current position into a specified place in another movie clip somewhere?
basically i want to make it so that if you click a circle, it will disappear and get sent into a movie clip at this destination: _root.skillsanditems.slot1
any ideas?
How To Load Data From One Place To Other Place
Hello Friends
Can any one help me how to move Some files Such as .JPEG,.MP3,.Swf Files from one directpry to the other directory by Renaming
Throug Flash as a Front end
Plz let me know soon
Proximity Question
I have a small movie which utilizes a proximity script to control a visual effect. Unfortunately, there's a bug in the script that causes an error in the effect. To see what I'm talking about, please go to this address:
http://www.pikappaphi.net/Main/rosequeen.html
As you can see, when the mouse leaves the movie, the proximity script pauses, because there is no return value from the _xmouse or _ymouse variable. I'm looking for a script that would restore all the boxes to their original positions when the mouse leaves the movie. My script used for one of the boxes is below.
R=.25, F=.9;
StartX=52;
StartY=52;
function ClipRotation() {
X = _root._xmouse-StartX;
Y = _root._ymouse-StartY;
}
function ClipPlacement() {
gotoAndStop(int(Distance));
distance = Math.sqrt(X*X+Y*Y);
Ang = Rn*(Math.PI/180)-180;
Xp = Radius*Math.cos(Ang);
Yp = Radius*Math.sin(Ang);
Xn = StartX+Xp;
Yn = StartY+Yp;
_x -= Ax=(ax+(_x-Xn)*R)*F;
_y -= Ay=(ay+(_y-Yn)*R)*F;
if (Distance<100) {
Radius = 50-Distance;
_xscale = _yscale=Distance;
} else {
_xscale = _yscale=100;
Radius = 0;
}
}
[Edited by Tknaff1 on 03-28-2002 at 10:06 PM]
Using Proximity To Control Mc
I'm trying to figure out how to use proximity to control the playhead of a movie clip. Has anyone seen any tutes or open source on this? I've seen it used to control things like scale and alpha, but not for this type of thing.
I think it has something to do with using an empty MC and start drag, getting the x and y position, and dividing it by the x and y position of the MC I want to control. Any ideas?
Thanks in advance...
-B
PROXIMITY = VOLUME ?
I had posted this on the sound board and was referred here.
Can I have it so that when the mouse goes close to something, the volume of music increases and then decreases as it goes away again?!
The suggestion I was given was this:
---
convert x and y cooridinates into a value between 0 - 100. use the sound object setVolume() method to change volume.
you might ask for specifics on this in the ActionScript forum---
Here I am. Ive managed a lot but this eludes me! Id love some help!
Proximity Question..
I understand all the "visual" elements in flash (tweens etc..) and how to preload etc..
but how can i make an object react in relation to the proximity (how close it is) of the mouse?
eg.
flower. close when mouse away, slowly opens when mouse moves towards.
any help ? thanks
Proximity Question
Hi-
I am using a proximity component and it works fine. But say I had five boxes and would like to set an on(release) function to each one. Is that possible?
I can send the fla if necessary.
Thank you
Proximity Problem Please Help
What I am trying to do is to control a movie clip's timeline depending on the mouse proximity to the MC. Basically I have an animation inside the MC. By default the MC is stopped on Frame 1. As the user gets closer to the MC, the animation starts to play. When the user moves the mouse away from the MC, the animation plays back to its original state. When the user clicks on the MC, the animation continues to play and stops at the last frame. This is the code I'm trying to use. (I'm a novice in Actionscript)
onClipEvent (enterFrame) {
circle = this._totalframes;
mouse_area = 1000;
percent = mouse_area/circle;
mousepos = _root._xmouse;
mousex = _root._xmouse;
mousey = _root._ymouse;
clipx = clip._x;
clipy = clip._y;
proximity = Math.sqrt((mousex-clipx)*(mousex-clipx) + (mousey-clipy)*(mousy-clipy));
if(proximity<100) {
this.gotoAndStop(math.round(mousepos/percent));
}
else {
}
}
[F8] Implementing Proximity
I'm trying to get some movie clips to duplicate from a single point on the stage and with each iteration I want them to move further away from the start point. This way thay can cover the whole stage and unmask the entire image below.
I sort of have it working with this code, however I think I have some of the math wrong or something because they duplicated movieClips never cover the entire stage. Can anyone poini out my error in the code below?
Code:
var intervalId:Number;
var duration:Number = 50;
var prox:Number = 5;
var control = prox;
var count:Number = 1;
var maxCount:Number = 17;
var startX:Number = 400;
var startY:Number = 200;
var xMin:Number = 0-startX;
var xMax:Number = 500;
var yMin:Number = 0-startY;
var yMax:Number = 280;
function executeMasking():Void {
_root.mcMask.mcItem._x = startX;
_root.mcMask.mcItem._y = startY;
for (i=1; i<=count; i++){
n = i*count;
randomX = (Math.round(Math.random()*(xMax-xMin)/prox))+(startX/2);
randomY = (Math.round(Math.random()*(yMax-yMin)/prox))+(startY/2);
orgClip = "mcMask.mcItem";
dupClip = "mcMask.mcItem"+n;
clipDepth = mcMask.getNextHighestDepth();
mcMask.mcItem.duplicateMovieClip(dupClip, clipDepth,{_y:randomY, _x:randomX});
}
if(count >= maxCount) {
clearInterval(intervalId);
trace("cleared");
}
if(control>count){
prox--;
}
count++;
}
intervalId = setInterval(this, "executeMasking", duration);
Function Proximity As2
Hello, I'm beguinner in flash 8 and worst french, but you might help me, no ?
I try this code, but it don't work. Why ?
function proximity(clip) {
var x:Number = _root._xmouse;
var y:Number = _root._ymouse;
var cx:Number = clip.x;
var cy:Number = clip.y;
var prox:Number = Math.sqrt((x-cx)*(x-cx) + (y-cy)*(y-cy));
if (prox<50) {
clip._xscale = 150 - prox;
clip._yscale = clip._xscale;
} else {
clip._xscale = 100;
clip._yscale = clip._xscale;
}
}
this.onEnterFrame = function() {
proximity(mc1);
proximity(mc2);
proximity(mc3);
}
mc1.onRollover = mc2.onRollover = mc3.onRollover = function () {
this.swapDepths(_root.getNextHighestDepth());
};
Proximity Elasticity
does anyone know what proximity code to add to this elasticity fla to get the elastic effect to only respond to the proximity of the mouse intead of the root.
|