Reset slide for review

Hi guys,

I've made a community skin with flash & the Articulate Developer SDK   I'm having trouble with the progress bar functionality   The client would like to replay the slide when after it's complete   So basically I have an interval that checks the progress bar for end of slide

ArtAPI GetCurrentSlideTime() < slideDurations[currSlide] // slideDurations is a preloaded array of all the slide duration times

so when that condition is false, the slide is complete and I clear the interval, reset the status bar time, play/pause buttons etc   The problem is, no matter what I do, I can never get the slide to reset to the beginning   I've tried

ArtAPI GotoFrame(0), ArtAPI GotoFrame(1), ArtAPI PlaySlideNum( currSlide ), and various combinations there of, but the ArtAPI GetCurrentSlideTime() stubbornly stays at the end of of the slide   Please help, I've been bashing my head against the wall for a few days now

Here's the full code of my interval function, traceDebug is just a function that writes to a runtime text field so I can see what's going on

function updateStatus() {
    traceDebug( "-- UPDATE STATUS --" );
   
    if ( ArtAPI IsPlaying() && ArtAPI GetCurrentSlideTime() != undefined) {
        traceDebug( " current time: " + ArtAPI GetCurrentSlideTime() );
        traceDebug( " duration: " + slideDurations[currSlide] );
       
        var ratio = ArtAPI GetCurrentSlideTime() / slideDurations[currSlide];
       
        if ( ArtAPI GetCurrentSlideTime() < slideDurations[currSlide] ){
            traceDebug( " playing " );
            with ( progressBar ){
                currTimeTxt text = formatTime( ArtAPI GetCurrentSlideTime() );
               
                scrubber _x = scrubber startX + Math round( ratio * progressW );
               
                progressFill _width = Math round( ratio * progressW );
            }
           
        } else {
            traceDebug( " end of slide " );
           
           
            ArtAPI GotoFrame(1);
            //ArtAPI PlaySlideNum( currSlide );
            //ArtAPI Pause();
            traceDebug( "current time: " + ArtAPI GetCurrentSlideTime() );
            traceDebug( "current slide: " + ArtAPI GetCurrentSlide() );
               
            rightNav pauseBtn _visible = false;
            rightNav playBtn _visible = true;
           
            with ( progressBar ){
                playStatusTxt text = "Paused";
                currTimeTxt text = "00:00";
                scrubber _x = scrubber startX;
                progressFill _width = 0;
            }
           
            clearInterval( statusInterval );
           
        }
    }
}

6 Replies
onEnterFrame (James Kingsley)

OK this is untested advice but

It seems like once the slide gets to the end it is no longer playing and therefore will not meet the requirement of your first IF statement "if ( ArtAPI IsPlaying() "

Does ELSE portion of the nested IF statement run? Does it  traceDebug( " end of slide " );?

Ryan Boros

Appreciate the help James,

I wonder if there's something that I need to do to the slides themselves   All I'm doing is testing my skin with 5 slide that have nothing on them except for title text   So they're as no frills as you get   They have the standard 5 second length   But ArtAPI GotoFrame(1); is the way to reset the slide to the beginning correct?  So I'm at least making the appropriate call that should be doing what I want?

onEnterFrame (James Kingsley)


Well in ours we are not trying to replay the slide but instead set the playhead to where ever the user has clicked on the progress bar

This is what works for us:

/**

 * Update the progress bar to the clicked position/frame

 */

function updateClickedPB():Void {

if (skin progressBar _xmouse skin progressBar _width ||

skin progressBar _ymouse skin progressBar _height) {

return;

}

var progressBarPosition = skin progressBar _xmouse;

if (progressBarPosition > 295) {

progressBarPosition = 295;

}

skin progressBar progressBarFill _width =  progressBarPosition;

skin progressBar slideBar _x = progressBarPosition;

var clickedFrame:Number = Math floor( (skin progressBar _xmouse / (skin progressBar _width - 2)) * _level44 nTotalFrames);

ArtAPI GotoFrame(clickedFrame);

}

We have a similar function for when the user scrubs the bar with the handle

Ryan Boros

I think I have it, finally   It seems to be working at any rate so far   After my progress interval reaches the end, I call the ArtAPI GotoFrame(1);  Then on the play click, if it meets the conditions of replay (just a flag), I call the ArtAPI GotoFrame(1) and ArtAPI Play()   Somewhat hacky, but it works   If someone comes up with a more elegant solution, feel free to post

Thanks,