Solved

Timer-Super Easy!!!

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

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

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

733 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