Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Timer-Super Easy!!!

Posted on 2003-11-05
3
Medium Priority
?
192 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
[X]
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
3 Comments
 

Accepted Solution

by:
Rouneh earned 120 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
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 live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

610 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