-
Is there a way to set Random (number) to not include 0? What I need to do is use this function to tell a movie clip to go to a random frame number. If 0 is the random number, it won't know where to go.
Here is what I have on the button: (Flash 4)
On Release
Begin Tell Target ("MC")
Go To and Stop (Random (2))
End Tell Target
End On
Thanks in advance,
-
Is there a way to set Random (number) to not include 0? What I need to do is use this function to tell a movie clip to go to a random frame number. If 0 is the random number, it won't know where to go.
Here is what I have on the button: (Flash 4)
On Release
Begin Tell Target ("MC")
Go To and Stop (Random (2))
End Tell Target
End On
Thanks in advance,
-
Alright, now I feel like a moron. I guess I had a brain fart or something. I thought of the answer seconds after posting this question. For those who don't know, here's the answer.
On Release
Begin Tell Target ("MC")
Go To and Stop (Random (1)+ 1)
End Tell Target
End On
Thanks,
-
Stinger,
what you are trying to do is interesting. can you explain what the line "Random(1)+1" is doing to the movie. . .
Thank you [img]/infopop/emoticons/icon_smile.gif[/img]
-
I am working on game for a company that wants their information set up in the same format as the popular TV show "Who Wants to be a Millionaire". This would be much easier to set up if it were connecting to a database but they want this game to be played on a single computer without external connections from a CD. When done in this manner, the "database" (information/questions/answers) is really housed within Flash itself. The "random" expression comes with the questions being asked. It really goes beyond "Random (1) + 1. Actually, there are 15 Movie Clips (for the 15 questions) but there are 100 questions within each movie clip. For question 1, it asks, "for question 1, choose a random question from Movie Clip #1" and for question 2, it asks, "for question 2, choose a random question from Movie Clip #2", etc. Obviously, there are 1500 questions in all and each movie clip has more difficult questions within them.
I hope this helps you understand this better. Lord knows, I'm still a bit confused while putting this together.
Thanks,
-
oh - uh, if you were asking why he's adding 1 to the random number it's because random(x) ends up with a random number n where 0 < n < x. this means that if you have something like random_(4) you can get a response in the set of {0,1,2,3}. notice that 0 is counted as a number in this case - but if you were looking for something in the set {1,2,3,4} then you'd want to add 1 to your response.
as another example, if you wanted a random number between 49 and 54 (inclusive) you would use random(6) + 49 because there are 6 digits it can choose from {49,50,51,52,53,54,55,56}, so we get a random number between 0 and 5 (inclusive) then add 49 to the response.
hopefully this explains why he added the 1. [img]/infopop/emoticons/icon_smile.gif[/img]
hth,
Deep (just a guy)
<font face="arial" size="2">
Pradeep Kumar Nair, B.Math
Senior Web Designer
http://www.blab.com
ICQ: 39102360
</font>