Me revoilou !!

J'ai un souci (encore un !). Je souhaiterai déplacer une clip (pion) d'un point A à un point B. Disons de 0 à 1000 en x.

J'aimerai faire varier la vitesse tous les 100 px et tout ça de manière aléatoire. Alors j'ai fait un truc lourd avec tween mais j'ai 4 clips comme ça !!! Je rappelle que je débute alors soyez sympa ;-)

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
stop();
import fl.transitions.*;
import fl.transitions.easing.*;
var tab:Array = new Array();
var Start:Number = 1;
var End:Number = 10;
for(var ind=Start; ind<=End; ind++)
tab.push(ind);
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
function move_1A () {
var mvt1A:Tween;
var pos1A=pion1.x
var vit1A=tab[Math.round (Math.random() * (tab.length-1))];
mvt1A = new Tween(pion1,"x",Regular.easeOut,pos1A,100,vit1A,true);
mvt1A.addEventListener(TweenEvent.MOTION_FINISH ,move_1B);
}
 
function move_1B (evt:TweenEvent) {
var mvt1B:Tween;
var pos1B=pion1.x
var vit1B=tab[Math.round (Math.random() * (tab.length-1))];
mvt1B = new Tween(pion1,"x",Regular.easeOut,pos1B,200,vit1B,true);
mvt1B.addEventListener(TweenEvent.MOTION_FINISH ,move_1C);
}
 
function move_1C (evt:TweenEvent) {
var mvt1C:Tween;
var pos1C=pion1.x
var vit1C=tab[Math.round (Math.random() * (tab.length-1))];
mvt1C = new Tween(pion1,"x",Regular.easeOut,pos1C,300,vit1C,true);
mvt1C.addEventListener(TweenEvent.MOTION_FINISH ,move_1D);
}
 
function move_1D (evt:TweenEvent) {
var mvt1D:Tween;
var pos1D=pion1.x
var vit1D=tab[Math.round (Math.random() * (tab.length-1))];
mvt1D = new Tween(pion1,"x",Regular.easeOut,pos1D,400,vit1D,true);
mvt1D.addEventListener(TweenEvent.MOTION_FINISH ,move_1E);
}
 
function move_1E (evt:TweenEvent) {
var mvt1E:Tween;
var pos1E=pion1.x
var vit1E=tab[Math.round (Math.random() * (tab.length-1))];
mvt1E = new Tween(pion1,"x",Regular.easeOut,pos1E,500,vit1E,true);
mvt1E.addEventListener(TweenEvent.MOTION_FINISH ,move_1F);
}
 
function move_1F (evt:TweenEvent) {
var mvt1F:Tween;
var pos1F=pion1.x
var vit1F=tab[Math.round (Math.random() * (tab.length-1))];
mvt1F = new Tween(pion1,"x",Regular.easeOut,pos1F,600,vit1F,true);
mvt1F.addEventListener(TweenEvent.MOTION_FINISH ,move_1G);
}
 
function move_1G (evt:TweenEvent) {
var mvt1G:Tween;
var pos1G=pion1.x
var vit1G=tab[Math.round (Math.random() * (tab.length-1))];
mvt1G = new Tween(pion1,"x",Regular.easeOut,pos1G,700,vit1G,true);
mvt1G.addEventListener(TweenEvent.MOTION_FINISH ,move_1H);
}
 
function move_1H (evt:TweenEvent) {
var mvt1H:Tween;
var pos1H=pion1.x
var vit1H=tab[Math.round (Math.random() * (tab.length-1))];
mvt1H = new Tween(pion1,"x",Regular.easeOut,pos1H,800,vit1H,true);
mvt1H.addEventListener(TweenEvent.MOTION_FINISH ,move_1I);
}
 
function move_1I (evt:TweenEvent) {
var mvt1I:Tween;
var pos1I=pion1.x
var vit1I=tab[Math.round (Math.random() * (tab.length-1))];
mvt1I = new Tween(pion1,"x",Regular.easeOut,pos1I,900,vit1I,true);
mvt1I.addEventListener(TweenEvent.MOTION_FINISH ,move_1J);
}
 
 
function move_1J (evt:TweenEvent) {
var mvt1J:Tween;
var pos1J=pion1.x
var vit1J=tab[Math.round (Math.random() * (tab.length-1))];
mvt1J = new Tween(pion1,"x",Regular.easeOut,pos1J,1000,vit1J,true);
mvt1J.addEventListener(TweenEvent.MOTION_FINISH ,finish1);
}
 
function finish1 (evt:TweenEvent) {
trace("FINI")
}
 
move_1A();
C'est très lourd !! Il doit y avoir plus court !!

Merci de votre aide précieuse...

Coincoin22