PDA

View Full Version : *backwards*!



shuga
November 14th, 2002, 02:39 PM
alright, here's what i want to do. hopefully someone can help me figure this out.

i have this code, generously taught to me by lostinbeta


onClipEvent (load) {
_x = 0;
_y = 0;
speed = 1;
}
onClipEvent (enterFrame) {
endX = _root._xmouse;
endY = _root._ymouse;
_x += (endX-_x)/speed;
_y += (endY-_y)/speed;
}


and i would like it to do exactly the opposite of what it's doing.

currently it is set to follow the mouse without using startDrag()
and i would like to apply this to a panoramic view that has several pictures sliding past one another .... a lot like lostinbeta's footer. but rather than sliding to the _ymouse i would like it to go to the opposite of the _ymouse so that it appears more realistic.

any help is appreciated =)

h88
November 14th, 2002, 08:08 PM
Hey shuga,

set a new mc in the center of u movie, call the instance name "topCorner", put the code given in ur _root timeline, and define which instance should oppose the mouse movement! :


_root.onMouseMove = function() {
theBall._x = Math.abs(topCorner._xmouse);
theBall._y = Math.abs(topCorner._ymouse);
};

Hope this helps,

yours,
h88

NOTE: topCorner should be an empty MC

shuga
November 15th, 2002, 12:06 PM
didn't work :(

atleast not for me

on the main stage, layer 1, frame 1 I have two symbol instances
"ball" and "topCorner" .... ball is just a ball and topCorner is an empty mc. there is no code on the instance of topCorner, the code i posted is on ball and the code you posted is on frame 1 of the timeline.

ball still follows the mouse, more choppy (probably b/c there's more code it's going through each time, but it still just follows the mouse :)

did i do something wrong?

shuga
November 15th, 2002, 12:11 PM
i tried to figure out what you were doing with the code, and it dawned on me that they oppose each other in their commands for ball. so i took the code off of ball which, i'm sure i should've done in the first place and it works. well sorta. i'm going to play with it to see if i can get it to work more smoothly. and i don't quite understand why it works. thank you for your help =)

h88
November 19th, 2002, 05:13 AM
Hmm, okay, another solution which will work smoothly:


MC.onMouseMove = function() {
this._x = 550-_root._xmouse;//define wide of ur movie other than 550
this._y = 400-_root._ymouse;//define height of ur movie other than 400
};

Tell me how it goes!

shuga
November 19th, 2002, 03:22 PM
it works wonderfully .... thank you so much.

thats really weird b/c i tried some similar code and it didn't work. i guess you just did it the perfect way =)

thanks again, i appreciate it.

h88
November 19th, 2002, 03:23 PM
No problem! :)

h88
November 19th, 2002, 03:38 PM
Can i have a look at what your trying to achieve using the code given?

shuga
November 19th, 2002, 05:20 PM
sure thing

i actually didn't use the code you gave me in the fla b/c it has to be put on the frame and i have multiple instances of the symbol so i would like to have the code on the symbol, although i'm sure i could make either way work. i used lostinbeta's code b/c it has the easing in it and i took the two codes and combined them.

here's the original code


onClipEvent (load) {
Mouse.hide();
_x = 0;
_y = 0;
speed = 1;
}
onClipEvent (enterFrame) {
endX = _root._xmouse;
endY = _root._ymouse;
_x += (endX-_x)/speed;
_y += (endY-_y)/speed;
}

and here's the code i came up with


onClipEvent (load) {
Mouse.hide();
_x = 0;
_y = 0;
speed = 1;
}
onClipEvent (enterFrame) {
endX = 550-_root._xmouse;
endY = 400-_root._ymouse;
_x += (endX-_x)/speed;
_y += (endY-_y)/speed;
}

a really simple change and i really should've seen it before but i guess it took looking at it from another coding technique's point of view for me to see what i should be doing. thank you again so much for helping me with that. i appreciate it.

i've attached the fla file so you can see what i'm doing. at the moment it's just experimental so the imagery is just balls. i will refine it and put real images in there soon and i'll submit my final product here.

thanks =)

h88
November 19th, 2002, 05:27 PM
Hey, cool one, but i really get confused when i c a hidden mouse, with some easing objects.

shuga
November 19th, 2002, 05:35 PM
yeah ... that was merely for experimentation

here is closer to the effect i'm trying to achieve. still without the images but imagine each of the balls as a layer of the scene (like lostinbeta's footer)

=)

h88
November 19th, 2002, 05:38 PM
Thats really cool though, needs more, try improving by adding some pictures.

Good Luck!

shuga
November 19th, 2002, 05:41 PM
lol =) i said the pictures aren't in there yet. i'm still deciding exactly what i want the scenery to be now that i have the coding down. :P

h88
November 19th, 2002, 05:42 PM
Try updating in this thread and tell us what did u achieve.

shuga
November 19th, 2002, 05:43 PM
will do =)

morse
November 19th, 2002, 07:04 PM
Everybody likes Lost's footer. Hehe, even me... Have you seen Dan's footer?

shuga
November 19th, 2002, 07:37 PM
nice!

shuga
November 19th, 2002, 08:17 PM
first version is up now .. i know the imagery isn't all that much but i will work on it more later, i just put this together in a few minutes before class.

h88
November 20th, 2002, 12:47 PM
Your footer is good, first fo all, i think you should change your avatar, lol, or even with no avatar, and, the text "shuga", try changing the font.