Copy link to clipboard
Copied
Hey everyone,
I was wondering how I would be able to "Click to Go to Frame and Stop" (In code snippets), but add something to it, that makes it not go past a certain frame.
For example:
I am creating a slideshow
I already have a next button
I want to do a secret button
Frames 1-11 are a part of my slideshow
Frame 12 is my "secret" part of my slideshow, something I dont want accessible by the next button
How would I code this to work?
Does anyone know how I'd be able to do this?
Thank you!
Hi.
Use the Math.min method. Like this:
import flash.events.MouseEvent;
var frameLimit:uint = 11;
function goForward(e:MouseEvent)
{
gotoAndStop(Math.min(currentFrame + 1, frameLimit));
};
stop();
yourButton.addEventListener(MouseEvent.CLICK, goForward);
Regards,
JC
Copy link to clipboard
Copied
Hi.
Use the Math.min method. Like this:
import flash.events.MouseEvent;
var frameLimit:uint = 11;
function goForward(e:MouseEvent)
{
gotoAndStop(Math.min(currentFrame + 1, frameLimit));
};
stop();
yourButton.addEventListener(MouseEvent.CLICK, goForward);
Regards,
JC