Author: Tomas Rutkauskas
I'm writing a program that plays an AVI when it starts and placed the
mediaplayer.play command on the FormActivate event. The problem is that the movie
starts playing before all objects have been painted and after all objects are
painted the movie blinks. Is there a way to control that the movie starts after the
form has been painted completely and not before?
Answer:
You could use e.g. a private variable of type boolean and a timer:
1 procedure TForm1.FormActivate(Sender: TObject);
2 begin3 ifnot AviPlayed then4 Timer1.Enabled := True;
5 end;
6 7 procedure TForm1.Timer1Timer(Sender: TObject);
8 begin9 Timer1.Enabled := False;
10 {play your avi here}11 AviPlayed := True;
12 end;