Solved

Timer-Super Easy!!!

Posted on 2003-11-05
3
172 Views
Last Modified: 2010-04-03
Hi. I wanted to create a slide show w/ AUTOPLAY function (which is actually my problem)
I'd appreciate a lot if someone of you could please write a simple short ActioScript script (used with a BUTTON) that would automaticaly change the frame in a period of time (Also w/ stop function if possible).

Thanks, really
0
Comment
Question by:the-script
3 Comments
 

Accepted Solution

by:
Rouneh earned 30 total points
ID: 9707183
This should work if you're using Flash MX

--- Put this in your timeline ---
var skipInterval = 1000; // Delay before frame changes (in milliseconds)
function toggleAutoPlay() {
   if (autoPlayTimer != undefined)
      clearInterval(autoPlayTimer); // Turns off the timer if you click the button while autoplay is running
   else {
      autoPlayTimer = setInterval(
         function() { gotoAndStop((_root._currentframe < _root._totalframes)?_root._currentframe+1:1);},
         skipInterval
      ); // This bit sets the timer and makes sure to start at the beginning if you're at the last frame.
   }
}
stop();

--- Put this in your button ---
on(release) {
   toggleAutoPlay(); // You can click the same button to start and stop the autoplay sequence.
}

If you're not using Flash MX, however, things are a bit more complicated as there's no <setInterval> function in the earlier versions. Let me know if that's a problem.

Regards,
Rouneh
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now