Hi,
I've got a problem with the following code:
var mHandle = media_play("..\\movies\\edsel_start.avi", NULL, musicVolume);
while(media_playing(mHandle) > 0) {
if (key_pressed(1)) {
media_stop(mHandle);
}
wait(1);
}
The game should wait until the avi is played or a key is pressed, but in one out of maybe 20 tries the movie is played and the code didn't wait for it.
I also tried it like this:
var mHandle = media_play("..\\movies\\intro.avi", NULL, musicVolume);
wait(-2);
if (mHandle != 0) {
while(media_playing(mHandle) == 0) { // secure that avi is already playing
wait(1);
}
while(media_playing(mHandle) > 0) {
if (key_pressed(1)) {
media_stop(mHandle);
}
wait(1);
}
}
But it didn't help at all. I can reproduce it on different machines.
Can someone help me what's wrong with that code?
Regards,
Pegamode.