1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| 1. // fonction de la scrollBarr
2. function scrollbarr(Curseur:MovieClip, Barre:MovieClip, Texte:MovieClip) {
3. // Variable liées à la barre
4. Barre._x = Texte._x+Texte._width+20;
5. max_hauteur = Barre._y;
6. max_bas = (max_hauteur+Barre._height)-Curseur._height+2;
7. pos_centre = (Barre._x-(Curseur._width/2))+2;
8. Curseur._x = pos_centre;
9. tailleScroll = Barre._height;
10.
11.
12. // Réinitialise la position du curseur
13. Curseur._y = max_hauteur;
14.
15. Curseur.onPress = function() {
16. startDrag(this, true, pos_centre, max_hauteur, pos_centre, max_bas);
17.
18. // memo :quand tu bouges la scroll barr de 1% tu bouges aussi le texte de 1%
19.
20. this.onEnterFrame = function() {
21. // Variable liées au texte
22. Texte_hauteur = Texte._height;
23. Texte_Un_Pourcent = 1/Texte_hauteur*100;
24. Texte_Pourcent = Texte_Un_Pourcent*Texte_hauteur;
25. curseurY = Curseur._y;
26.
27. // Je convertie la position de mon curseur en pourcentage par rapport à la taille de la barre
28. curseurPosY = (curseurY-max_bas)/(max_hauteur-max_bas)*100;
29. // J´arrondie le nombre pour tomber sur un chiffre rond
30. curseurPosY = Math.round(curseurPosY);
31.
32. // Et après je trouve pas, je dirais même que je galère...
33.
34. };
35. };
36. Curseur.onRelease = function() {
37. stopDrag();
38. delete this.onEnterFrame;
39. };
40. Curseur.onReleaseOutside = function() {
41. stopDrag();
42. delete this.onEnterFrame;
43. };
44. }
45.
46.
47.
48. scrollbarr(curseur,barre,texte);
49. stop(); |
Partager