4 Replies Latest reply on May 1, 2016 4:02 PM by Wicktor

    loop control

    Wicktor

      hello everyone,

      I have a loop controlling the presentation of images (stored in container fields).

      The presentation is user user-controlled by a previous menu where the user can choose the kind of images, the size, and the speed of transition.

      The loop is basically as follows:

       

      Pause/Resume Script [ Indefinitely ]

      Show Custom Dialog ["Click button to start"]

      Set Variable [ $counter ; Value: 0]

      Loop

        Set Variable [ $counter ; Value: $counter + 1]

        Set Field [ ShowImage ; GetRepetition (StoredImages; $counter) ]

        Pause/Resume Script [ Duration (seconds): ShowTime]

        Exit Loop If [$counter = Count (StoredImages)]

      End Loop

       

      My questions is about controlling a loop, i.e. allowing the user at any point to revert the direction of the presentation, for example after viewing images 1, 2, 3, 4....N, the user may desire to revert the presentation going backwards 19, 18, 17......N, and then able to return going forward.

       

      Thanks for any help,

      Victor

        • 1. Re: loop control
          BruceRobertson

          I'd suggest a slight change to your loop.

          This doesn't address the other part of your question.

           

          Pause/Resume Script [ Indefinitely ]

          Show Custom Dialog ["Click button to start"]

          Set Variable [ $counter ; Value: 0]

          Loop

            Set Variable [ $counter ; Value: $counter + 1]

            Exit Loop If [$counter > Count (StoredImages)]

            Set Field [ ShowImage ; StoredImages[$counter]  ]

            Pause/Resume Script [ Duration (seconds): ShowTime]

          End Loop

          • 2. Re: loop control
            siplus

            In your specific setup I'd work with the OnLayoutKeystroke trigger, looking for forward / backward arrow to manually advance / go back a pic and maybe up / down arrows to start automatic play with a fixed delay, in forward / reverse mode.

            • 3. Re: loop control
              Wicktor

              hi siplus,

              thanks for your suggestion.

              I did manage including two buttons "forward" and "backward" calling two different scripts and it works.

              But your suggestion is valuable and I will certainly use it for an other layout where buttons are not likely to be shown.

              • 4. Re: loop control
                Wicktor

                Hi Bruce,

                yes, correction made