using slider to control slideshow

Hi,

For a slideshow emulating a movie with start, pause, and a scroll bar, I can’t figure out how to pause and drag to a different location.

Terminal confirms that the slideshow loop completes before actions begin onscreen, so I can’t grab the slider’s current location (i.e., With slider loc = 50, pause button returns 0, because variables have already been cleared for next run). Creates same problem for drag, and using a ‘break’ or ‘return true’ to stop.

The following code drives the slideshow – audio-synched images fade in/out. The slider updates like a (jerky) video scrollbar.

Is there a trick to this? Can a timer intervene when the code thinks it’s already complete? Thanks for any help that you can give.

Best,

LB

[lua]

function introStates()

–if pause pressed grab slider value & currNum & break out of loop

for i = 1, totalNum do

   currNum = currNum + 1;

   for j = 1, localGroup.numChildren do

      if ((localGroup[j].order == currNum) and (pauseFlag == 0)) then

         if currNum < totalNum then 

            transition.to(localGroup[j], 

              { delay = 2800 * (i - 1), time=500, alpha=1.0,

                onComplete= function () audio.play(localGroup[j].answer); introSlider:setValue(i*slValue); end } );

                --currLoc=i*slValue; end });

            transition.to( localGroup[j],

              { delay = (2800 * (i - 1)) + 2000, time=500, alpha=0.0});

               --, onComplete=function () if pauseFlag == 1 then return true; end end } );

         end

      end

   end

   --reset to replay from start

   currNum = 0;

   introSlider:setValue(0);

end

[/lua]

Update:

• transition.pause() and transition.resume() work for a straight up pause and resume.

• you can grab and derive the live slider location and order number in an onComplete function

Working on user-initiated slider-handle drag and resume. 

Update:

• transition.pause() and transition.resume() work for a straight up pause and resume.

• you can grab and derive the live slider location and order number in an onComplete function

Working on user-initiated slider-handle drag and resume.