Hoping someone will know the answer / solution for this issue
I am having.
I have a three MC I want to play randomly every time the
flash file is executed. Along with the MC I have three buttons so
the user can switch between each. On the initial start-up of the
movie the first MC plays and the representative button moves above
the rest, which is action scripted separately.
I have the following code that provides me with a random
number between 0 - 2:
var myRand = random(3)
This works find. I then have an array as shown below holding
values on the frame labels.
var myArr:Array = new Array();
myArr = "benefit";
myArr = "function";
myArr = "process";
Again works ok. I know this because I have used the trace()
function on both the array and random functions. In order to get
one of the three MC to play I need to pull out the correct value
from the array using the random number generated. I did this with
the following code:
var sFrame = myArr[myRand];
Now I have the correct value from the array I need to create
a new variable to move the correct button. Again the value of this
variable works fine as I used the trace() function to monitor it.
var button = sFrame+"btn_mc";
Now to the first issue I have. In order to actual move the
correct button I have the following code:
'button' is the variable name holding the value of the actual
button's name, but when I test my movie the button the variable is
referring to does not move.
The next bit of code just makes all buttons inactive whilst
the assigned MC plays. It also sets the currentpage and nextpage
global variables, which I assume is working fine.
The next issue I am having is that based on random number I
have generated and used to pull the name of the frame label out of
my array, I cannot seem to get the movie to move to the correct
frame label and play the correct MC. Frankly weird stuff happens,
code is below:
I hope I have explained this well enough if anyone needs to
fla I will be happy to provide a ftp address.
I have managed to work out a way to get this working,
althought I am still not sure if this is the most efficient way it
works noneoftheless. I have created an if statement to work out
what to play when, and it works just how I required.