PDA

View Full Version : How To Tell When LoadMovie() Finishes?


dugla
08-02-2001, 10:37 PM
Hello,

How do I tell when LoadMovie has completed? Specifically, I have spawned a bunch of mc instances on the main timeline. In a timeline based loop I repeatedly call loadMovie() for each instance. I need to know exactly when each loadMovie() call completes so I can make a beep sound.

I realize loadMovie() is asychronous but am at a loss for a robust way to do what I want.

Cheers,
Doug

Jesse
08-03-2001, 02:27 AM
if you search the forums for my 'sequential preloader' it will give you an idea of how to use getBytesToal() to determine when an external movie is fully loaded.

dugla
08-03-2001, 10:22 AM
Jesse,

Actually, I think I came up with a clean solution. For each .swf file that is loaded via loadMovie() I place the following code on a separate layer:

frame #1:
if (_framesloaded > 0 && _framesloaded == _totalframes){
gotoAndStop(3);
}

frame #2:
gotoAndPlay(_currentframe - 1);

frame #3:
my beep sound is placed here.


--
Simple and clean. I have not yet tested this over a slow connection but it appears to give very go sync. between the loading of the file and the beeping of the sound.

Cheers,
Doug

Jesse
08-04-2001, 02:00 AM
the concept is good but I always use bytes rather than frames because I'm not sure if frames will allow for objects embedded in the library but not on any frame (objects used with attachMovie for instance). but if it work, who cares? ;)