-
Pls help
I have this arrow which i wish to move from left to right according to the mouse location and stop following when the mouse moves to a certain location. Therefore I tried adding the following to the arrow symbol
Code:
onClipEvent (enterFrame) {
startDrag(getProperty(_x, _y), true, 0, 389, 550, 389);
}
However, since I used the startDrag script but didn't end with a stopDrag script, I cannot do anything in my movie as it is still dragging. So I thought of changing it to the following:
Code:
onClipEvent (enterFrame) {
startDrag(getProperty(_x, _y), true, 0, 389, 550, 389);
if (_x <= 379) {
stopDrag ()
}
}
But now the arrow does not move but I can click on buttons and such. Can anyone please help me modify it so that it works but does not do anything to my other objects?
Thanx a milliion!
-
Senior Member
Don't use drag. Use this instead:
onClipEvent (enterFrame) {
_x=_root._xmouse;
_y=_root._ymouse;
}
B
-
Thanks alot, it works but how do I make it like your site's nav bar? In your site, when I move my mouse to a certain height, the nav bar returns back to one corner. Like your nav bar how do I make it so that when my mouse moves to a certain part of the movie, the arrow stops following? Oh yes, how do i make other smaller arrows follow the main mouse in a bouncing fashion like your signature?
thnx again!
[Edited by dud on 03-15-2002 at 07:30 PM]
-
Senior Member
This is how my nav bar is set up:
onClipEvent (enterFrame) {
if (_root._ymouse>=425) {
tx=400;
ty=450;
} else {
tx=-150;
ty=475;
}
_x=_x-.25*(_x-tx);
_y=_y-.25*(_y-ty);
}
The rest is triggered by buttons.
How do you mean 'bouncing'? You mean motion trails? (cuz that's what my sig is doin').
B
-
I dont really know whats all that...i'm just beginning to learn AS.
When i say bouncing i mean like when i move the mouse to one side, the rest follow in but bounce from left to right abit...like boing...boing...
THANX!!!!
-
Senior Member
You kinda lost me....what is it that bounces from left to right? You mean the way the letters move <of brealdesign>?
As for the code, you want me to explain?
B
-
Nevermind about the bouncing part 1st. but can you please explain the code to me? roguhly i know hwta it means but I wanna know what it does. THNX A MIL!!!!
-
Senior Member
You put this code in the MC (right-click on the MC and select "Actions").
onClipEvent (enterFrame) {
if (_root._ymouse>=425) {
tx=400;
ty=450;
} else {
tx=-150;
ty=475;
}
_x=_x-.25*(_x-tx);
_y=_y-.25*(_y-ty);
}
It means, it the y position of the mouse is greater than 425, tx and ty get values, otherwise other values. Those values are then used next -- x position gets x position minus 25% of the difference between x position and tx. It gives it that variable speed, because it moves 25% of the distance remaining (tx and ty are the destination positions). Make sense?
B
-
-
it stil doenst work.
goto http://portfolio.10der.org/main.htm and see the nav bar. when you move your mouse in between the words, the green and grey MC follows the mouse, if you move your mouse away from the words, it stops following.
How do I do that?
-
Senior Member
All you need to do is change the parameters a bit.
onClipEvent (load) {
initx = _x;
}
onClipEvent (enterFrame) {
if (_root._ymouse>=325 && _root._ymouse<=341 && _root._xmouse<=275) {
tx = _root._xmouse;
} else {
tx = initx;
}
_x = _x-.25*(_x-tx);
}
B
-
How do i make a MC such that its like a trailing thingy, like your signature, the back follows the front...
THNX!!!!!!
[Edited by dud on 03-19-2002 at 01:52 AM]
-
Senior Member
Make two clips, both of which look the same (in my case, two white circles). One is the 'head', the other 'tail'. Give the head code that handles motion, and duplicating the tail, give the tail code/animation of fading/scaling down. Them's the basics.
B
-
-
Senior Member
Here's an easy example:
onClipEvent(load){
destx=random(550);
desty=random(400);
i=1;
}
onClipEvent(enterFrame){
_x+=.25*(destx-_x);
_y+=.25*(desty-_y);
if(_x>.99*destx){
destx=random(550);
desty=random(400);
}
_root.tail.duplicateMovieClip("tail"+i,i);
_root["tail"+i]._x=_x;
_root["tail"+i]._y=_y;
i++;
}
Then add a removeClip(this), at the end of the 'tail's animation, and make sure it starts off screen.
B
-
I dont really understand but nevermind.
thnx for all your help!!
-
Senior Member
-
thank you, it works now, but if i put the trail there, my tail MC will appear at the top left corner of my Movie.
why is that so?
[Edited by dud on 03-20-2002 at 02:24 AM]
-
Senior Member
Are you embedding the mc's in another MC? 'put the trail there'? Need to know a little more re: the structure of you flash (i think).
B
-
well, you know the script you gave me for the nav bar, the one which starts with 'onClipEvent(enterFrame){ initx = _x;' i put the trailing code after that code, so I have two codes on one MC. Now when I play my movie, the trailing MC (tail) appears at the top right hand side of my movie... how to remove? I think it has to do with the _x and the _y
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
|