Tangerine Dream
11-27-2008, 12:52 PM
I have one scene with many frames, and i want to jump to a series of different frames within the time line (in this case, frames: 2,86,171,256,341,426,511)
and then play from there. So at start of movie it will start in a different random position and play through, in order - then looping.
I have this but I know it is totally wrong, it wasn't designed to do what I want:
// define a array with all your previously defined labels
labelarray=[2,86,171,256,341,426,511];
// calculate a random index for this array
randomidx = random(labelarray.length);
// jump to the label at the random index
gotoAndPlay(labelarray[randomidx]);
Any help greatly appreciated :)
I'm sure it can't be that hard... but I've had no luck and been trying for a while now :(
EDIT (this is something else I came with, hat doesnt work either...)
num = Math.floor(Math.random() * (6 - 1)) + 1;
//Depending on which random number
//was chosen, go to a flash scene
if (num = 0)
{
gotoAndPlay(2)
}
if (num = 1)
{
gotoAndPlay(86)
}
if (num = 2)
{
gotoAndPlay(171)
}
if (num = 3)
{
gotoAndPlay(256)
}
if (num = 4)
{
gotoAndPlay(341)
}
if (num = 5)
{
gotoAndPlay(426)
}
if (num = 6)
{
gotoAndPlay(511)
}
and then play from there. So at start of movie it will start in a different random position and play through, in order - then looping.
I have this but I know it is totally wrong, it wasn't designed to do what I want:
// define a array with all your previously defined labels
labelarray=[2,86,171,256,341,426,511];
// calculate a random index for this array
randomidx = random(labelarray.length);
// jump to the label at the random index
gotoAndPlay(labelarray[randomidx]);
Any help greatly appreciated :)
I'm sure it can't be that hard... but I've had no luck and been trying for a while now :(
EDIT (this is something else I came with, hat doesnt work either...)
num = Math.floor(Math.random() * (6 - 1)) + 1;
//Depending on which random number
//was chosen, go to a flash scene
if (num = 0)
{
gotoAndPlay(2)
}
if (num = 1)
{
gotoAndPlay(86)
}
if (num = 2)
{
gotoAndPlay(171)
}
if (num = 3)
{
gotoAndPlay(256)
}
if (num = 4)
{
gotoAndPlay(341)
}
if (num = 5)
{
gotoAndPlay(426)
}
if (num = 6)
{
gotoAndPlay(511)
}