| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I use the following code to make a particular scene in a movie play random frames and it works fine, but I was wondering if it is possible to make it so once a frame is selected it will not be selected again unless the scene is accessed again or maybe all the frames are done. Thanks.
Code:
//generate a random number from 1 to 157
var nRandom = 1 + Math.floor(Math.random()*157);
// tell timeline to goto and play the random number 'nRandom'
gotoAndstop(nRandom);
home_btn.onRelease = function() {
gotoAndplay("Scene1", 1);
}
|
|
#2
|
||||
|
||||
|
The theory would be to store the generated random numbers in an array. That way you can build a loop to check if the generated number is in the array. If it is then go back and generate a new number, if it isn't then add the new number to the array and play that frame. You would need to test the length of the array so that if it was full (had 157-1 records) then the code would empty the array so that the process could start again.
__________________
-
thought-after | my thoughts on web development Get Firefox, the developers browser Budget hosting - recommended [/left] |
|
#3
|
|||
|
|||
|
Wow. I will research that. Can you give me a start. I am not a professional programmer. Thanks again though
Quote:
|
![]() |
| Viewing: ASP Free Forums > Web Design > Multimedia > ActionScript Help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|