Anyone have any code handy that will randomly select a frame name and play that section?
Basically I want a section to play, then upon the last frame in that section a code will be executed to randomly select another frame name(section).
Anyone have any code handy that will randomly select a frame name and play that section?
Basically I want a section to play, then upon the last frame in that section a code will be executed to randomly select another frame name(section).
There might be some trouble in going to the value of a variable so in that case look into the eval() function.
Something like this should work:
var frames:Array = ['coolFrame', 'neatFrame', 'awesomeFrame', 'wowFrame', 'niceFrame'];
gotoAndPlay(frames[Math.floor(Math.random()*frames.length)]);
You shouldn’t need to worry about using eval. When moving the playhead to a labeled frame, gotoAndPlay accepts a string as the only parameter, and the elements of the array are all strings.
That’s perfect man, thanks.
:: Copyright KIRUPA 2024 //--