View Full Version : Sliding/Infinite Menu
kruza
November 12th, 2002, 09:28 PM
onClipEvent (load)
{
xcenter=377;
speed=1/10;
}
onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
if (_x > 0) _x=-754;
if (_x < -754) _x=0;
}
Ok i did the tutorial but something is wrong cuz when i created my own little sliding thingy and i put my mouse so it slides left or right on the right side it cuts off a bit when going infinite.
I think its something to do with the positioning of my menu because its not on x=0 its on x=120.8 and i was trying to work out how to fix it but i'm stuck...and when i move the menu to x=0 it works nicely...please helP! what values do i need to change?
andr.in
November 13th, 2002, 12:35 AM
Post your .fla so somebody can give better help.
kruza
November 13th, 2002, 08:01 AM
well its actually a tutorial from this site with a few changes..just length and positioning...
PLZ HELP!
kornkid8281
November 13th, 2002, 06:27 PM
Post your .fla so somebody can give better help.
upuaut
November 14th, 2002, 02:38 AM
might be a localToGlobal issue.. though I've never gotten that to work correctly so.. I guess I really don't have an answer. :)
kruza
November 14th, 2002, 03:38 AM
sorry guys i'll post the .fla now
kruza
November 14th, 2002, 03:40 AM
could someone also correct the center for me..
thanks for all your helP!
andr.in
November 14th, 2002, 08:34 AM
Fixed it! The numbers were all a bit wrong...
hehe took me about 2min :)
NB! Change the line
var distance = _root._xmouse-xcenter;
to
var distance = (_root._xmouse-xcenter)*-1;
so If you move the cursor to the left the menu moves to the right... more comfortable. If I see "pictures" on the left that I move my cursor to the left to click on it but if you don't add "*-1" then the button "pictures" moves away from the cursor and that's annnoying...
kruza
November 14th, 2002, 10:19 AM
ok thanks...but what numbers do i have to change?
because it still seems to cut off on the right of the slide JUST after the number 6 appears..
andr.in
November 14th, 2002, 11:21 AM
OOPS! Stupid me! How didn't I notice!
I forgot to attach the .fla and din't notice it! :P silly me :) http://www.kirupa.com/forums/smileys_files/bangin.gif
there ya go :)
kruza
November 14th, 2002, 10:04 PM
thanks alot!
WORKS GREAT!!!!
...ok i wanted one more thing to be added...
i would love to know how to make it pause slightly after the mouse isn't over the strip...like on the sony website...where it moves the mouse goes over then it goes somewhere else and the strip is paused and then slowly starts moving again...
do you know what i mean?
kruza
November 14th, 2002, 10:43 PM
oh & another question...how do i make the movement of the strip subject only when the mouse is over the strip..not around it..
Ryall
November 15th, 2002, 12:48 AM
where on the sony site.. I went sony.com and didnt see anything - their site is so big I didnt really feel like searhing.
Peace
andr.in
November 15th, 2002, 09:14 AM
I thin what you mean by that 1. question but... maybe explain a bit more...
that second one doesn't look hard though!
you can detect where the mouse is before moving the slider
if((_root._xmouse>=100) and (_root._xmouse<=300) and(_root._ymouse>=200) and (_root._ymouse<=400)) {
the actions here
}
or something like that! OR you can use hitTest which is easier!
http://www.kirupa.com/developer/actionscript/hittest.asp
:)
andr.in
November 15th, 2002, 09:17 AM
I just remembered! If you use hitTest then you have to make a movieclip follow the mouse cursor and detect the movieclips position!
kruza
November 17th, 2002, 09:55 AM
THis is the SONY Link http://www.sonypictures.com/movies/index_ie.html
Ok now here's what i want to do.
-Firstly i want constant movement to the left or whatver...then when the mouse goes over it moves to relative position (that parts done)
-And THEN i would like it if your cursor goes off the moving menu it pauses slightly then starts rolling again just like in the SONY site. BUT i don't want arrows....
TA!
andr.in
November 17th, 2002, 10:39 AM
now you should know how to detect if the cursor is not on the menu.
and this should work...
if not on menu.... {
nohittimer = getTimer()/1000
if(getTimer()/1000-nohittimer >= 2) {
_root.menumove = true;
}
this detects if 2 seconds have elapsed since the cursor moved out of the menu area. the next should be put on a movieclip
onClipEvent(enterFrame) {
if(_root.menumove) {
mymenu._x += 2;
}
}
This makes the menu move.
and you also have to make _root.menumove false when you move the cursor on the menu...
kruza
November 20th, 2002, 05:20 AM
thanks alot SYKO!
i worked out how to make the menu not move when i'm not around it..
BUT i can't make it move by itself ...maybe its because i put all your code into my movieclip of the menu???
where do i put the timer code etc?
kruza
November 25th, 2002, 09:21 PM
i found out how to make the menu move by itself BUT the 2 sec "pause" isn't working....
EDIT* also when the menu is moving by itself does not repeat...just passes once...i'm trying to work that out now *EDIT
kruza
November 26th, 2002, 07:40 PM
I really need some good old help here....
All i need to work now is that when the Sliding Menu moves by itself it should repeat and appear infinite, because at the moment it passes once....i can't seem to get it to repeat! aaaaarrgghh...
please read the above points for your reference......
KalakalasH
July 11th, 2004, 07:21 PM
This is how I did it...
onClipEvent (load)
{
xcenter=258.4;
speed=1/50;
}
onClipEvent (enterFrame)
{
if((_root._xmouse>=25) and (_root._xmouse<=541) and(_root._ymouse>=532.8) and (_root._ymouse<=607.8))
{
var distance=(_root._xmouse-xcenter)*-1;
_x+=(distance*speed);
if (_x > 0) _x=-914;
if (_x < -914) _x=0;
}
else
{
_x+=(50*0.02);
if (_x > 0) _x=-914;
if (_x < -914) _x=0;
}
}
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.