How to make images appear in intervals of seconds

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Will The Gray
    New Member
    • Jul 2010
    • 8

    How to make images appear in intervals of seconds

    Hi all

    I'm trying to let images appear after a fixed amount of seconds. So 3 second wait, image 1 appears, 3 second wait, image 2 appears, 3 second wait and image 3 appears.

    I've tried something but the problem is that all three images appear at the same time (dunno why) after 9 seconds.

    I want them to keep appearing one by one until the user answers a question correctly.

    in module:
    Code:
    Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    in program:
    Code:
        intSeconden = 3
        Call Sleep(intSeconden)
        imgHoofd.Visible = True
        Call Sleep(intSeconden)
        imgMidden.Visible = True
        Call Sleep(intSeconden)
        Imgvoet.Visible = True
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by Will The Gray
    Hi all

    I'm trying to let images appear after a fixed amount of seconds. So 3 second wait, image 1 appears, 3 second wait, image 2 appears, 3 second wait and image 3 appears.

    I've tried something but the problem is that all three images appear at the same time (dunno why) after 9 seconds.

    I want them to keep appearing one by one until the user answers a question correctly.

    in module:
    Code:
    Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    in program:
    Code:
        intSeconden = 3
        Call Sleep(intSeconden)
        imgHoofd.Visible = True
        Call Sleep(intSeconden)
        imgMidden.Visible = True
        Call Sleep(intSeconden)
        Imgvoet.Visible = True
    Just subscribing, will return.

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      I've created a Demo for you that will do exactly what you have requested by using the Form's Timer() Event, Timer Interval Property, dynamically Load Images into three Image Controls, alternately display the three Images and recycle them every three seconds, and allow a mechanism to shut down this Image Display Process. Simply download the Attachment and Unzip the four Files contained within to the 'same' Folder. It makes no difference whatsoever where that Folder is, but the Database File (Image Appear.mdb) and the three Image Files (1.bmp, 3.bmp, and 6.bmp) must exist in the same Folder . Any questions, feel free to ask.
      Attached Files

      Comment

      • Will The Gray
        New Member
        • Jul 2010
        • 8

        #4
        Thanks

        Thanks a million! Your example is exactly what I was looking for. I modified it a bit to start the timer when a button is clicked.

        There's still one more thing I need though. The timer needs to be reset to 0 after an event (when the user answers a question correctly), the first image is displayed again and the counter should start counting from 0 again.

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          #5
          Originally posted by Will The Gray
          Thanks a million! Your example is exactly what I was looking for. I modified it a bit to start the timer when a button is clicked.

          There's still one more thing I need though. The timer needs to be reset to 0 after an event (when the user answers a question correctly), the first image is displayed again and the counter should start counting from 0 again.
          If I am reading you correctly, then:
          1. Disable the Timer
          2. Set the first Image to Visible, and the other two to Not Visible
          3. Reset the Timer to 3 seconds
            Code:
            Me.TimerInterval = 0        'Disable Timer
            
            'Reset all the Images
            Me![imgHoofd].Visible = True
            Me![imgMidden].Visible = False
            Me![imgVoet].Visible = False
            
            Me.TimerInterval = 3000     '3 Seconds

          Comment

          Working...