Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Timer-Super Easy!!!

Posted on 2003-11-05
3
178 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Google Chrome Blank White Screens 13 302
Crash with shockwave flash 8 252
Begin mp4 video on first frame 6 179
free photo watermark software 5 93
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
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.

856 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