Hi:
I’m trying to write a code in actionscript. I’m new to flash. The movie is a dice that random 6 number and another movie clip walks the number of frames that the dice sorted.
There are two movieclips. One is the dice itself and the other is a ball that has a guided path. The ball instance name is “boneco”. And the dice instance name is “dado”. The problem is when I set the currentframe + X to make the ball walk. The movie reads the currentframe always as the first frame of the movieclip. So if the dice sorted 6 and the ball is at frame 7 it goes back to frame 6 instead of going forward because it reads currentframe always as frame 1.
So here is the code.
function sortear (){
var randomDado: Number = Math.ceil (Math.random ()*6);
var dado1 = randomDado <= 1;
var dado2 = randomDado <= 2;
var dado3 = randomDado <= 3;
var dado4 = randomDado <= 4;
var dado5 = randomDado <= 5;
var dado6 = randomDado <= 6;
if (dado1){
dado.gotoAndStop (1);
boneco.nextFrame();
}else if (dado2){
dado.gotoAndStop (2);
boneco.gotoAndStop (currentframe + 2);
}
else if (dado3){
dado.gotoAndStop (3);
boneco.gotoAndStop (currentframe + 3);
}
else if (dado4){
dado.gotoAndStop (4);
boneco.gotoAndStop (currentframe + 4);
}
else if (dado5){
dado.gotoAndStop (5);
boneco.gotoAndStop (currentframe + 5);
}
else if (dado6){
dado.gotoAndStop (6);
boneco.gotoAndStop (currentframe + 6);
}
}
Can someone help me to solve this problem. I just want to make the movieclip boneco walk forward following the number of frames the dice has sorted.
Tks
Gabriela