Probleme Flash MX - Logiciels - Windows & Software
Marsh Posté le 13-02-2003 à 09:35:32
jespere que je suis dans le bon forum. Je cherche a centrer le mouvement droite-gauche de la souris dans mon anim flash qui suit: http://www.courchevel.com/temp/menu.html Quelqu'un connait un peu l'actionscript?Ca doit pas etre grand chose, une valeur a changer...J'ai regardé mais je ne trouve pas quoi modifier. Voila le code sur la frame: acceleration = .06; stageWidth = 1000; sliderWidth = getProperty("/slider", _width); maxSpeed = ((stageWidth/2)/20)*(acceleration*((stageWidth/2)/20)); trace(maxSpeed); speed = 0; setProperty("/slider", _visible, false); duplicateMovieClip("/slider", "slider1", 1); duplicateMovieClip("/slider", "slider2", 2); duplicateMovieClip("/slider", "slider3", 3); startDrag("/draggy", true); Et dans ma movie clip invisible: distance = getProperty("/draggy", _x)-(/:stageWidth/2); if (Number(distance)<0) { direction = 1; } else { direction = -1; } speed = (distance/20)*(/:acceleration*(distance/20))*direction; setProperty("/slider1", _x, Number(getProperty("/slider1", _x))+Number(speed)); setProperty("/slider2", _x, Number(getProperty("/slider1", _x))+Number(/:sliderWidth)); setProperty("/slider3", _x, Number(getProperty("/slider2", _x))+Number(/:sliderWidth)); if (Number(getProperty("/slider3", _x))>Number((Number(/:stageWidth)+Number(/:maxSpeed)))) { setProperty("/slider3", _name, "temp" ); setProperty("/slider2", _name, "slider3" ); setProperty("/slider1", _name, "slider2" ); setProperty("/temp", _name, "slider1" ); setProperty("/slider1", _x, getProperty("/slider2", _x)-/:sliderWidth); } else { if (Number(getProperty("/slider2", _x))<Number((-/:maxSpeed))) { setProperty("/slider1", _name, "temp" ); setProperty("/slider2", _name, "slider1" ); setProperty("/slider3", _name, "slider2" ); setProperty("/temp", _name, "slider3" ); setProperty("/slider3", _x, Number(getProperty("/slider2", _x))+Number(/:sliderWidth)); } } Sur la 2eme frame de ma movie clip invisible: distance = getProperty("/draggy", _x)-(/:stageWidth/2); if (Number(distance)<0) { direction = 1; } else { direction = -1; } speed = (distance/20)*(/:acceleration*(distance/20))*direction; setProperty("/slider1", _x, Number(getProperty("/slider1", _x))+Number(speed)); setProperty("/slider2", _x, Number(getProperty("/slider1", _x))+Number(/:sliderWidth)); setProperty("/slider3", _x, Number(getProperty("/slider2", _x))+Number(/:sliderWidth)); if (Number(getProperty("/slider3", _x))>Number((Number(/:stageWidth)+Number(/:maxSpeed)))) { setProperty("/slider3", _name, "temp" ); setProperty("/slider2", _name, "slider3" ); setProperty("/slider1", _name, "slider2" ); setProperty("/temp", _name, "slider1" ); setProperty("/slider1", _x, getProperty("/slider2", _x)-/:sliderWidth); } else { if (Number(getProperty("/slider2", _x))<Number((-/:maxSpeed))) { setProperty("/slider1", _name, "temp" ); setProperty("/slider2", _name, "slider1" ); setProperty("/slider3", _name, "slider2" ); setProperty("/temp", _name, "slider3" ); setProperty("/slider3", _x, Number(getProperty("/slider2", _x))+Number(/:sliderWidth)); } } merci a tous
Make sure you enter the(*)required information where indicate.HTML code is not allowed
Marsh Posté le 13-02-2003 à 09:35:32
jespere que je suis dans le bon forum.
Je cherche a centrer le mouvement droite-gauche de la souris dans mon anim flash qui suit:
http://www.courchevel.com/temp/menu.html
Quelqu'un connait un peu l'actionscript?Ca doit pas etre grand chose, une valeur a changer...J'ai regardé mais je ne trouve pas quoi modifier.
Voila le code sur la frame:
acceleration = .06;
stageWidth = 1000;
sliderWidth = getProperty("/slider", _width);
maxSpeed = ((stageWidth/2)/20)*(acceleration*((stageWidth/2)/20));
trace(maxSpeed);
speed = 0;
setProperty("/slider", _visible, false);
duplicateMovieClip("/slider", "slider1", 1);
duplicateMovieClip("/slider", "slider2", 2);
duplicateMovieClip("/slider", "slider3", 3);
startDrag("/draggy", true);
Et dans ma movie clip invisible:
distance =
getProperty("/draggy", _x)-(/:stageWidth/2);
if (Number(distance)<0) {
direction = 1;
} else {
direction = -1;
}
speed = (distance/20)*(/:acceleration*(distance/20))*direction;
setProperty("/slider1", _x, Number(getProperty("/slider1", _x))+Number(speed));
setProperty("/slider2", _x, Number(getProperty("/slider1", _x))+Number(/:sliderWidth));
setProperty("/slider3", _x, Number(getProperty("/slider2", _x))+Number(/:sliderWidth));
if (Number(getProperty("/slider3", _x))>Number((Number(/:stageWidth)+Number(/:maxSpeed)))) {
setProperty("/slider3", _name, "temp" );
setProperty("/slider2", _name, "slider3" );
setProperty("/slider1", _name, "slider2" );
setProperty("/temp", _name, "slider1" );
setProperty("/slider1", _x, getProperty("/slider2", _x)-/:sliderWidth);
} else {
if (Number(getProperty("/slider2", _x))<Number((-/:maxSpeed))) {
setProperty("/slider1", _name, "temp" );
setProperty("/slider2", _name, "slider1" );
setProperty("/slider3", _name, "slider2" );
setProperty("/temp", _name, "slider3" );
setProperty("/slider3", _x, Number(getProperty("/slider2", _x))+Number(/:sliderWidth));
}
}
Sur la 2eme frame de ma movie clip invisible:
distance = getProperty("/draggy", _x)-(/:stageWidth/2);
if (Number(distance)<0) {
direction = 1;
} else {
direction = -1;
}
speed = (distance/20)*(/:acceleration*(distance/20))*direction;
setProperty("/slider1", _x, Number(getProperty("/slider1", _x))+Number(speed));
setProperty("/slider2", _x, Number(getProperty("/slider1", _x))+Number(/:sliderWidth));
setProperty("/slider3", _x, Number(getProperty("/slider2", _x))+Number(/:sliderWidth));
if (Number(getProperty("/slider3", _x))>Number((Number(/:stageWidth)+Number(/:maxSpeed)))) {
setProperty("/slider3", _name, "temp" );
setProperty("/slider2", _name, "slider3" );
setProperty("/slider1", _name, "slider2" );
setProperty("/temp", _name, "slider1" );
setProperty("/slider1", _x, getProperty("/slider2", _x)-/:sliderWidth);
} else {
if (Number(getProperty("/slider2", _x))<Number((-/:maxSpeed))) {
setProperty("/slider1", _name, "temp" );
setProperty("/slider2", _name, "slider1" );
setProperty("/slider3", _name, "slider2" );
setProperty("/temp", _name, "slider3" );
setProperty("/slider3", _x, Number(getProperty("/slider2", _x))+Number(/:sliderWidth));
}
}
merci a tous