Flash slideshow help

  • Started
  • Last post
  • 2 Responses
  • estetic

    little flash slide show w/ buttons to move around to different frames...

    Anyway it works great, there is a 4 second delay at the end of each transition. The buttons to change where you are in the slideshow work but if you click around enough the delay no longer works (it just starts playing through without stopping/delay)

    Here is the AS2 I am using on the "delay" frames:

    stop();

    var DelayTime:Number = setInterval(this, "delay", 4000);

    function delay():Void {
    clearInterval(DelayTime);
    play(); // nextFrame();
    }

    The buttons are using "onrelease gotoandplay" directed to the frames with the AS above. I have tried gotoandstop and going to the frame prior to the delay frames (in hopes that it would play through to the next frame and execute the code above...) with no luck.

    Any help?

  • kumori040

    It sounds like it would be able to break if someone clicks around faster than the delay function can be called. I would add the following BEFORE declaring the DelayTime var:

    if (DelayTime != NaN) {
    clearInterval(DelayTime);
    }

    This way, if someone clicks, your interval will be created normally, but it'll also check first if there's already an interval running, and clears it before starting a new one.

  • estetic0

    PERFECT!
    Thanks.