A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [RESOLVED] Automatically goto next frame for slideshow

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    3

    resolved [RESOLVED] Automatically goto next frame for slideshow

    Hi,

    I'm trying to advance to the next frame after 3 seconds on my timeline using actionscript 3. Is there a way to do this? I have 1 image per frame on my timeline.

    Thank you,

    Bill

  2. #2
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    You can use the Timer class. Have an event that advances to the next frame every three seconds
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    3
    @samac1068 Thanks! I found this timer class online but don't really know how to implement it (I'm a beginner). How can I modify this to advance to the next frame?

    var myTimer:Timer = new Timer(1000, 1); // 1 second
    myTimer.addEventListener(TimerEvent.TIMER, runOnce);
    myTimer.start();

    function runOnce(event:TimerEvent):void {
    trace("runOnce() called @ " + getTimer() + " ms");
    }

  4. #4
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    actionscript Code:
    var myTimer:Timer = new Timer(3000);
    myTimer.addEventListener(TimerEvent.TIMER, threeSec);
    myTimer.start();

    function threeSec(event:TimerEvent):void
    {
       this.nextFrame();
    }

    Just need to add the command within the function for the Timer. As long as the layer extends the length of the timeline then you should be good.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  5. #5
    Junior Member
    Join Date
    Mar 2011
    Posts
    3
    Thanks again

  6. #6
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    NP. Make sure to mark this thread as resolved from the Thread Tools.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center