Okay. Here's what I want to do:
I want to have graphic that selects a random image from one that is provided, and uses it for the entire movie.
Now I have made a random image generator before by creating a movie clip with x number of frames (each frame representing a different image) and then sticking this code into the first frame of the movie clip:
gotoAndStop((Math.ceil(Math.random()*x));
where x is the actual number of frames (not a varible called x). Which therefore creates a random number between 1 and x and goes to that frame.
This is fine if I'm just using the image for a short bit. However, if I want to call that up again later in the movie, it will run the script and give me a new random image. Now one approach is to keep that thing around for the entire movie and just keep it hidden when it's not in use. However, since I already have the thing done using the image in multiple parts and in sperate symbols, that won't work.
Now my solution that I thought of would be to create some sort of global variable outside of the movie clip (either att he begining of the movie or at the part that I'll need it at) which generates a random number and keeps that number constant for the remainder of the movie. Let's call this variable "randomnumber". Then in my random movie clip I would use some code that is something like this:
gotoAndStop(randomnumber);
However, I don't know a lot about variable declaration and whether or not this could be done. So if you know how to do this, or know of a better way to solve my problem, please reply ASAP because I want to get my movie done soon and I thought this would be a great addition to it.