When you say automatically, are you refering to playing the swf without user event, like pressing a button? If so all that code is a mute point. Stop() and gotoAndStop are just that, stopping the playhead. So to play automatically as I understand you, simply remove all stops and or use gotoAndPlay in your functions instead.
OK i understand.
So what i should do is simply remove the stops and use gotoAndPlay. And for delaying the pictures just insert frames in the layer were the pictures are located?
What if i want to add a autoplay button (for on and off) and a next and previous button for people to look at the pictures at their own pace?
1 person found this helpful
The swf playhead is either playing or it is not. If you want it to play automatically then you do not use stop, if you want to allow the user to stop the playhead then you would use a stop function with a user driven event, a mouse or keyboard event.
What you may want to look into, is a pause button, and or a button event like mouseOver and mouseOut, which would stop the playhead while the user hovers over the button and then resumes when focus is released. You can also code buttons to do just about anything you are looking for, stop, play, pause, previous frame, next frame, load something, unload something, and almost any combination thereof.
What you can do is use the setInterval function to have it automatically advance from one image to the next with a time delay to allow for viewing the images. Your current controls can remain as they are, but using them call on the clearInterval() function so as to stop the interval. So you could have a play button that initiates the setInterval() call, and the previous/next buttons would use the clearInterval() call to stop it. If you had a pause button, that too could clear the interval.
Your function that the setInterval would call would be similar to the code for your next button code.
Would it be too much to ask for a code example. Im new to actionscript.
You already have your button code in place, and as I mentioned, your next button code will be what you'll want in the function that setInterval calls. Being new to actionscript, you'll do yourself a favor to gain some competency in using the help documents from the start. Just look up the setInetrval() function and it will explain how it works and how to use it, possibly providing example code. But if the help documents don't provide enough info in a way you can understand, searching Google is the next stop... between those two tools I manage to solve just about anything when it comes to learning new things in Flash.