Search code examples
javascriptadobe-edge

Adobe Edge Animate Creating a slideshow with imagecount playing automoaically


My stage's compositionready has this code

//Variable
imageCount = 1;

and I have two buttons.

imageCount++;

sym.$("photo").attr("src","images/photo_"+imageCount+".jpg");

How can I manipulate the code so that the image count will automatically count up with a set time of (3 secsonds) without having to click the button each time?


Solution

  • It seems you want to update an image every 3 seconds as a slideshow, if that is the case check the code below.

    Here the myOtherFunction is being called every 3 seconds (3000 milliseconds),

    var imageCount = 1;
    var myVar = setInterval(myOtherFunction, 3000);
    
    function myOtherFunction() {
        sym.$("photo").attr("src","images/photo_"+imageCount+".jpg");
        imageCount++;
    }