This content has been marked as final. Show 7 replies
How are these SWFs being played? Are they movies that are played from the timeline? Are they loading a FLV into them? How is this “time” being clocked? Depending on your answer will determine what code will be needed.
If all the SWF's are loaded, you can look at the _totalFrames property of
each to calculate the number of frames. AS you know the framerate, you can
easily calculate the times from that (this is assumign the SWF's don't loop
and just play from start to end)
Yes, they are movies played from the timeline. No .flvs involved. The container file calls on each .swf file to load into a target on the container's timline. Each .swf then plays through one at a time and the next .swf in line gets loaded upon completion. There are keyframes that conaint actionscript that says to load a specific .swf, then load the next one upon completion. The following is the code used to load the first .swf (001.swf, then load the next one in line, with is 004.swf:
/*Indicates name of SWF to play. Used by loaded and preloaded
SWFs to prevent premature playback.*/
SWFPlayIndic = "001.swf";
/*Calls function Preloader and sets
1) External SWF to load for playback
2) External SWF to preload for playback in next frame.*/
Right now I'm not actually clocking the time. There is are separate movie clips in the container file that are assigned to each .swf that play the progress bar as each swf is loaded. Ilke I said before, I had to fake it. :)
Yeah, if you are not using FLVs then do what Jeckyl suggested. The code below will load a SWF and when the onLoadInit event handler is invoked it will retrieve the incoming SWF’s totalframes property. I then divided this value by the FPS (frames-per-second) value (12). I don’t think there is an easy way to find out the SWF’s FPS. Also this code creates an empty movieclip 'container' that loads the incoming SWF.
I have a similar requirement to show current time and total time of separate swfs that each include flvs and some interactions. Is there a way to monitor the time to complete or elapsed time to total time with this situation?
If I can do this for one, I'm thinking I can have the start time for the second one begin at the end time of the first one and so on. Each swf (actually exe) file is on a separate CD.
Having interactions in a SWF would make it impossible to predict the total time as you probably know. Having key points in the application which will update the amount of time that is left would be ideal. You can monitor the user’s current time by using setInterval( ) and/or getTimer().
Thanks. I check into that. I may come back with more questions, but this gives me a place to work from.