Link to home
Start Free TrialLog in
Avatar of brohans
brohans

asked on

timer?

i need to turn on a animation..i mean play an avi for some time like 5 secs
and turn it off after that....the avi will play only when the user clicks the start button
how do i do this in vb?
Avatar of vinoopauls
vinoopauls

Try this code:

   At design time set timer1.enabled=false
                              timer1.interval=5000

Private Sub Command1_Click()
    Timer1.Enabled = True
'  Play the AVI
End Sub

Private Sub Timer1_Timer()
'  Stop the AVI
Timer1.Enabled = False
End Sub

Avatar of brohans

ASKER

how do i play the animation before i show a form?
the animation must play for a while before the form is shown e.g.
as i click on the start button..the animation plays ..then the form shows

i used the code above and did not work..
the animation does not play before the form is shown..

(declarations)

bEnd as boolean

Private Sub Form_Initialise()
         Timer1.Interval = 5000
         Timer1.Enabled = True
         bEnd = false      
     '  Play the AVI  here

          while not(bEnd)
          wend


     End Sub

     Private Sub Timer1_Timer()
     '  Stop the AVI here
        Timer1.Enabled = False
        bEnd = true
     End Sub
But where is this start button??
That has to be on some form. put the timer on that form
Avatar of brohans

ASKER

i tried yr method
and it hang my pc probably
due to the
while loop that u suggest above...
can u correct it?
Avatar of brohans

ASKER

i tried yr method
and it hang my pc probably
due to the
while loop that u suggest above...
can u correct it?
ASKER CERTIFIED SOLUTION
Avatar of deighton
deighton
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial