Random Frame
I have identified a button.
This button was going to the next frame.
But I want a random frame.
Would you like to see sample code.
thank you so much
I have identified a button.
This button was going to the next frame.
But I want a random frame.
Would you like to see sample code.
thank you so much
Say your button has instance name randomFrameBtn, add this code (adapt the minFrameNb and maxFrameNb to your timeline) :
randomFrameBtn.addEventListener( MouseEvent.CLICK, goToRandomFrame);
function goToRandomFrame( event:MouseEvent): void
{
var minFrameNb = 5;
var maxFrameNb = 20;
var randomFrameNb = minFrameNb +Math.floor( Math.random() * (maxFrameNb - minFrameNb + 1));
gotoAndStop( randomFrameNb);
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.